Boosting exact matches in edgengram search


(Chad Kouse) #1

If I search for "liz" I need an exact match of "liz" to score higher than
"lizz"

Can I do this all in one query or do I need to run a separate query to look
for an exact match?

--chad

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Clinton Gormley) #2

I would expect it to do this automatically, because "liz" has fewer tokens
than "lizz". However, to ensure that it works the way you want, you can
index the field as a multi-field, using (eg) the standard analyzer on the
main field, and your edge-ngrams on another field.

The use a bool query which matches against both fields - you'll find docs
that match the ngrams, but docs with exact matches will be boosted by the
clause on the main field.

clint

On 21 May 2013 19:39, Chad Kouse chad.kouse@gmail.com wrote:

If I search for "liz" I need an exact match of "liz" to score higher than
"lizz"

Can I do this all in one query or do I need to run a separate query to
look for an exact match?

--chad

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(btiernay) #3

Hi Clint,

We are encountering the same issue. This sounds like a bug. Should we file
a ticket against ES?

Thanks,

Bob

On Thursday, 23 May 2013 06:03:52 UTC-4, Clinton Gormley wrote:

I would expect it to do this automatically, because "liz" has fewer tokens
than "lizz". However, to ensure that it works the way you want, you can
index the field as a multi-field, using (eg) the standard analyzer on the
main field, and your edge-ngrams on another field.

The use a bool query which matches against both fields - you'll find docs
that match the ngrams, but docs with exact matches will be boosted by the
clause on the main field.

clint

On 21 May 2013 19:39, Chad Kouse <chad....@gmail.com <javascript:>> wrote:

If I search for "liz" I need an exact match of "liz" to score higher than
"lizz"

Can I do this all in one query or do I need to run a separate query to
look for an exact match?

--chad

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(cgendreau) #4

I was also expecting this to work without using multi-field. Am I missing something?


(Susan Liu) #5

It's 2017, and I'm still have the same problem? Did anyone figure this out without using multi-field? Or is that the only way? I'd really love to know! Thanks in advance!


(system) #6