37 lines
708 B
Bash
37 lines
708 B
Bash
|
#!/bin/sh
|
||
|
|
||
|
set -e
|
||
|
|
||
|
if [[ "$#" -ne 1 ]]; then
|
||
|
echo "Usage: $0 [SOLR 8.6.2 ZIP PACKAGE]" 1>&2;
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
if [[ "$1" == '--clean' ]]; then
|
||
|
rm -rv solr || true
|
||
|
rm -rv solr_config/data || true
|
||
|
exit
|
||
|
fi
|
||
|
|
||
|
"$0" --clean
|
||
|
|
||
|
unzip "$1"
|
||
|
mv "solr-8.6.2" solr
|
||
|
rm -rv ./solr/server/solr/configsets/{_default,sample_techproducts_configs}
|
||
|
cd ./solr/server/solr
|
||
|
|
||
|
# Install my solr configuration
|
||
|
ln -s ../../../solr_config photo
|
||
|
|
||
|
# Start Solr
|
||
|
cd ../../..
|
||
|
solr/bin/solr start
|
||
|
cd scraped
|
||
|
|
||
|
# POST scraped data
|
||
|
cat photos.csv 123rf.csv | \
|
||
|
awk '{print NR-1 "," $0}' | \
|
||
|
tail -n +2 | \
|
||
|
awk 'BEGIN {print "id,t_author,t_title,t_description,date,img_url,tags"} {print}' | \
|
||
|
../solr/bin/post -c photo -type text/csv -out yes -d
|