Disable score for multiple matched ngrams

"_source": {
          "suggestion_id": "35_8_14",
          "suggestion_headerText": "İzmir kiralık Konut",
          "suggestion_hierarchy": "İzmir > kiralık > Konut",
          "suggestion_detailUrl": "?city=35&category=8",
          "suggestion_webUrl": "/satilik/izmir",
          "suggestion_locationOrder": 1,
          "suggestion_categoryOrder": "1",
          "suggestion_kindOrder": "1"
        },
"_source":{
         "suggestion_id": "482_35_8_15",
          "suggestion_headerText": "Kiraz Kiralık Konut",
          "suggestion_hierarchy": "İzmir > Kiraz > Kiralık > Konut",
          "suggestion_detailUrl": "?town=482&city=35&category=8",
          "suggestion_webUrl": "/kiralik/izmir-kiraz",
          "suggestion_locationOrder": 1482,
          "suggestion_categoryOrder": 1,
          "suggestion_kindOrder": 2

}

GET /db/suggestions/_search

{
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "suggestion_hierarchy": "izmir kiralık"
          }
        }
      ]
    }
  },
  "sort": [
       "_score", 
      {
      "suggestion_locationOrder": {
        "order": "asc"
      }
    },
    {
      "suggestion_kindOrder": {
        "order": "asc"
      }
    },
    {
      "suggestion_kindOrder": {
        "order": "asc"
      }
    }
  ],
  "size": 5
   
}

first my analyzer is edge_ngram , i want to see first "İzmir > kiralık > Konut" document but i cant because of score "kir" in "kiraz" and "kiralık" i dont want to override score im using it how can i prevent multiple ngram match's to the score

me neither

any help ? unique token filter didnt help

well ?

Can you post a complete reproduction of your problem, not just bits and pieces?

1 Like

document field => "Kiraz Kiralık Konut"
search_text => "kira"
result => kiraz kiralık konut

i want to only find ngram once and score it one time only
when " Kiraz Kiralık Konut" scored by multiple because its include 2 times "kir" my search algorithm break
İzmir kiralık konut has lower score then "Kiraz Kiralık Konut"
and Kiralık Konut has lower score then "Kiraz Kiralık Konut"
its all about ngrams multiple times found on field

Please see this post for more information on how to ask effective questions on this forum.

I think this is an oversimplification of the issue. If this is the only problem, you can solve it by expressing each term in your query as a separate match query wrapped into a constant score query, or you can switch to not using n-gram for your search and using it only for indexing, or you can add an additional search for exact match and give it higher boost. There are plenty of options with slightly different outcomes, but based on your description I can only guess what the problem is (you probably used n-gram for both searching and indexing instead of just indexing) and what you want to achieve.

okey thank you

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.