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文字以内のものにしてください。

154 行
5.1KB

  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 "$directory/$location:/$core" --network=host solr:8.11.1 post -c $core /$core
  50. }
  51. Import_recursive()
  52. {
  53. docker run --rm -v "$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. directory="/Users/ad7588/projects/patent_site_python"
  62. # error message for no flags
  63. if (( $# == 0 )); then
  64. Help
  65. exit 1
  66. fi
  67. # get the options
  68. while getopts ":lhzeaxdpwrt" option; do
  69. case $option in
  70. l) # display License
  71. License
  72. exit;;
  73. h) # display Help
  74. Help
  75. exit;;
  76. z) # index all
  77. core="all"
  78. docker exec -it solr bin/solr delete -c $core
  79. docker exec -it solr solr create_core -c $core -d custom
  80. location="data/POP_Dataset_2022"
  81. for subdirectory in $location/*/
  82. do
  83. subdirectory=${subdirectory%*/} # remove the trailing "/"
  84. Import_recursive
  85. done
  86. exit;;
  87. e) # index EXPANDING folder
  88. core="expanding"
  89. location="data/pop_rtfs/EXPANDING (169)"
  90. Import
  91. exit;;
  92. a) # index ACTIVE folder
  93. core="active"
  94. location="data/pop_rtfs/ACTIVE (160)"
  95. Import
  96. exit;;
  97. x) # index SECRET folder
  98. core="secret"
  99. location="data/pop_rtfs/SECRET (92)"
  100. Import
  101. exit;;
  102. p) # index LEAKING folder
  103. core="leaking"
  104. location="data/pop_rtfs/LEAKING (168)"
  105. Import
  106. exit;;
  107. w) # index WORKING folder
  108. core="working"
  109. location="data/pop_rtfs/WORKING (101)"
  110. Import
  111. exit;;
  112. r) # index RESOURCEFUL folder
  113. core="resourceful"
  114. location="data/pop_rtfs/RESOURCEFUL (166)"
  115. Import
  116. exit;;
  117. t) # index all themes folders
  118. core="expanding"
  119. location="data/pop_rtfs/EXPANDING (169)"
  120. Import
  121. core="active"
  122. location="data/pop_rtfs/ACTIVE (160)"
  123. Import
  124. core="secret"
  125. location="data/pop_rtfs/SECRET (92)"
  126. Import
  127. core="leaking"
  128. location="data/pop_rtfs/LEAKING (168)"
  129. Import
  130. core="working"
  131. location="data/pop_rtfs/WORKING (101)"
  132. Import
  133. core="resourceful"
  134. location="data/pop_rtfs/RESOURCEFUL (166)"
  135. Import
  136. exit;;
  137. \?) # Invalid option
  138. Help
  139. exit;;
  140. esac
  141. done