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

Rewriter Filter with dot in name #17

Open
Leo-VK opened this issue Jun 8, 2021 · 1 comment
Open

Rewriter Filter with dot in name #17

Leo-VK opened this issue Jun 8, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@Leo-VK
Copy link

Leo-VK commented Jun 8, 2021

Hi everyone

While using the parameters to filter the selected rewriters, we encountered an issue. An example index with settings is given below. It seems that a dot in the name of the rewriter leads to unexpected behaviour. If we upload two identical rewriters, one with a dot (common_rules.test) and another with a underscore (common_rules_test) as difference in the name, the filter does not have the same effect. In the case of the underscore, the filter is applied as expected. However, in the case of the dot, the filter is appearently ignored. Other functionalities besides the filter seem to work for both cases. The example was done with querqy version 1.4.es721.0.

Best regards

PUT /test
{
  "mappings": {
    "properties": {
      "title": { "type": "text" },
      "brand": { "type": "text" },
      "shortSummary": { "type": "text" }
    }
  }
}

PUT /test/_doc/1
{
  "title": "Notebook",
  "brand": "HP",
  "shortSummary": "very slim"
}
PUT /test/_doc/2
{
  "title": "Laptop",
  "brand": "Apple",
  "shortSummary": "very slim"
}

POST test/_search
{
  "query": {
    "match": {
      "title": "Notebook"
    }
  }
}

PUT  /_querqy/rewriter/common_rules_test
{
    "class": "querqy.elasticsearch.rewriter.SimpleCommonRulesRewriterFactory",
    "config": {
        "rules" : "notebook => \nSYNONYM: laptop \n UP(1000): laptop \n @{ \n _id: \"ID1\" \n, priority: 5, \n group: [\"hardware\"], \n tenant: [\"t1\", \"t3\"] \n }@"
    }
}

PUT  /_querqy/rewriter/common_rules.test
{
    "class": "querqy.elasticsearch.rewriter.SimpleCommonRulesRewriterFactory",
    "config": {
        "rules" : "notebook => \nSYNONYM: laptop \n UP(1000): laptop \n @{ \n _id: \"ID1\" \n, priority: 5, \n group: [\"hardware\"], \n tenant: [\"t1\", \"t3\"] \n }@"
    }
}

#Filter is not applied correctly, synonym is applied, notebook and laptop are returned
POST test/_search
{
   "query": {
       "querqy": {
           "matching_query": {
               "query": "notebook"
           },
           "query_fields": [
               "title^3.0", "brand^2.1", "shortSummary"
           ],
           "rewriters": [
             {
               "name": "common_rules.test",
               "params": {
                 "criteria": {
                   "filter": "$[?(\"ThisIsJustATest\" in @.group)]"
                 }
               }
             }]
      }
  }
}

#Filter is applied correctly, synonym is not applied, only notebook is returned
POST test/_search
{
   "query": {
       "querqy": {
           "matching_query": {
               "query": "notebook" 
           },
           "query_fields": [
               "title^3.0", "brand^2.1", "shortSummary"
           ],
           "rewriters": [
             {
               "name": "common_rules_test",
               "params": {
                 "criteria": {
                   "filter": "$[?(\"ThisIsJustATest\" in @.group)]"
                 }
               }
             }]
      }
  }
}
@renekrie renekrie added the bug Something isn't working label Jun 8, 2021
@renekrie
Copy link
Collaborator

renekrie commented Jun 8, 2021

Thank you for reporting this @Leo-VK!

This error looks a bit weird. It might be related to how rewriter-specific parameter names are handled in Querqy Core - we'll figure it out!

(Note that there is an update to the Querqy ES version that you are using, which fixes #15)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants