A search interface for data from the Politics of Patents case study (part of Copim WP6): this parses data from the archive of RTF files and provides additional data from the European Patent Office API. https://patents.copim.ac.uk
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

134 lines
4.6KB

  1. #!/bin/bash
  2. # @name: solr_import.sh
  3. # @version: 0.1
  4. # @creation_date: 2022-03-11
  5. # @license: The MIT License <https://opensource.org/licenses/MIT>
  6. # @author: Simon Bowie <ad7588@coventry.ac.uk>
  7. # @purpose: Runs imports of files into Solr indexes
  8. # @acknowledgements:
  9. # https://www.redhat.com/sysadmin/arguments-options-bash-scripts
  10. ############################################################
  11. # Subprograms #
  12. ############################################################
  13. License()
  14. {
  15. echo 'Copyright 2022 Simon Bowie <ad7588@coventry.ac.uk>'
  16. echo
  17. echo 'Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:'
  18. echo
  19. echo 'The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.'
  20. echo
  21. echo 'THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.'
  22. }
  23. Help()
  24. {
  25. # Display Help
  26. echo "This script performs Solr import functions for different cores."
  27. echo
  28. echo "Syntax: solr_import.sh [-l|h|z|a|e|i|m|p|x|d|s|w]"
  29. echo "options:"
  30. echo "l Print the MIT License notification."
  31. echo "h Print this Help."
  32. echo "z Index all."
  33. echo "a Index ACTIVE folder."
  34. echo "e Index EXPANDING folder."
  35. echo "i Index INVISIBLE folder."
  36. echo "m Index MULTI-SPECIES folder."
  37. echo "p Index PISSING & LEAKING folder."
  38. echo "x Index SECRET folder."
  39. echo "d Index SELF-DEFENDING folder."
  40. echo "s Index SURVIVING folder."
  41. echo "w Index WORKING folder."
  42. echo
  43. }
  44. Import()
  45. {
  46. docker exec -it solr bin/solr delete -c $core
  47. docker exec -it solr solr create_core -c $core -d custom
  48. #docker exec -ti --user=solr solr bash -c "cp -r /opt/solr/example/files/conf/* /var/solr/data/$core/conf/"
  49. docker restart solr
  50. sleep 30
  51. docker run --rm -v "$directory/$location:/$core" --network=host solr:latest post -c $core /$core
  52. }
  53. ############################################################
  54. ############################################################
  55. # Main program #
  56. ############################################################
  57. ############################################################
  58. # Set variables
  59. directory="/Users/ad7588/projects/patent_site"
  60. # Get the options
  61. while getopts ":hlimzaespxdw" option; do
  62. case $option in
  63. l) # display License
  64. License
  65. exit;;
  66. h) # display Help
  67. Help
  68. exit;;
  69. z) # index all
  70. core="all"
  71. location="data/POP Dataset 2022"
  72. Import
  73. exit;;
  74. a) # index ACTIVE folder
  75. core="active"
  76. location="data/pop_rtfs/ACTIVE (160)"
  77. Import
  78. exit;;
  79. e) # index EXPANDING folder
  80. core="expanding"
  81. location="data/pop_rtfs/EXPANDING (169)"
  82. Import
  83. exit;;
  84. i) # index INVISIBLE folder
  85. core="invisible"
  86. location="data/pop_rtfs/IN.VISIBLE (204)"
  87. Import
  88. exit;;
  89. m) # index MULTI-SPECIES folder
  90. core="multispecies"
  91. location="data/pop_rtfs/MULTI-SPECIES (180)"
  92. Import
  93. exit;;
  94. p) # index PISSING & LEAKING folder
  95. core="pissing"
  96. location="data/pop_rtfs/PISSING & LEAKING (168)"
  97. Import
  98. exit;;
  99. x) # index SECRET folder
  100. core="secret"
  101. location="data/pop_rtfs/SECRET (92)"
  102. Import
  103. exit;;
  104. d) # index SELF-DEFENDING folder
  105. core="defending"
  106. location="data/pop_rtfs/SELF-DEFENDING (115)"
  107. Import
  108. exit;;
  109. s) # index SURVIVING folder
  110. core="surviving"
  111. location="data/pop_rtfs/SURVIVING (166)"
  112. Import
  113. exit;;
  114. w) # index WORKING folder
  115. core="working"
  116. location="data/pop_rtfs/WORKING (101)"
  117. Import
  118. exit;;
  119. \?) # Invalid option
  120. echo "Error: Invalid option"
  121. exit;;
  122. esac
  123. done