You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Chris Hostetter <ho...@fucit.org> on 2009/09/04 00:54:19 UTC

Re: how to get highlighter to only show matched term

: text. Basically, I just want to know which of the terms in my query 
: matched and in which field they matched (could be different from my 
: example). I assume that I may need to write my own Formatter for just 
: outputting nothing. But, I'm not sure where to start to get only my 
: needed term. Do I need a custom Fragmenter?

I believe so yes ... i think you might be able to get away with a Fragment 
that always returns "true" from isNewFragment, because i *think* the 
highlighter will do the right thing and merge adjacent fragments that 
both contain matches (in the case of phrase queries) but i'm not 100% 
certain.

for questions about implementing Formatters & Fragmenters, you'll probably 
want to ask on java-user@lucene ... there are a lot more people over there 
that udnerstand teh internals of the highlighting code.


-Hoss