Document score is incorrect?

i got stuck when searching with nGram filter

here is my index config
*
localhost:9200/area*

{

"name": "translations",
"number_of_shards": 5,
"number_of_replicas": 0,
"analysis": {
"analyzer": {
"translation_index_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": "standard,lowercase,translation,asciifolding"
},
"translation_search_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": "standard,lowercase,asciifolding"
}
},
"filter": {
"translation": {
"type": "nGram",
"min_gram": "2",
"max_gram": "15"
}
}
}
}

and my mapping

  • *localhost:9200/area/detail

{

"detail": {
"properties": {
"area_name": {
"type": "string",
"index_analyzer": "translation_index_analyzer",
"search_analyzer": "translation_search_analyzer",
"term_vector" : "with_positions_offsets"
}
}
}
}

i had done a search with my keyword "ho rua con" and 100% matching in
elasticsearch document.... but i have another document named "ho con rua"
... and when i search again .why is "ho rua con" score is equal to "ho con
rua" score ???

https://lh4.googleusercontent.com/-gxBFt3exabU/UNAZasY1z9I/AAAAAAAAAI4/K79AKTzaz1g/s1600/2012-12-18_140158.png
SORRY FOR MY BAD ENGLISH

--

On 12/17/2012 11:24 PM, NILE NGUYỄN wrote:

i had done a search with my keyword "ho rua con" and 100% matching in
elasticsearch document.... but i have another document named "ho con
rua" ... and when i search again .why is "ho rua con" score is equal
to "ho con rua" score ???

https://lh4.googleusercontent.com/-gxBFt3exabU/UNAZasY1z9I/AAAAAAAAAI4/K79AKTzaz1g/s1600/2012-12-18_140158.png
SORRY FOR MY BAD ENGLISH

--
Your English is fine. Your English is a lot better than many postings on
the internet. It seems clear to me. I think the longer phrases help a lot.

query_string takes what you enter and interprets not as a phrase, but as
individual parts of a Lucene query expression.
Therefore [ho] and [rua] and [con] are interpreted as separate terms
instead of a phrase.

query: { <--- the outer query that you are building

bool: { <-- the query used to put together everything you add with the [+] button.

  must: [  <-- your defined use of must to combine this expression in the overall boolean query

    { "bool" : { <-- my expansion of the query_string

      "should": [ <-- default for Lucene queries

          {term: { "testarea_name":"ho"},    <-- your terms in the "generated" query
          {term: { "testarea_name":"rua"},
          {term: { "testarea_name":"con"}

      ]
    }
  ]
}

}

I've shown it in ES format, even though it is never an ES query. It goes
directly to Lucene.
In Lucene

[ho rua con] becomes [ testarea_name:ho testarea_name:rua testarea_name:con]

I am using square brackets to delineate queries, because I find it confusing
to use quotes, because quotes are special syntax in Lucene queries.

If you want a phrase, use quotes [ "ho rua con" ]. In the search box you
enter actual quotes.
You can then add slop (total extra words allowed) and even boost after
the quotes.

-Paul

--