Java Code Examples for org.apache.lucene.search.highlight.Scorer

The following examples show how to use org.apache.lucene.search.highlight.Scorer. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: lucene-solr   Source File: DefaultSolrHighlighter.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Return a {@link org.apache.lucene.search.highlight.Scorer} suitable for this Query and field.
 *
 * @param query     The current query
 * @param fieldName The name of the field
 * @param request   The SolrQueryRequest
 */
protected Scorer getQueryScorer(Query query, String fieldName, SolrQueryRequest request) {
  boolean reqFieldMatch = request.getParams().getFieldBool(fieldName, HighlightParams.FIELD_MATCH, false);
  if (reqFieldMatch) {
    return new QueryTermScorer(query, request.getSearcher().getIndexReader(), fieldName);
  } else {
    return new QueryTermScorer(query);
  }
}
 
Example 2
Source Project: lumongo   Source File: LumongoHighlighter.java    License: Apache License 2.0 4 votes vote down vote up
public LumongoHighlighter(Formatter formatter, Scorer fragmentScorer, Lumongo.HighlightRequest highlightRequest) {
	super(formatter, fragmentScorer);
	this.highlightRequest = highlightRequest;
}