Package org.apache.lucene.search.highlight

Examples of org.apache.lucene.search.highlight.WeightedSpanTerm


  public Summary getSummary(String text, Query query) {

    String[] terms = query.getTerms();
    WeightedSpanTerm[] weighted = new WeightedSpanTerm[terms.length];
    for (int i=0; i<terms.length; i++) {
      weighted[i] = new WeightedSpanTerm(1.0f, terms[i]);
    }
    Highlighter highlighter = new Highlighter(FORMATTER, new QueryScorer(weighted));
    TokenStream tokens = analyzer.tokenStream("content", new StringReader(text));
    Summary summary = new Summary();
    try {
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.highlight.WeightedSpanTerm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.