Class ToParentBlockJoinSortField

java.lang.Object
org.apache.lucene.search.SortField
org.apache.lucene.search.join.ToParentBlockJoinSortField

public class ToParentBlockJoinSortField extends SortField
A special sort field that allows sorting parent docs based on nested / child level fields. Based on the sort order it either takes the document with the lowest or highest field value into account.
  • Field Details

    • order

      private final boolean order
    • parentFilter

      private final BitSetProducer parentFilter
    • childFilter

      private final BitSetProducer childFilter
  • Constructor Details

    • ToParentBlockJoinSortField

      public ToParentBlockJoinSortField(String field, SortField.Type type, boolean reverse, BitSetProducer parentFilter, BitSetProducer childFilter)
      Create ToParentBlockJoinSortField. The parent document ordering is based on child document ordering (reverse).
      Parameters:
      field - The sort field on the nested / child level.
      type - The sort type on the nested / child level.
      reverse - Whether natural order should be reversed on the nested / child level.
      parentFilter - Filter that identifies the parent documents.
      childFilter - Filter that defines which child documents participates in sorting.
    • ToParentBlockJoinSortField

      public ToParentBlockJoinSortField(String field, SortField.Type type, boolean reverse, boolean order, BitSetProducer parentFilter, BitSetProducer childFilter)
      Create ToParentBlockJoinSortField.
      Parameters:
      field - The sort field on the nested / child level.
      type - The sort type on the nested / child level.
      reverse - Whether natural order should be reversed on the nested / child document level.
      order - Whether natural order should be reversed on the parent level.
      parentFilter - Filter that identifies the parent documents.
      childFilter - Filter that defines which child documents participates in sorting.
  • Method Details

    • getComparator

      public FieldComparator<?> getComparator(int numHits, int sortPos)
      Description copied from class: SortField
      Returns the FieldComparator to use for sorting.
      Overrides:
      getComparator in class SortField
      Parameters:
      numHits - number of top hits the queue will store
      sortPos - position of this SortField within Sort. The comparator is primary if sortPos==0, secondary if sortPos==1, etc. Some comparators can optimize themselves when they are the primary sort.
      Returns:
      FieldComparator to use when sorting
    • getStringComparator

      private FieldComparator<?> getStringComparator(int numHits)
    • getIntComparator

      private FieldComparator<?> getIntComparator(int numHits, int sortPos)
    • getLongComparator

      private FieldComparator<?> getLongComparator(int numHits, int sortPos)
    • getFloatComparator

      private FieldComparator<?> getFloatComparator(int numHits, int sortPos)
    • getDoubleComparator

      private FieldComparator<?> getDoubleComparator(int numHits, int sortPost)
    • hashCode

      public int hashCode()
      Description copied from class: SortField
      Returns a hash code for this SortField instance. If a FieldComparatorSource was provided, it must properly implement hashCode (unless a singleton is always used).
      Overrides:
      hashCode in class SortField
    • equals

      public boolean equals(Object obj)
      Description copied from class: SortField
      Returns true if o is equal to this. If a FieldComparatorSource was provided, it must properly implement equals (unless a singleton is always used). canUsePoints field is not part of equals and hasCode intentionally, as it is only useful during search-time and using it in these functions prevents index sorting optimizations that rely on the equality of the index-time and search-time SortField instances.
      Overrides:
      equals in class SortField