Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reworked with a powershell indexing script #18

Merged
merged 2 commits into from
Sep 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 22 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,51 @@ This repository is part of the _Think Like a Relevancy Engineer_ training provid

## Steps to get up and running:
- Download this repo
- Install the software (using either Docker or installing manually)
- Install Solr search engine and configuration (using either Docker or installing manually)
- Index the TMDB movie data
- Confirm Solr has the data
- Install Postman (optional)

# Download this repo

Download the zip from https://github.com/o19s/solr-tmdb/archive/master.zip
Download the zip from https://github.com/o19s/solr-tmdb/archive/master.zip, and
you will get the file `solr-tmdb-master.zip`. Unzip this file, resulting in the
directory `solr-tmdb-master`.

or clone it:

```
git clone https://github.com/o19s/solr-tmdb.git
```

After you have this repo, change into the newly created directory.
After you have this download, change into the newly created directory.

# Install Solr

Two options exist to run Solr locally, however if neither of them will work for you, we do
have a public version of this dataset deployed at http://quepid-solr.dev.o19s.com:8985/solr/ that
you can use during the class as well.
you can use during the class as well, so don't fret if your environment won't let you set up Solr!

### Docker option (recommended)

If you have [Docker](https://www.docker.com/products/docker-desktop) installed and running.

```
./docker.sh
```
Linux:
> ./docker.sh

or
Windows:
> powershell docker.ps1

```
docker pull solr:8.4.1
docker run -p 8983:8983 -v $(pwd)/solr_home:/opt/mysolrhome -e SOLR_HOME=/opt/mysolrhome -e INIT_SOLR_HOME=yes solr:8.4.1
```

### Local option

1. Download and unpack [Solr 8.4.1](https://archive.apache.org/dist/lucene/solr/8.4.1/solr-8.4.1.zip)

2. Navigate into the newly unzipped directory.

3. Run Solr pointing at the Solr Home directory included in this repo.
3. Run Solr pointing at the TMDB Solr Home directory included in this repo.

Linux:
>bin/solr start -f -s /path/to/solr-tmdb-master/solr_home/

Windows 10:
>bin\solr start -f -s \path\to\solr-tmdb-master\solr_home\

```
bin/solr start -f -s /path/to/solr-tmdb/solr_home/
```

Regardless of the option you choose, navigate to [http://localhost:8983/solr/](http://localhost:8983/solr/) to confirm Solr is running.

Expand All @@ -66,15 +62,13 @@ unzip tmdb_solr.json.zip

Then send the unzipped `tmdb_solr.json` into Solr.

```
./index.sh
```
Linux:
> ./index.sh

or
Windows 10:
> powershell index.ps1

```
curl 'http://localhost:8983/solr/tmdb/update?commit=true' --data-binary @tmdb_solr.json -H 'Content-type:application/json'
```
_If you get a permissions error, just open the index.ps1 file and copy and paste the contents into your Powershell console_

You are indexing a *big 100 mb file*, so this will take up to five minutes!

Expand Down
2 changes: 2 additions & 0 deletions docker.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

docker run -p 8983:8983 -v ${PWD}/solr_home:/opt/mysolrhome -e SOLR_HOME=/opt/mysolrhome -e INIT_SOLR_HOME=yes solr:8.4.1
4 changes: 4 additions & 0 deletions index.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Powershell script for Windows 10 and above to index the TMDB JSON file.

$data = Get-Content 'tmdb_solr_file.json'
Invoke-WebRequest -Method POST -Uri 'http://localhost:8983/solr/tmdb/update' -ContentType 'application/json' -UseBasicParsing -Body $data