Class TopFieldCollector

All Implemented Interfaces:
Collector
Direct Known Subclasses:
TopFieldCollector.PagingFieldCollector, TopFieldCollector.SimpleFieldCollector

public abstract class TopFieldCollector extends TopDocsCollector<FieldValueHitQueue.Entry>
A Collector that sorts by SortField using FieldComparators.

See the constructor of TopFieldCollectorManager for instantiating a TopFieldCollectorManager with support for concurrency in IndexSearcher.

  • Field Details

    • EMPTY_SCOREDOCS

      private static final ScoreDoc[] EMPTY_SCOREDOCS
    • numHits

      final int numHits
    • totalHitsThreshold

      final int totalHitsThreshold
    • firstComparator

      final FieldComparator<?> firstComparator
    • canSetMinScore

      final boolean canSetMinScore
    • searchSortPartOfIndexSort

      Boolean searchSortPartOfIndexSort
    • minScoreAcc

      final MaxScoreAccumulator minScoreAcc
    • minCompetitiveScore

      float minCompetitiveScore
    • numComparators

      final int numComparators
    • bottom

    • queueFull

      boolean queueFull
    • docBase

      int docBase
    • needsScores

      final boolean needsScores
    • scoreMode

      final ScoreMode scoreMode
  • Constructor Details

  • Method Details

    • canEarlyTerminate

      static boolean canEarlyTerminate(Sort searchSort, Sort indexSort)
    • canEarlyTerminateOnDocId

      private static boolean canEarlyTerminateOnDocId(Sort searchSort)
    • canEarlyTerminateOnPrefix

      private static boolean canEarlyTerminateOnPrefix(Sort searchSort, Sort indexSort)
    • scoreMode

      public ScoreMode scoreMode()
      Description copied from interface: Collector
      Indicates what features are required from the scorer.
    • updateGlobalMinCompetitiveScore

      protected void updateGlobalMinCompetitiveScore(Scorable scorer) throws IOException
      Throws:
      IOException
    • updateMinCompetitiveScore

      protected void updateMinCompetitiveScore(Scorable scorer) throws IOException
      Throws:
      IOException
    • populateScores

      public static void populateScores(ScoreDoc[] topDocs, IndexSearcher searcher, Query query) throws IOException
      Populate scores of the given topDocs.
      Parameters:
      topDocs - the top docs to populate
      searcher - the index searcher that has been used to compute topDocs
      query - the query that has been used to compute topDocs
      Throws:
      IllegalArgumentException - if there is evidence that topDocs have been computed against a different searcher or a different query.
      IOException
    • add

      final void add(int slot, int doc)
    • updateBottom

      final void updateBottom(int doc)
    • populateResults

      protected void populateResults(ScoreDoc[] results, int howMany)
      Description copied from class: TopDocsCollector
      Populates the results array with the ScoreDoc instances. This can be overridden in case a different ScoreDoc type should be returned.
      Overrides:
      populateResults in class TopDocsCollector<FieldValueHitQueue.Entry>
    • newTopDocs

      protected TopDocs newTopDocs(ScoreDoc[] results, int start)
      Description copied from class: TopDocsCollector
      Returns a TopDocs instance containing the given results. If results is null it means there are no results to return, either because there were 0 calls to collect() or because the arguments to topDocs were invalid.
      Overrides:
      newTopDocs in class TopDocsCollector<FieldValueHitQueue.Entry>
    • topDocs

      public TopFieldDocs topDocs()
      Description copied from class: TopDocsCollector
      Returns the top docs that were collected by this collector.
      Overrides:
      topDocs in class TopDocsCollector<FieldValueHitQueue.Entry>
    • isEarlyTerminated

      public boolean isEarlyTerminated()
      Return whether collection terminated early.