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

Solr8.4.1 #9

Merged
merged 11 commits into from
Mar 4, 2020
Merged
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,20 @@ Two options exist to run Solr.
If you have [Docker](https://www.docker.com/products/docker-desktop) installed and running.

```
docker pull solr:7.7.1
docker run -p 8983:8983 -v $(PWD)/solr_home:/opt/mysolrhome -e SOLR_HOME=/opt/mysolrhome -e INIT_SOLR_HOME=yes solr:7.7.1
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 7.4.0](http://archive.apache.org/dist/lucene/solr/7.4.0/solr-7.4.0.zip)
1. Download and unpack [Solr 8.4.1](http://mirror.metrocast.net/apache/lucene/solr/8.4.1/solr-8.4.1.zip)

2. Run Solr pointing at the Solr Home directory included here
2. Navigate into the newly unzipped directory.

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

```
./bin/solr start -f -s /path/to/solr-tmdb/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 Down Expand Up @@ -77,3 +79,21 @@ python indexTmdb.py
Navigate [here](http://localhost:8983/solr/tmdb/select?q=title:lego) and confirm you get results.

If you don't see any results, trigger a [manual commit](http://localhost:8983/solr/tmdb/update?commit=true).

# Postman

[Postman](https://www.postman.com/) is an API development tool, that helps build, run and manage API requests. The examples from the TLRE slides exist here too as a Postman Collection (`solr-TLRE-postman_collection.json`). We like using Postman becasue it makes tinkering with query parameters nicer and we think it is a useful way to follow along as you learn about tuning search relevance.

If you want to use Postman during the TLRE class:

1. Download [Postman](https://www.postman.com/downloads/) for your OS
2. Open Postman and Import (top-menu >> File) `solr-TLRE-postman_collection.json`
3. Define a global variable (grey eye icon in the upper-right) `solr-host` to point to your running Elasticsearch instance (default is `localhost:8983`)
4. Tinker with the base URL, Params or JSON Body (optional)
5. Press 'Send' (blue rectangle button right of URL bar)

This collection is also valuable for testing examples against new versions of Elasticsearch. Using Postman's command line tool [Newman](https://github.com/postmanlabs/newman) you can check all of the requests in the collection:

```
newman run --global-var "solr_host=localhost:8983" solr-TLRE-postman_collection.json
```
4 changes: 1 addition & 3 deletions indexTmdb.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import pysolr


def indexableMovies():
""" Generates TMDB movies, similar to how ES Bulk indexing
uses a generator to generate bulk index/update actions """
Expand Down Expand Up @@ -31,5 +30,4 @@ def indexableMovies():

if __name__ == "__main__":
solr = pysolr.Solr('http://localhost:8983/solr/tmdb', timeout=100)
solr.add(indexableMovies())
solr.commit()
solr.add(indexableMovies(), commit=True)
Loading