aparo/pyes — Issue #109: Highlighting question
Author: pulse00
Created: 2011-10-10 09:10:47+00:00
State: open

When adding highlighting to a Search, the whole field which has a match is highlighted, instead of the substring of the field which mached the search term:

firstQ = PrefixQuery(UserIndex.first_name, term)
lastQ = PrefixQuery(UserIndex.last_name, term)

q = BoolQuery(should=[firstQ, lastQ])

search = Search(q)
search.add_highlight(UserIndex.first_name)

results = conn.search(search, indices = UserIndex.index_name)

So for the search term `John` a field containing `Johnson` will be highlighted `Johnson` instead of `Johnson`

Is it the Prefixquery that is causing problems in conjunction with highlighting?