Hi all, I was able to get a whole sentence(including stop words) highlighted with "StandardAnalyzer" and an empty stop words String[].
The current issue I'm having is that not only the whole sentence got highlighted but those tokens partially match with the sentence also highlighted. I tried to use "PhraseQuery" with the appropriate slop to make only the intended sentence highlighted, but ended up with exception like below. My question is - is this a valid direction to go? Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/lucene/index/memory/MemoryIndex at org.apache.lucene.search.highlight.WeightedSpanTermExtractor.getReaderForField(WeightedSpanTermExtractor.java:361) at org.apache.lucene.search.highlight.WeightedSpanTermExtractor.extractWeightedSpanTerms(WeightedSpanTermExtractor.java:282) at org.apache.lucene.search.highlight.WeightedSpanTermExtractor.extract(WeightedSpanTermExtractor.java:149) at org.apache.lucene.search.highlight.WeightedSpanTermExtractor.getWeightedSpanTerms(WeightedSpanTermExtractor.java:414) at org.apache.lucene.search.highlight.QueryScorer.initExtractor(QueryScorer.java:216) at org.apache.lucene.search.highlight.QueryScorer.init(QueryScorer.java:184) at org.apache.lucene.search.highlight.Highlighter.getBestTextFragments(Highlighter.java:226) at org.apache.lucene.search.highlight.Highlighter.getBestFragments(Highlighter.java:184) at org.apache.lucene.search.highlight.Highlighter.getBestFragments(Highlighter.java:488) at Hightlight.main(Hightlight.java:161) Thanks,