Skip to content

Commit

Permalink
Update to latest Quepid... Requires Mysql8, and removes RRE (#163)
Browse files Browse the repository at this point in the history
* quepid now wants mysql 8, but smui is 5 I think. 

* workaround to make SMUI work with mysql 8...

* RRE won't run due to Maven not finding some jars so removed :-(.
  • Loading branch information
epugh authored Mar 13, 2024
1 parent 51f98bd commit 252a984
Show file tree
Hide file tree
Showing 21 changed files with 78 additions and 525 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ volumes/solr*
solr/configsets/ecommerce.zip
solr/data/*.json
solr/data/*.gz
rre/target
.idea
*.iml
__pycache__
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ We host a complete demonstration environment online for you to play with, see li
* Solr runs at http://localhost:8983 | http://chorus.dev.o19s.com:8983
* SMUI runs at http://localhost:9000 | http://chorus.dev.o19s.com:9000
* Quepid runs at http://localhost:3000 | http://chorus.dev.o19s.com:3000
* RRE runs at http://localhost:7979 | http://chorus.dev.o19s.com:7979
* Keycloak runs at http://keycloak:9080 | http://chorus.dev.o19s.com:9080
* Prometheus runs at http://localhost:9090 | http://chorus.dev.o19s.com:9090
* Grafana runs at http://localhost:9091 | http://chorus.dev.o19s.com:9091
Expand Down
9 changes: 1 addition & 8 deletions TECHNICAL_DETAILS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
| MySQL | root | password | docker-compose.yml |


`blockUnknown` is false as we want to let RRE run against the `ecommerce` collection. We have locked down in `security.json` to allow anonymous users only to hit the /ecommerce/select/ end point
`blockUnknown` is false as we want to let RRE (now removed from Chorus) run against the `ecommerce` collection. We have locked down in `security.json` to allow anonymous users only to hit the /ecommerce/select/ end point

When you bring up Solr Admin and then are redirected to Keycloak, when you register and sent back to Solr you are given the `solr-admin` role.

Expand Down Expand Up @@ -48,13 +48,6 @@ docker-compose run quepid thor user:create -a demo@example.com "Demo User" passw

For Quepid case, pick `name` for title, and `id` for identifier. Add `thumb:imageUrl` to the list of fields.

## Setting up RRE

```sh
docker-compose run rre mvn rre:evaluate
docker-compose run rre mvn rre-report:report
```

## Monitoring Details

Prometheus and Grafana setup heavily inspired by https://github.com/vegasbrianc/prometheus and https://github.com/chatman/solr-grafana-docker
Expand Down
20 changes: 2 additions & 18 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:

mysql:
container_name: mysql
image: amd64/mysql:5.7.40
image: mysql:8.3.0
ports:
- 3306:3306
environment:
Expand Down Expand Up @@ -173,7 +173,7 @@ services:

quepid:
container_name: quepid
image: o19s/quepid:6.14.0
image: o19s/quepid:7.15.1
ports:
- 3000:3000
command: "foreman s -f Procfile"
Expand Down Expand Up @@ -205,22 +205,6 @@ services:
- mysql
- redis

rre:
container_name: rre
build:
context: ./rre
dockerfile: Dockerfile
volumes:
- ./rre:/rre
ports:
- "7979:8080"
command: "java -jar rre-server-1.1.jar"
environment:
- SOLR_URL=http://solr1:8983/solr/ecommerce
depends_on:
- solr1


embeddings:
container_name: embeddings
build:
Expand Down
15 changes: 0 additions & 15 deletions katas/000_setting_up_chorus.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,23 +152,8 @@ Visit Quepid at http://localhost:3000 and log in with the email and password you

Go through the initial case setup process. Quepid will walk you through setting up a `Movie Cases` case via a Wizard interface, and then show you some of the key features of Quepid's UI. I know you want to skip the tour of Quepid interface, however there is a lot of interactivity in the UI, so it's worth going through the tutorial to get acquainted!

Now we are ready to confirm our second Offline Testing tool, Rated Ranking Evaluator, commonly called RRE, is ready to go. Unlike Quepid, which is a webapp, RRE is a set of command line tools that run tests, and then publishes the results in both a Excel spreadsheet format and a web dashboard.

Now, lets confirm that you can run the RRE command line tool. Go ahead and run a regression:

```sh
docker-compose run rre mvn rre:evaluate
```

You should see some output, and you should see the output saved to `./rre/target/rre/evaluation.json` in your local directory. We've wrapped RRE inside of the Docker container, so you can edit the RRE configurations locally, but run RRE in the container.

Now, let's go ahead and make sure we publish the results of our evaluation:

```sh
docker-compose run rre mvn rre-report:report
```

You can now see a html page saved to `./rre/target/site/rre-report.html`.

Bring up http://localhost:7979 and you will see a relatively unexciting empty dashboard. Don't worry, in our first kata, we'll do a relevancy test and fill this dashboard in.

Expand Down
28 changes: 1 addition & 27 deletions katas/001_optimize_a_query.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,32 +90,6 @@ Notice that our results have now turned green across the board from red? Our gr

There is a lot to unpack in here that is beyond the scope of this kata. However bear with me.

So now we feel like this is good results. However, while we've just tuned these notebook examples, what has the impact of the Querqy rule changes been on potentially other queries? Quepid is great for up to 60 or so queries per case, but it doesn't handle 100's or 1000's of queries well. Plus, we only get one search metric, in our case NDCG at a time. What if I want to calculate all the search metrics. For that, enter RRE.

RRE uses it's own format of ratings, so in Quepid, click the `Export` option in the toolbar. This will pop up a modal box, and choose the `Rated Ranking Evaluator` option. Then click `Export` and save this file on your desktop.

You then need to put this ratings into RRE. First move any ratings file in `./rre/src/etc/ratings/` out of that directory, leaving them in `./rre` is fine. Then take your freshly exported `Notebook_Computers_rre.json` file and put it in the `ratings` directory.

Now, lets look at the RRE setup. We want to regression test our pre Querqy algorithm and our post Querqy algorithm. So look at the template files in `./rre/src/etc/templates`. As you can see `v1.0` is just the simplistic query. However `v1.1` is using the Querqy enabled request handler. This is going to let us measure the two against each other.

While in this kata we are only running the same set of queries as in Quepid, in real life you would be regression testing those two queries against 100's of other rated queries as well.

So let's go run our evaluation! We're back on the command line:

```sh
docker-compose run rre mvn rre:evaluate
```

Look for a message about `completed all 2 evaluations` to know that it's running properly.

And once that completes, lets go ahead and publish the reports:

```sh
docker-compose run rre mvn rre-report:report
```

You have two ways of looking at the results of RRE running. There is an Excel spreadsheet you can look at, or you can use the online Dashboard available at http://localhost:7979.

Going into what all the metrics that RRE provides, and this is just a small sample set, is beyond this. Suffice to say, if you look at the NDCG@4 and NDCG@10, you will see that we had a big jump from the terrible results of v1.0 to the amazing results in v1.1!
So now we feel like this is good results. However, while we've just tuned these notebook examples, what has the impact of the Querqy rule changes been on potentially other queries? Quepid is great for up to 60 or so queries per case, but it doesn't handle 100's or 1000's of queries well. Plus, we only get one search metric, in our case NDCG at a time.

That all folks! You've successfully taken a bad 'notebook' query, assessed it to put a numerical value on the quality of the search, and then improved it using some rules to rewrite the query. You then remeasured, saw the quantitative improvement, and then ran a simulated regression test of those queries (and all your other ones in the real world), and have meaningfully improved search quality, which drives more revenue!
38 changes: 19 additions & 19 deletions quickstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ done
# Function check_prerequisites makes sure that you have curl, jq, docker-compose, and zip installed. See helpers.sh for details.
check_prerequisites

services="blacklight solr1 solr2 solr3 keycloak smui"


services="blacklight solr1 solr2 solr3 keycloak"

if $observability; then
Expand All @@ -68,7 +65,7 @@ else
fi

if $offline_lab; then
services="${services} quepid rre"
services="${services} quepid"
fi

if $vector_search; then
Expand All @@ -81,9 +78,7 @@ if $vector_search; then
fi
fi

if $active_search_management; then
services="${services} smui"
fi


if ! $local_deploy; then
echo -e "${MAJOR}Updating configuration files for online deploy${RESET}"
Expand All @@ -101,6 +96,15 @@ if $shutdown; then
exit
fi

if $active_search_management; then
# need to start MySQL and verify it is up and running before starting SMUI.
#log_major "Starting MySQL first to ensure fully available prior to starting SMUI."
docker compose up -d mysql
./mysql/wait-for-mysql.sh
services="${services} smui"

fi

docker-compose up -d --build ${services}

echo -e "${MAJOR}Waiting for Solr cluster to start up and all three nodes to be online.${RESET}"
Expand All @@ -123,7 +127,7 @@ docker exec solr1 solr zk cp /security.json zk:security.json -z zoo1:2181
log_minor "waiting for security.json to be available to all Solr nodes"
./solr/wait-for-zk-200.sh

echo -e "${MAJOR}Packaging ecommerce configset.${RESET}"
log_major "Packaging ecommerce configset."
(cd solr/configsets/ecommerce/conf && zip -r - *) > ./solr/configsets/ecommerce.zip
log_minor "posting ecommerce.zip configset"
curl --user solr:SolrRocks -X PUT --header "Content-Type:application/octet-stream" --data-binary @./solr/configsets/ecommerce.zip "http://localhost:8983/api/cluster/configs/ecommerce"
Expand Down Expand Up @@ -209,7 +213,7 @@ if $vector_search; then
fi


echo -e "${MAJOR}Defining relevancy algorithms using ParamSets.${RESET}"
log_major "Defining relevancy algorithms using ParamSets."
curl --user solr:SolrRocks -X POST http://localhost:8983/solr/ecommerce/config/params -H 'Content-type:application/json' -d '{
"set": {
"visible_products":{
Expand Down Expand Up @@ -385,7 +389,7 @@ fi


if $active_search_management; then
echo -e "${MAJOR}Setting up SMUI${RESET}"
log_major "Setting up SMUI"
SOLR_INDEX_ID=`curl -S -X PUT -H "Content-Type: application/json" -d '{"name":"ecommerce", "description":"Chorus Webshop"}' http://localhost:9000/api/v1/solr-index | jq -r .returnId`
curl -S -X PUT -H "Content-Type: application/json" -d '{"name":"product_type"}' http://localhost:9000/api/v1/${SOLR_INDEX_ID}/suggested-solr-field
curl -S -X PUT -H "Content-Type: application/json" -d '{"name":"title"}' http://localhost:9000/api/v1/${SOLR_INDEX_ID}/suggested-solr-field
Expand All @@ -396,27 +400,23 @@ if $offline_lab; then
log_major "Setting up Quepid"
./mysql/wait-for-mysql.sh

docker-compose run --rm quepid bin/rake db:setup
docker-compose run quepid thor user:create -a admin@choruselectronics.com "Chorus Admin" password
docker-compose run --rm quepid bundle exec bin/rake db:setup
docker-compose run quepid bundle exec thor user:create -a admin@choruselectronics.com "Chorus Admin" password
log_minor "Setting up Chorus Baseline Relevance case"
if $local_deploy; then
solr_collection_url=http://localhost:8983/solr/ecommerce/select
else
solr_collection_url=http://chorus.dev.o19s.com:8983/solr/ecommerce/select
fi
docker-compose run quepid thor case:create "Chorus Baseline Relevance" solr ${solr_collection_url} JSONP "id:id, title:title, thumb:img_500x500, name, brand, product_type" "q=#\$query##&useParams=visible_products,querqy_algo" nDCG@10 admin@choruselectronics.com
docker-compose run quepid bundle exec thor case:create "Chorus Baseline Relevance" solr ${solr_collection_url} JSONP "id:id, title:title, thumb:img_500x500, name, brand, product_type" "q=#\$query##&useParams=visible_products,querqy_algo" nDCG@10 admin@choruselectronics.com

docker cp ./katas/Broad_Query_Set_rated.csv quepid:/srv/app/Broad_Query_Set_rated.csv
docker exec quepid thor ratings:import 1 /srv/app/Broad_Query_Set_rated.csv >> /dev/null

docker exec quepid bundle exec thor ratings:import 1 /srv/app/Broad_Query_Set_rated.csv >> /dev/null

log_major "Setting up RRE"
docker-compose run rre mvn rre:evaluate
docker-compose run rre mvn rre-report:report
fi

if $observability; then
echo -e "${MAJOR}Setting up Grafana${RESET}"
log_major "Setting up Grafana"
curl -u admin:password -S -X POST -H "Content-Type: application/json" -d '{"email":"admin@choruselectronics.com", "name":"Chorus Admin", "role":"admin", "login":"admin@choruselectronics.com", "password":"password", "theme":"light"}' http://localhost:9091/api/admin/users
curl -u admin:password -S -X PUT -H "Content-Type: application/json" -d '{"isGrafanaAdmin": true}' http://localhost:9091/api/admin/users/2/permissions
curl -u admin:password -S -X POST -H "Content-Type: application/json" http://localhost:9091/api/users/2/using/1
Expand Down
16 changes: 0 additions & 16 deletions rre/Dockerfile

This file was deleted.

128 changes: 0 additions & 128 deletions rre/pom.xml

This file was deleted.

Binary file removed rre/rre-server-1.1.jar
Binary file not shown.
Loading

0 comments on commit 252a984

Please sign in to comment.