Skip to content

Rewriter Filter with dot in name #17

Open
@Leo-VK

Description

@Leo-VK

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)]"
                 }
               }
             }]
      }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions