| @@ -52,12 +52,17 @@ Import() | |||
| #docker exec -ti --user=solr solr bash -c "cp -r /opt/solr/example/files/conf/* /var/solr/data/$core/conf/" | |||
| docker restart solr | |||
| #docker restart solr | |||
| sleep 30 | |||
| docker run --rm -v "$directory/$location:/$core" --network=host solr:latest post -c $core /$core | |||
| } | |||
| Import_recursive() | |||
| { | |||
| docker run --rm -v "$directory/$subdirectory:/$core" --network=host solr:latest post -c $core /$core | |||
| } | |||
| ############################################################ | |||
| ############################################################ | |||
| # Main program # | |||
| @@ -65,7 +70,7 @@ Import() | |||
| ############################################################ | |||
| # Set variables | |||
| directory="/Users/ad7588/projects/patent_site" | |||
| directory="/Users/ad7588/projects/patent_site/data" | |||
| # Get the options | |||
| while getopts ":hlimzaespxdw" option; do | |||
| @@ -78,52 +83,58 @@ while getopts ":hlimzaespxdw" option; do | |||
| exit;; | |||
| z) # index all | |||
| core="all" | |||
| location="data/POP Dataset 2022" | |||
| Import | |||
| docker exec -it solr bin/solr delete -c $core | |||
| docker exec -it solr solr create_core -c $core -d custom | |||
| location="POP_Dataset_2022" | |||
| for subdirectory in $location/*/ | |||
| do | |||
| subdirectory=${subdirectory%*/} # remove the trailing "/" | |||
| Import_recursive | |||
| done | |||
| exit;; | |||
| a) # index ACTIVE folder | |||
| core="active" | |||
| location="data/pop_rtfs/ACTIVE (160)" | |||
| location="pop_rtfs/ACTIVE (160)" | |||
| Import | |||
| exit;; | |||
| e) # index EXPANDING folder | |||
| core="expanding" | |||
| location="data/pop_rtfs/EXPANDING (169)" | |||
| location="pop_rtfs/EXPANDING (169)" | |||
| Import | |||
| exit;; | |||
| i) # index INVISIBLE folder | |||
| core="invisible" | |||
| location="data/pop_rtfs/IN.VISIBLE (204)" | |||
| location="pop_rtfs/IN.VISIBLE (204)" | |||
| Import | |||
| exit;; | |||
| m) # index MULTI-SPECIES folder | |||
| core="multispecies" | |||
| location="data/pop_rtfs/MULTI-SPECIES (180)" | |||
| location="pop_rtfs/MULTI-SPECIES (180)" | |||
| Import | |||
| exit;; | |||
| p) # index PISSING & LEAKING folder | |||
| core="pissing" | |||
| location="data/pop_rtfs/PISSING & LEAKING (168)" | |||
| location="pop_rtfs/PISSING & LEAKING (168)" | |||
| Import | |||
| exit;; | |||
| x) # index SECRET folder | |||
| core="secret" | |||
| location="data/pop_rtfs/SECRET (92)" | |||
| location="pop_rtfs/SECRET (92)" | |||
| Import | |||
| exit;; | |||
| d) # index SELF-DEFENDING folder | |||
| core="defending" | |||
| location="data/pop_rtfs/SELF-DEFENDING (115)" | |||
| location="pop_rtfs/SELF-DEFENDING (115)" | |||
| Import | |||
| exit;; | |||
| s) # index SURVIVING folder | |||
| core="surviving" | |||
| location="data/pop_rtfs/SURVIVING (166)" | |||
| location="pop_rtfs/SURVIVING (166)" | |||
| Import | |||
| exit;; | |||
| w) # index WORKING folder | |||
| core="working" | |||
| location="data/pop_rtfs/WORKING (101)" | |||
| location="pop_rtfs/WORKING (101)" | |||
| Import | |||
| exit;; | |||
| \?) # Invalid option | |||