Problem with highlighting using QueryStringQueryBuilder


(Weiwei Wang) #1

e.g.
Documents with two fields: prefix and name

  1. name is analyzed using whitespace tokenizer and n-gram
    filter(min=1,max=20)
  2. I also extract the first character from name and indexed it without
    analyzer

After setting up the index, i use TransportClient to do the search
request on useing QueryStringQueryBuilder on fields: name(no prefix)

and highlight fields are only: name

suppose i have a document:{"name":"null", "prefix":"n"}

when i search with: n, the result is ok and aslo correctly highlighted
however when I search with: prefix:n, it still highlight "n" which is
not what i want.

Does anyone here know why and how to fix it?


(system) #2