Java Code Examples for org.apache.lucene.search.ScoreMode#COMPLETE

The following examples show how to use org.apache.lucene.search.ScoreMode#COMPLETE . 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: ScoringMatch.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
public static final MatcherFactory<ScoringMatch> matchWithSimilarity(Similarity similarity) {
  return searcher -> {
    searcher.setSimilarity(similarity);
    return new CollectingMatcher<ScoringMatch>(searcher, ScoreMode.COMPLETE) {
      @Override
      protected ScoringMatch doMatch(String queryId, int doc, Scorable scorer) throws IOException {
        float score = scorer.score();
        if (score > 0)
          return new ScoringMatch(queryId, score);
        return null;
      }

      @Override
      public ScoringMatch resolve(ScoringMatch match1, ScoringMatch match2) {
        return new ScoringMatch(match1.getQueryId(), match1.getScore() + match2.getScore());
      }
    };
  };
}
 
Example 2
Source File: LuceneBatchIterator.java    From crate with Apache License 2.0 5 votes vote down vote up
private Weight createWeight() throws IOException {
    for (LuceneCollectorExpression<?> expression : expressions) {
        expression.startCollect(collectorContext);
    }
    ScoreMode scoreMode = doScores ? ScoreMode.COMPLETE : ScoreMode.COMPLETE_NO_SCORES;
    return indexSearcher.createWeight(indexSearcher.rewrite(query), scoreMode, 1f);
}
 
Example 3
Source File: GeoPointClusteringAggregator.java    From elasticsearch-aggregation-geoclustering with Apache License 2.0 5 votes vote down vote up
@Override
public ScoreMode scoreMode() {
    if (valuesSource != null && valuesSource.needsScores()) {
        return ScoreMode.COMPLETE;
    }
    return super.scoreMode();
}
 
Example 4
Source File: ExpandComponent.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Override
default ScoreMode scoreMode() {
  final LongObjectMap<Collector> groups = getGroups();
  if (groups.isEmpty()) {
    return ScoreMode.COMPLETE; // doesn't matter?
  } else {
    return groups.iterator().next().value.scoreMode(); // we assume all the collectors should have the same nature
  }
}
 
Example 5
Source File: FunctionScoreQuery.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Override
public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException {
  ScoreMode sm;
  if (scoreMode.needsScores() && source.needsScores()) {
    sm = ScoreMode.COMPLETE;
  } else {
    sm = ScoreMode.COMPLETE_NO_SCORES;
  }
  Weight inner = in.createWeight(searcher, sm, 1f);
  if (scoreMode.needsScores() == false)
    return inner;
  return new FunctionScoreWeight(this, inner, source.rewrite(searcher), boost);
}
 
Example 6
Source File: BooleanQueryTst.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public ScoreMode scoreMode() {
  return ScoreMode.COMPLETE;
}
 
Example 7
Source File: RankQueryTestPlugin.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public ScoreMode scoreMode() {
  return ScoreMode.COMPLETE;
}
 
Example 8
Source File: RankQueryTestPlugin.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public ScoreMode scoreMode() {
  return ScoreMode.COMPLETE;
}
 
Example 9
Source File: Monitor.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public ScoreMode scoreMode() {
  return ScoreMode.COMPLETE;
}
 
Example 10
Source File: FacetsCollector.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public ScoreMode scoreMode() {
  return ScoreMode.COMPLETE;
}
 
Example 11
Source File: TopSuggestDocsCollector.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
/**
 * Ignored
 */
@Override
public ScoreMode scoreMode() {
  return ScoreMode.COMPLETE;
}
 
Example 12
Source File: TopGroupsCollector.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public ScoreMode scoreMode() {
  return ScoreMode.COMPLETE;
}
 
Example 13
Source File: SecondPassGroupingCollector.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public ScoreMode scoreMode() {
  return groupReducer.needsScores() ? ScoreMode.COMPLETE : ScoreMode.COMPLETE_NO_SCORES;
}
 
Example 14
Source File: FirstPassGroupingCollector.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public ScoreMode scoreMode() {
  return needsScores ? ScoreMode.COMPLETE : ScoreMode.COMPLETE_NO_SCORES;
}
 
Example 15
Source File: BlockGroupingCollector.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public ScoreMode scoreMode() {
  return needsScores ? ScoreMode.COMPLETE : ScoreMode.COMPLETE_NO_SCORES;
}
 
Example 16
Source File: AllGroupHeadsCollector.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public ScoreMode scoreMode() {
  return sort.needsScores() ? ScoreMode.COMPLETE : ScoreMode.COMPLETE_NO_SCORES;
}
 
Example 17
Source File: CollapsingQParserPlugin.java    From lucene-solr with Apache License 2.0 votes vote down vote up
@Override public ScoreMode scoreMode() { return ScoreMode.COMPLETE; } 
Example 18
Source File: CollapsingQParserPlugin.java    From lucene-solr with Apache License 2.0 votes vote down vote up
@Override public ScoreMode scoreMode() { return ScoreMode.COMPLETE; } 
Example 19
Source File: CollapsingQParserPlugin.java    From lucene-solr with Apache License 2.0 votes vote down vote up
@Override public ScoreMode scoreMode() { return needsScores ? ScoreMode.COMPLETE : super.scoreMode(); } 
Example 20
Source File: CollapsingQParserPlugin.java    From lucene-solr with Apache License 2.0 votes vote down vote up
@Override public ScoreMode scoreMode() { return needsScores ? ScoreMode.COMPLETE : super.scoreMode(); }