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
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

108 linhas
3.8KB

  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 [-m|h|a|b]"
  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 "s Index SURVIVING folder."
  38. echo
  39. }
  40. Import()
  41. {
  42. docker exec -it solr solr create_core -c $core
  43. docker exec -ti --user=solr solr bash -c "cp -r /opt/solr/example/files/conf/* /var/solr/data/$core/conf/"
  44. docker restart solr
  45. sleep 10
  46. docker run --rm -v "$directory/$location:/$core" --network=host solr:latest post -c $core /$core
  47. }
  48. ############################################################
  49. ############################################################
  50. # Main program #
  51. ############################################################
  52. ############################################################
  53. # Set variables
  54. directory="/Users/ad7588/projects/patent_site"
  55. # Get the options
  56. while getopts ":hlimzaes" option; do
  57. case $option in
  58. l) # display License
  59. License
  60. exit;;
  61. h) # display Help
  62. Help
  63. exit;;
  64. z) # index all
  65. core="all"
  66. location="data/2018 (10381)"
  67. Import
  68. exit;;
  69. a) # index ACTIVE folder
  70. core="active"
  71. location="data/pop_rtfs/ACTIVE (160)"
  72. Import
  73. exit;;
  74. e) # index EXPANDING folder
  75. core="expanding"
  76. location="data/pop_rtfs/EXPANDING (169)"
  77. Import
  78. exit;;
  79. i) # index INVISIBLE folder
  80. core="invisible"
  81. location="data/pop_rtfs/IN.VISIBLE (204)"
  82. Import
  83. exit;;
  84. m) # index MULTI-SPECIES folder
  85. core="multispecies"
  86. location="data/pop_rtfs/MULTI-SPECIES (180)"
  87. Import
  88. exit;;
  89. s) # index SURVIVING folder
  90. core="surviving"
  91. location="data/pop_rtfs/SURVIVING (166)"
  92. Import
  93. exit;;
  94. \?) # Invalid option
  95. echo "Error: Invalid option"
  96. exit;;
  97. esac
  98. done