Hello Jiri, > > is there any way how to highlight terms in a document that match a query? > > I know that I can use Highlighter together with QueryScorer but it returns > also invalid highlighits. For example for a query "jakarta apache"~2 it > returns > all "jakarta" and all "apache" words in the document and not only those with > max > distance 2.
I fear this might not be possible out of the box. The Searchers (which do process the complete query semantics through utility classes) only provide Document-level results through their interface, while Highlighter does not process the complete query semantics, but does only Token by Token processing instead. To achieve what you want to do, I think your best options would be to implement an improved Highlighter which understands all the semantics you want to visualize, or to hack up the Scorer interface so they do not only provide the matched documents, but also information on the matched Terms. However, I think either approach could easily introduce quite some complexity. It seems like even today, not all major web search engines go these lengths. Best regards, Isidor ------------------------------------------------------------------------------ _______________________________________________ CLucene-developers mailing list CLucene-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/clucene-developers