From 7ff56a487aa47ec93bcbedd63abebf18cd66ca9b Mon Sep 17 00:00:00 2001 From: wrigleyDan Date: Thu, 7 Apr 2022 10:19:01 +0200 Subject: [PATCH 1/4] - Add Querqy libraries to the Solr installation - Include Querqy in solrconfig.xml - Update README.md - Update scripts to start the Docker container --- README.md | 6 ++-- docker-compose.yml | 14 ++++++++ docker.ps1 | 2 +- docker.sh | 2 +- docker/Dockerfile | 14 ++++++++ solr_home/tmdb/conf/solrconfig.xml | 51 ++++++++++++++++++++++++++++++ 6 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 docker-compose.yml create mode 100644 docker/Dockerfile diff --git a/README.md b/README.md index af232c0..9ceddd3 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,9 @@ Windows: 2. Navigate into the newly unzipped directory. -3. Run Solr pointing at the TMDB Solr Home directory included in this repo. +3. Open `/path/to/solr-tmdb-master/solr_home/tmdb/conf/solrconfig.xml` and change the path to include the extra libraries located in `/path/to/solr-tmdb-master/docker/lib`. + +4. Run Solr pointing at the TMDB Solr Home directory included in this repo. Linux/OSX: >bin/solr start -f -s /path/to/solr-tmdb-master/solr_home/ @@ -53,7 +55,7 @@ Windows: Regardless of the option you choose, navigate to [http://localhost:8983/solr/](http://localhost:8983/solr/) to confirm Solr is running. # Index TMDB movies -We have a movie data corpus sourced from The Movie Database (similar data to IMDB (Internet Movie Database). +We have a movie data corpus sourced from The Movie Database, similar data to IMDB (Internet Movie Database). Linux/OSX: > ./index.sh diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8e70067 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: '3' +services: + solr: + container_name: solr + build: ./docker + ports: + - "8983:8983" + environment: + - SOLR_OPTS=-XX:-UseLargePages + - SOLR_HEAP=800m + - SOLR_HOME=/opt/mysolrhome + - INIT_SOLR_HOME=yes + volumes: + - ./solr_home:/opt/mysolrhome diff --git a/docker.ps1 b/docker.ps1 index b52b617..b71adbd 100755 --- a/docker.ps1 +++ b/docker.ps1 @@ -1,2 +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.11.1 +docker-compose up -d diff --git a/docker.sh b/docker.sh index 9c260e9..cb909cc 100755 --- a/docker.sh +++ b/docker.sh @@ -6,4 +6,4 @@ if [ "$(uname -s)" == 'Linux' ]; then sudo chown -R 8983:8983 solr_home fi -docker run -p 8983:8983 -v "${PWD}/solr_home:/opt/mysolrhome" -e SOLR_HOME=/opt/mysolrhome -e INIT_SOLR_HOME=yes solr:8.11.1 +docker-compose up -d diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..c3c486b --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,14 @@ +FROM solr:8.11.1 + +# produced by building locally your Solr +#FROM apache/solr:9.0.0-SNAPSHOT + +# produced by Apache Solr project +#FROM apache/solr-nightly:9.0.0-SNAPSHOT + +# This is required by Solr 9, but not in Solr 8! +#RUN mkdir /var/solr/data + + +COPY ./lib/querqy-solr-5.1.lucene810.0-jar-with-dependencies.jar /opt/querqy/lib/ +COPY ./lib/querqy-regex-filter-1.1.0-SNAPSHOT.jar /opt/querqy/lib/ \ No newline at end of file diff --git a/solr_home/tmdb/conf/solrconfig.xml b/solr_home/tmdb/conf/solrconfig.xml index db94f1b..b62c0ed 100644 --- a/solr_home/tmdb/conf/solrconfig.xml +++ b/solr_home/tmdb/conf/solrconfig.xml @@ -57,6 +57,7 @@ --> + + + true + + + + + responseSink + querqy.solr.ResponseSink + + + + + replace + responseSink + + + + common_rules + responseSink + + + + regex_screen_protectors + responseSink + + + + + + + + + + + + text/javascript; charset=UTF-8 From 6f67d63758142adb9d4516ae4b3e5eef2f9c4fc1 Mon Sep 17 00:00:00 2001 From: wrigleyDan Date: Thu, 14 Apr 2022 12:41:37 +0200 Subject: [PATCH 2/4] - Include a field and fieldType that uses index time multi-term synonyms to demonstrate the sausagization issue --- solr_home/tmdb/conf/schema.xml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/solr_home/tmdb/conf/schema.xml b/solr_home/tmdb/conf/schema.xml index a94d983..25627f3 100644 --- a/solr_home/tmdb/conf/schema.xml +++ b/solr_home/tmdb/conf/schema.xml @@ -156,6 +156,8 @@ + + @@ -484,6 +486,26 @@ + + + + + + + + + + + + + + + + + From e124d132a79c3d26f29f2c78fc0d034d6d2531b2 Mon Sep 17 00:00:00 2001 From: wrigleyDan Date: Thu, 14 Apr 2022 14:17:52 +0200 Subject: [PATCH 3/4] - Include a postman request for adding a Querqy boost rule --- solr-postman-collection.json | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/solr-postman-collection.json b/solr-postman-collection.json index a47e24b..f398a7c 100644 --- a/solr-postman-collection.json +++ b/solr-postman-collection.json @@ -1531,6 +1531,42 @@ }, "response": [] }, + { + "name": "4-Add Querqy boost rule", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"class\": \"querqy.solr.rewriter.commonrules.CommonRulesRewriterFactory\",\n \"config\": {\n \"rules\" : \"action =>\\nUP(100): * genres:action\"\n }\n}\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{solr_host}}/solr/tmdb/querqy/rewriter/common_rules?action=save", + "host": [ + "{{solr_host}}" + ], + "path": [ + "solr", + "tmdb", + "querqy", + "rewriter", + "common_rules" + ], + "query": [ + { + "key": "action", + "value": "save" + } + ] + } + }, + "response": [] + }, { "name": "6-LTR", "request": { From 702be895e2b7b122b95494c09b0a23c116a9571b Mon Sep 17 00:00:00 2001 From: wrigleyDan Date: Thu, 14 Apr 2022 16:01:55 +0200 Subject: [PATCH 4/4] - Add _prelive logging to integrate PR feedback https://github.com/o19s/solr-tmdb/pull/28#discussion_r850446429 --- solr_home/tmdb/conf/solrconfig.xml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/solr_home/tmdb/conf/solrconfig.xml b/solr_home/tmdb/conf/solrconfig.xml index b62c0ed..3e4fde1 100644 --- a/solr_home/tmdb/conf/solrconfig.xml +++ b/solr_home/tmdb/conf/solrconfig.xml @@ -1441,6 +1441,15 @@ querqy.solr.ResponseSink + + + replace_prelive + responseSink + + + + common_rules_prelive + responseSink + +