org.apache.lucene.search.join

Class ToParentBlockJoinCollector

    • Constructor Detail

      • ToParentBlockJoinCollector

        public ToParentBlockJoinCollector(Sort sort,
                                          int numParentHits,
                                          boolean trackScores,
                                          boolean trackMaxScore)
                                   throws IOException
        Creates a ToParentBlockJoinCollector. The provided sort must not be null. If you pass true trackScores, all ToParentBlockQuery instances must not use ScoreMode.None.
        Throws:
        IOException
    • Method Detail

      • getTopGroups

        public TopGroups<IntegergetTopGroups(ToParentBlockJoinQuery query,
                                               Sort withinGroupSort,
                                               int offset,
                                               int maxDocsPerGroup,
                                               int withinGroupOffset,
                                               boolean fillSortFields)
                                        throws IOException
        Returns the TopGroups for the specified BlockJoinQuery. The groupValue of each GroupDocs will be the parent docID for that group. The number of documents within each group is calculated as minimum of maxDocsPerGroup and number of matched child documents for that group. Returns null if no groups matched.
        Parameters:
        query - Search query
        withinGroupSort - Sort criteria within groups
        offset - Parent docs offset
        maxDocsPerGroup - Upper bound of documents per group number
        withinGroupOffset - Offset within each group of child docs
        fillSortFields - Specifies whether to add sort fields or not
        Returns:
        TopGroups for specified query
        Throws:
        IOException - if there is a low-level I/O error
      • getTopGroupsWithAllChildDocs

        public TopGroups<IntegergetTopGroupsWithAllChildDocs(ToParentBlockJoinQuery query,
                                                               Sort withinGroupSort,
                                                               int offset,
                                                               int withinGroupOffset,
                                                               boolean fillSortFields)
                                                        throws IOException
        Returns the TopGroups for the specified BlockJoinQuery. The groupValue of each GroupDocs will be the parent docID for that group. The number of documents within each group equals to the total number of matched child documents for that group. Returns null if no groups matched.
        Parameters:
        query - Search query
        withinGroupSort - Sort criteria within groups
        offset - Parent docs offset
        withinGroupOffset - Offset within each group of child docs
        fillSortFields - Specifies whether to add sort fields or not
        Returns:
        TopGroups for specified query
        Throws:
        IOException - if there is a low-level I/O error
      • getMaxScore

        public float getMaxScore()
        Returns the highest score across all collected parent hits, as long as trackMaxScores=true was passed on construction. Else, this returns Float.NaN
      • needsScores

        public boolean needsScores()
        Description copied from interface: Collector
        Indicates if document scores are needed by this collector.
        Specified by:
        needsScores in interface Collector
        Returns:
        true if scores are needed.