Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlighting question #109

Closed
pulse00 opened this issue Oct 10, 2011 · 1 comment
Closed

Highlighting question #109

pulse00 opened this issue Oct 10, 2011 · 1 comment

Comments

@pulse00
Copy link

pulse00 commented Oct 10, 2011

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 <em>Johnson</em> instead of <em>John</em>son

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

@aparo
Copy link
Owner

aparo commented Oct 10, 2011

yes it'is.

Highlight works at term level. PrefixQuery match "john*" terms and highlights them.

@aparo aparo closed this as completed Oct 10, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants