use of org.apache.lucene.search.highlight.WeightedSpanTermExtractor in project lucene-solr by apache.
the class HighlightCustomQueryTest method testHighlightKnownQuery.
public void testHighlightKnownQuery() throws IOException {
WeightedSpanTermExtractor extractor = new WeightedSpanTermExtractor() {
@Override
protected void extractUnknownQuery(Query query, Map<String, WeightedSpanTerm> terms) throws IOException {
terms.put("foo", new WeightedSpanTerm(3, "foo"));
}
};
Map<String, WeightedSpanTerm> terms = extractor.getWeightedSpanTerms(new TermQuery(new Term("bar", "quux")), 3, new CannedTokenStream());
// no foo
assertEquals(Collections.singleton("quux"), terms.keySet());
}
Aggregations