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
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 2 години
преди 2 години
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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|a|e|i|m|p|x|d|s|w]"
  28. echo "options:"
  29. echo "l Print the MIT License notification."
  30. echo "h Print this Help."
  31. echo "z Index all."
  32. echo "a Index ACTIVE folder."
  33. echo "e Index EXPANDING folder."
  34. echo "i Index INVISIBLE folder."
  35. echo "m Index MULTI-SPECIES folder."
  36. echo "p Index PISSING & LEAKING folder."
  37. echo "x Index SECRET folder."
  38. echo "d Index SELF-DEFENDING folder."
  39. echo "s Index SURVIVING folder."
  40. echo "w Index WORKING folder."
  41. echo
  42. }
  43. Import()
  44. {
  45. docker exec -it solr bin/solr delete -c $core
  46. docker exec -it solr solr create_core -c $core -d custom
  47. #docker exec -ti --user=solr solr bash -c "cp -r /opt/solr/example/files/conf/* /var/solr/data/$core/conf/"
  48. #docker restart solr
  49. sleep 30
  50. docker run --rm -v "$directory/$location:/$core" --network=host solr:latest post -c $core /$core
  51. }
  52. Import_recursive()
  53. {
  54. docker run --rm -v "$directory/$subdirectory:/$core" --network=host solr:latest post -c $core /$core
  55. }
  56. ############################################################
  57. ############################################################
  58. # Main program #
  59. ############################################################
  60. ############################################################
  61. # Set variables
  62. directory="/Users/ad7588/projects/patent_site_python"
  63. # Get the options
  64. while getopts ":hlimzaespxdw" option; do
  65. case $option in
  66. l) # display License
  67. License
  68. exit;;
  69. h) # display Help
  70. Help
  71. exit;;
  72. z) # index all
  73. core="all"
  74. docker exec -it solr bin/solr delete -c $core
  75. docker exec -it solr solr create_core -c $core -d custom
  76. location="data/POP_Dataset_2022"
  77. for subdirectory in $location/*/
  78. do
  79. subdirectory=${subdirectory%*/} # remove the trailing "/"
  80. Import_recursive
  81. done
  82. exit;;
  83. a) # index ACTIVE folder
  84. core="active"
  85. location="data/pop_rtfs/ACTIVE (160)"
  86. Import
  87. exit;;
  88. e) # index EXPANDING folder
  89. core="expanding"
  90. location="data/pop_rtfs/EXPANDING (169)"
  91. Import
  92. exit;;
  93. i) # index INVISIBLE folder
  94. core="invisible"
  95. location="data/pop_rtfs/IN.VISIBLE (204)"
  96. Import
  97. exit;;
  98. m) # index MULTI-SPECIES folder
  99. core="multispecies"
  100. location="data/pop_rtfs/MULTI-SPECIES (180)"
  101. Import
  102. exit;;
  103. p) # index PISSING & LEAKING folder
  104. core="pissing"
  105. location="data/pop_rtfs/PISSING & LEAKING (168)"
  106. Import
  107. exit;;
  108. x) # index SECRET folder
  109. core="secret"
  110. location="data/pop_rtfs/SECRET (92)"
  111. Import
  112. exit;;
  113. d) # index SELF-DEFENDING folder
  114. core="defending"
  115. location="data/pop_rtfs/SELF-DEFENDING (115)"
  116. Import
  117. exit;;
  118. s) # index SURVIVING folder
  119. core="surviving"
  120. location="data/pop_rtfs/SURVIVING (166)"
  121. Import
  122. exit;;
  123. w) # index WORKING folder
  124. core="working"
  125. location="data/pop_rtfs/WORKING (101)"
  126. Import
  127. exit;;
  128. \?) # Invalid option
  129. echo "Error: Invalid option"
  130. exit;;
  131. esac
  132. done