Multi_fields, store, highlights


(Sébastien Lorber) #1

Hello,

I have the following mapping:

Notice that i added most of my Java code which explains how i build my
query, and also an unit test of the result (i hope it will help others)

Is there a simple way to get highlights when using a multi_field?

The pain is:

  • I need to use a boolean/text search on these 3 fields
  • I need to store=yes for all of them or i can't get the highlights from
    searches which match thanks to a field with store=false
  • I need to add highlights for the 3 fields or i only get the highlights
    when it was matched by the field analyzer
  • My highlight map has now 3 fields and i must select/merge the most
    appropriate one (exact match > stemming > ngrams for me)

What is the effect of using store=yes on each subfield? Is the original
field going to be stored 3 times and take useless space???

Isn't there a way to build simpler queries just on the multi_field instead
of including all the subfields in my queries?
And to have highlights merged automatically?
For exemple if we have a match against 2 fields "stemmer" + "ngrams", is
there an option to have something like "i want the biggest/smaller
highlight for a field"
For exemple, on a search "descript":

  • Ngrams (4->8) will match on "descript" and produce "descript" highlight
  • Stemming will match on description stemmed to "descript" and produce
    "description" highlight"

(Sébastien Lorber) #2

I have noticed the plugin analysis combo

It seems nice because we can use many analyzers for a single field, and
thus i guess have to query only 1 field, ask for 1 highlight, and use
store=yes on one field, but bypassing multi_field.
But before using it, can someone tell me if i'm doing something wrong or is
it that complicated to query against a multi_field?

Thanks

On Thursday, July 5, 2012 6:36:48 PM UTC+2, Sébastien Lorber wrote:

Hello,

I have the following mapping:
https://gist.github.com/3053540

Notice that i added most of my Java code which explains how i build my
query, and also an unit test of the result (i hope it will help others)

Is there a simple way to get highlights when using a multi_field?

The pain is:

  • I need to use a boolean/text search on these 3 fields
  • I need to store=yes for all of them or i can't get the highlights
    from searches which match thanks to a field with store=false
  • I need to add highlights for the 3 fields or i only get the
    highlights when it was matched by the field analyzer
  • My highlight map has now 3 fields and i must select/merge the most
    appropriate one (exact match > stemming > ngrams for me)

What is the effect of using store=yes on each subfield? Is the original
field going to be stored 3 times and take useless space???

Isn't there a way to build simpler queries just on the multi_field instead
of including all the subfields in my queries?
And to have highlights merged automatically?
For exemple if we have a match against 2 fields "stemmer" + "ngrams", is
there an option to have something like "i want the biggest/smaller
highlight for a field"
For exemple, on a search "descript":

  • Ngrams (4->8) will match on "descript" and produce "descript" highlight
  • Stemming will match on description stemmed to "descript" and produce
    "description" highlight"

(system) #3