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
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

107 Zeilen
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 30
  46. docker run --rm -v "/Users/ad7588/$location:/$core" --network=host solr:latest post -c $core /$core
  47. }
  48. ############################################################
  49. ############################################################
  50. # Main program #
  51. ############################################################
  52. ############################################################
  53. # Set variables
  54. # Get the options
  55. while getopts ":hlimzaes" option; do
  56. case $option in
  57. l) # display License
  58. License
  59. exit;;
  60. h) # display Help
  61. Help
  62. exit;;
  63. z) # index all
  64. core="all"
  65. location="Downloads/2018 (10381)"
  66. Import
  67. exit;;
  68. a) # index ACTIVE folder
  69. core="active"
  70. location="Downloads/pop_rtfs/ACTIVE (160)"
  71. Import
  72. exit;;
  73. e) # index EXPANDING folder
  74. core="expanding"
  75. location="Downloads/pop_rtfs/EXPANDING (169)"
  76. Import
  77. exit;;
  78. i) # index INVISIBLE folder
  79. core="invisible"
  80. location="Downloads/pop_rtfs/IN.VISIBLE (204)"
  81. Import
  82. exit;;
  83. m) # index MULTI-SPECIES folder
  84. core="multispecies"
  85. location="Downloads/pop_rtfs/MULTI-SPECIES (180)"
  86. Import
  87. exit;;
  88. s) # index SURVIVING folder
  89. core="surviving"
  90. location="Downloads/pop_rtfs/SURVIVING (166)"
  91. Import
  92. exit;;
  93. \?) # Invalid option
  94. echo "Error: Invalid option"
  95. exit;;
  96. esac
  97. done