A search interface for the Performing Patents Otherwise publication as part of 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 OPS API. https://patents.copim.ac.uk
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

160 行
5.3KB

  1. #!/bin/bash
  2. # @name: solr_import.sh
  3. # @creation_date: 2022-03-11
  4. # @license: The MIT License <https://opensource.org/licenses/MIT>
  5. # @author: Simon Bowie <ad7588@coventry.ac.uk>
  6. # @purpose: Runs imports of files into Solr indexes
  7. # @acknowledgements:
  8. # https://www.redhat.com/sysadmin/arguments-options-bash-scripts
  9. ############################################################
  10. # subprograms #
  11. ############################################################
  12. License()
  13. {
  14. echo 'Copyright 2022 Simon Bowie <ad7588@coventry.ac.uk>'
  15. echo
  16. 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:'
  17. echo
  18. echo 'The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.'
  19. echo
  20. 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.'
  21. }
  22. Help()
  23. {
  24. # Display Help
  25. echo "This script performs Solr import functions for different cores."
  26. echo
  27. echo "Syntax: solr_import.sh [-l|h|z|e|a|x|d|p|w|r|t]"
  28. echo "options:"
  29. echo "l Print the MIT License notification."
  30. echo "h Print this Help."
  31. echo "z Index all."
  32. echo "e Index EXPANDING folder."
  33. echo "a Index ACTIVE folder."
  34. echo "x Index SECRET folder."
  35. echo "d Index SELF-DEFENDING folder."
  36. echo "p Index LEAKING folder."
  37. echo "w Index WORKING folder."
  38. echo "r Index RESOURCEFUL folder."
  39. echo "t Index all themes folders."
  40. echo
  41. }
  42. Import()
  43. {
  44. docker exec -it solr bin/solr delete -c $core
  45. docker exec -it solr solr create_core -c $core -d custom
  46. #docker exec -ti --user=solr solr bash -c "cp -r /opt/solr/example/files/conf/* /var/solr/data/$core/conf/"
  47. #docker restart solr
  48. sleep 30
  49. docker run --rm -v "$main_directory/$location:/$core" --network=host solr:8.11.1 post -c $core /$core
  50. }
  51. Import_recursive()
  52. {
  53. docker run --rm -v "$main_directory/$subdirectory:/$core" --network=host solr:8.11.1 post -c $core /$core
  54. }
  55. ############################################################
  56. ############################################################
  57. # main program #
  58. ############################################################
  59. ############################################################
  60. # set variables
  61. main_directory="/Users/ad7588/projects/patent_site_python"
  62. expanding_directory="data/pop_rtfs/EXPANDING (169)"
  63. active_directory="data/pop_rtfs/ACTIVE (160)"
  64. secret_directory="data/pop_rtfs/SECRET (92)"
  65. leaking_directory="data/pop_rtfs/LEAKING (168)"
  66. working_directory="data/pop_rtfs/WORKING (101)"
  67. resourceful_directory="data/pop_rtfs/RESOURCEFUL (166)"
  68. # error message for no flags
  69. if (( $# == 0 )); then
  70. Help
  71. exit 1
  72. fi
  73. # get the options
  74. while getopts ":lhzeaxdpwrt" option; do
  75. case $option in
  76. l) # display License
  77. License
  78. exit;;
  79. h) # display Help
  80. Help
  81. exit;;
  82. z) # index all
  83. core="all"
  84. docker exec -it solr bin/solr delete -c $core
  85. docker exec -it solr solr create_core -c $core -d custom
  86. location="data/POP_Dataset_2022"
  87. for subdirectory in $location/*/
  88. do
  89. subdirectory=${subdirectory%*/} # remove the trailing "/"
  90. Import_recursive
  91. done
  92. exit;;
  93. e) # index EXPANDING folder
  94. core="expanding"
  95. location=$expanding_directory
  96. Import
  97. exit;;
  98. a) # index ACTIVE folder
  99. core="active"
  100. location=$active_directory
  101. Import
  102. exit;;
  103. x) # index SECRET folder
  104. core="secret"
  105. location=$secret_directory
  106. Import
  107. exit;;
  108. p) # index LEAKING folder
  109. core="leaking"
  110. location=$leaking_directory
  111. Import
  112. exit;;
  113. w) # index WORKING folder
  114. core="working"
  115. location=$working_directory
  116. Import
  117. exit;;
  118. r) # index RESOURCEFUL folder
  119. core="resourceful"
  120. location=$resourceful_directory
  121. Import
  122. exit;;
  123. t) # index all themes folders
  124. core="expanding"
  125. location=$expanding_directory
  126. Import
  127. core="active"
  128. location=$active_directory
  129. Import
  130. core="secret"
  131. location=$secret_directory
  132. Import
  133. core="leaking"
  134. location=$leaking_directory
  135. Import
  136. core="working"
  137. location=$working_directory
  138. Import
  139. core="resourceful"
  140. location=$resourceful_directory
  141. Import
  142. exit;;
  143. \?) # Invalid option
  144. Help
  145. exit;;
  146. esac
  147. done