Skip to content

Commit

Permalink
new data (#20)
Browse files Browse the repository at this point in the history
* new data

* update index script to actually wipe an existing index

* Powershell fixes

* unzip logic to index.sh

Co-authored-by: = <[email protected]>
  • Loading branch information
nathancday and worleydl authored Feb 3, 2021
1 parent 3c510e9 commit 7b841dc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
13 changes: 12 additions & 1 deletion index.ps1
Original file line number Diff line number Diff line change
@@ -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 '<delete><query>*:*</query></delete>' -ContentType 'text/xml; charset=utf-8'

Invoke-WebRequest -Method POST -Uri 'http://localhost:8983/solr/tmdb/update' -Body '<commit/>' -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
8 changes: 8 additions & 0 deletions index.sh
Original file line number Diff line number Diff line change
@@ -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 '<delete><query>*:*</query></delete>' -H 'Content-type:text/xml; charset=utf-8'

curl http://localhost:8983/solr/tmdb/update --data '<commit/>' -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'
Binary file modified tmdb_solr.json.zip
Binary file not shown.

0 comments on commit 7b841dc

Please sign in to comment.