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

The following examples show how to use org.apache.lucene.search.highlight.Scorer. 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 File: DefaultSolrHighlighter.java    From lucene-solr with 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 File: LumongoHighlighter.java    From lumongo with 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;
}