diff --git a/index.ps1 b/index.ps1 index aac97db..9658698 100644 --- a/index.ps1 +++ b/index.ps1 @@ -1,4 +1,15 @@ # Powershell script for Windows 10 and above to index the TMDB JSON file. -$data = Get-Content 'tmdb_solr_file.json' +if (![System.IO.File]::Exists('tmdb_data/tmdb_solr.json')) { + echo 'Extracting TMDB archive' + Expand-Archive -DestinationPath tmdb_data 'tmdb_solr.json.zip' +} + +# delete (or wipe) the tmdb index and reindex +Invoke-WebRequest -Method POST -Uri 'http://localhost:8983/solr/tmdb/update' -Body '*:*' -ContentType 'text/xml; charset=utf-8' + +Invoke-WebRequest -Method POST -Uri 'http://localhost:8983/solr/tmdb/update' -Body '' -ContentType 'text/xml; charset=utf-8' + + +$data = Get-Content 'tmdb_data/tmdb_solr.json' Invoke-WebRequest -Method POST -Uri 'http://localhost:8983/solr/tmdb/update' -ContentType 'application/json' -UseBasicParsing -Body $data diff --git a/index.sh b/index.sh index aebc0f3..54ae880 100755 --- a/index.sh +++ b/index.sh @@ -1,3 +1,11 @@ #!/bin/bash +if [ ! -f ./tmdb_solr.json ]; then + unzip tmdb_solr.json.zip +fi + +# delete (or wipe) the tmdb index and reindex +curl http://localhost:8983/solr/tmdb/update --data '*:*' -H 'Content-type:text/xml; charset=utf-8' + +curl http://localhost:8983/solr/tmdb/update --data '' -H 'Content-type:text/xml; charset=utf-8' curl 'http://localhost:8983/solr/tmdb/update?commit=true' --data-binary @tmdb_solr.json -H 'Content-type:application/json' diff --git a/tmdb_solr.json.zip b/tmdb_solr.json.zip index 2038adf..a80fcfb 100644 Binary files a/tmdb_solr.json.zip and b/tmdb_solr.json.zip differ