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

The following examples show how to use org.apache.lucene.search.ScoreMode#COMPLETE_NO_SCORES . 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: 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 2
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 3
Source File: TestOmitTf.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public ScoreMode scoreMode() {
  return ScoreMode.COMPLETE_NO_SCORES;
}
 
Example 4
Source File: RealtimeLuceneDocIdCollector.java    From incubator-pinot with Apache License 2.0 4 votes vote down vote up
@Override
public ScoreMode scoreMode() {
  return ScoreMode.COMPLETE_NO_SCORES;
}
 
Example 5
Source File: LuceneDocIdCollector.java    From incubator-pinot with Apache License 2.0 4 votes vote down vote up
@Override
public ScoreMode scoreMode() {
  return ScoreMode.COMPLETE_NO_SCORES;
}
 
Example 6
Source File: DocSetCollector.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public ScoreMode scoreMode() {
  return ScoreMode.COMPLETE_NO_SCORES;
}
 
Example 7
Source File: ExportQParserPlugin.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public ScoreMode scoreMode() {
  return ScoreMode.COMPLETE_NO_SCORES;
}
 
Example 8
Source File: GraphEdgeCollector.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public ScoreMode scoreMode() {
  return ScoreMode.COMPLETE_NO_SCORES;
}
 
Example 9
Source File: MultiValueTermOrdinalCollector.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
public ScoreMode scoreMode() {
  return ScoreMode.COMPLETE_NO_SCORES;
}
 
Example 10
Source File: TopLevelJoinQuery.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException {
  if (! (searcher instanceof SolrIndexSearcher)) {
    log.debug("Falling back to JoinQueryWeight because searcher [{}] is not the required SolrIndexSearcher", searcher);
    return super.createWeight(searcher, scoreMode, boost);
  }

  final SolrIndexSearcher solrSearcher = (SolrIndexSearcher) searcher;
  final JoinQueryWeight weight = new JoinQueryWeight(solrSearcher, ScoreMode.COMPLETE_NO_SCORES, 1.0f);
  final SolrIndexSearcher fromSearcher = weight.fromSearcher;
  final SolrIndexSearcher toSearcher = weight.toSearcher;

  try {
    final SortedSetDocValues topLevelFromDocValues = validateAndFetchDocValues(fromSearcher, fromField, "from");
    final SortedSetDocValues topLevelToDocValues = validateAndFetchDocValues(toSearcher, toField, "to");
    if (topLevelFromDocValues.getValueCount() == 0 || topLevelToDocValues.getValueCount() == 0) {
      return createNoMatchesWeight(boost);
    }

    final LongBitSet fromOrdBitSet = findFieldOrdinalsMatchingQuery(q, fromField, fromSearcher, topLevelFromDocValues);
    final LongBitSet toOrdBitSet = new LongBitSet(topLevelToDocValues.getValueCount());
    final BitsetBounds toBitsetBounds = convertFromOrdinalsIntoToField(fromOrdBitSet, topLevelFromDocValues, toOrdBitSet, topLevelToDocValues);

    final boolean toMultivalued = toSearcher.getSchema().getFieldOrNull(toField).multiValued();
    return new ConstantScoreWeight(this, boost) {
      public Scorer scorer(LeafReaderContext context) throws IOException {
        if (toBitsetBounds.lower == BitsetBounds.NO_MATCHES) {
          return null;
        }

        final DocIdSetIterator toApproximation = (toMultivalued) ? context.reader().getSortedSetDocValues(toField) :
            context.reader().getSortedDocValues(toField);
        if (toApproximation == null) {
          return null;
        }

        final int docBase = context.docBase;
        return new ConstantScoreScorer(this, this.score(), scoreMode, new TwoPhaseIterator(toApproximation) {
          public boolean matches() throws IOException {
            final boolean hasDoc = topLevelToDocValues.advanceExact(docBase + approximation.docID());
            if (hasDoc) {
              for (long ord = topLevelToDocValues.nextOrd(); ord != -1L; ord = topLevelToDocValues.nextOrd()) {
                if (toOrdBitSet.get(ord)) {
                  return true;
                }
              }
            }
            return false;
          }

          public float matchCost() {
            return 10.0F;
          }
        });

      }

      public boolean isCacheable(LeafReaderContext ctx) {
        return false;
      }
    };
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
Example 11
Source File: AbstractSolrQueryFacet.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public ScoreMode scoreMode() {
  return ScoreMode.COMPLETE_NO_SCORES;
}
 
Example 12
Source File: QueryIndex.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
default ScoreMode scoreMode() {
  return ScoreMode.COMPLETE_NO_SCORES;
}
 
Example 13
Source File: AssertingSubDocsAtOnceCollector.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public ScoreMode scoreMode() {
  return ScoreMode.COMPLETE_NO_SCORES;
}
 
Example 14
Source File: GroupFacetCollector.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public ScoreMode scoreMode() {
  return ScoreMode.COMPLETE_NO_SCORES;
}
 
Example 15
Source File: AllGroupsCollector.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public ScoreMode scoreMode() {
  return ScoreMode.COMPLETE_NO_SCORES; // the result is unaffected by relevancy
}
 
Example 16
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 17
Source File: ReservoirSampler.java    From crate with Apache License 2.0 4 votes vote down vote up
@Override
public ScoreMode scoreMode() {
    return ScoreMode.COMPLETE_NO_SCORES;
}
 
Example 18
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 19
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 20
Source File: DistinctValuesCollector.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public ScoreMode scoreMode() {
  return ScoreMode.COMPLETE_NO_SCORES;
}