querqy / chorus-elasticsearch-edition

Chorus, now for Elasticsearch!
Apache License 2.0
14 stars 11 forks source link

Rules are not applied to suggested spellings #16

Closed atarora closed 1 year ago

atarora commented 2 years ago

Screenshot 2022-06-09 at 23 17 58

Screenshot 2022-06-09 at 23 21 03

The rules configured are not applied for suggested spellings.

(From the attached screenshots note the difference in search results)

wrigleyDan commented 2 years ago

Thanks for submitting this. I tried to replicate that and I'm able to make the replace rules work. Can you try a page refresh and see if you can still see the reported behavior? If the behavior still is the same: Can you attach the contents of your .querqy collection and the output of the query that's being built?

You should be able to get the latter in the dev console in Kibana by running something like the following command:

POST ecommerce/_validate/query?explain=true { "query": { "querqy": { "matching_query": { "query": "latpop" }, "query_fields": [ "id", "name", "title", "product_type", "short_description", "ean", "search_attributes" ], "rewriters": ["common_rules", "replace"] } } }

That'll help to identify what the underlying issue is. Thanks!

atarora commented 2 years ago

{ "_shards" : { "total" : 1, "successful" : 1, "failed" : 0 }, "valid" : true, "explanations" : [ { "index" : "ecommerce", "valid" : true, "explanation" : "+(short_description:laptop | product_type:laptop | ean:laptop | name:laptop | id:laptop | search_attributes:laptop | title:laptop)" } ] }

renekrie commented 2 years ago

Could it be that the replace rewriter is configured and fine but just not applied when we send the search request from the app? (= the rewriter name is missing in the search request?)

wrigleyDan commented 2 years ago

I think I found the issue. The configuration looks alright but it's the order of the rewriters that are applied. I can verify and test that next week.

Alternatively, if you want to give it a try @atarora, you can find the configuration of the requests in this file: chorus-elasticsearch-edition/reactivesearch/src/App.js

By changing the order of the configured rewriters the replace rule should be executed before the common rules and everything should work as supposed.

wrigleyDan commented 2 years ago

It was the order of the rewriters that prevented them from working correctly. I created a PR to fix this: https://github.com/querqy/chorus-elasticsearch-edition/pull/17

epugh commented 1 year ago

This was fixed in #17