Record Class UHComponents

java.lang.Object
java.lang.Record
org.apache.lucene.search.uhighlight.UHComponents
Record Components:
terms - Query: all terms we extracted (some may be position sensitive)
phraseHelper - Query: position-sensitive information
automata - Query: wildcards (i.e. multi-term query), not position sensitive
hasUnrecognizedQueryPart - Query: if part of the query (other than the extracted terms / automata) is a leaf we don't know

public record UHComponents(String field, Predicate<String> fieldMatcher, Query query, BytesRef[] terms, PhraseHelper phraseHelper, LabelledCharArrayMatcher[] automata, boolean hasUnrecognizedQueryPart, Set<UnifiedHighlighter.HighlightFlag> highlightFlags) extends Record
A parameter object to hold the components a FieldOffsetStrategy needs.
  • Field Details

    • field

      private final String field
      The field for the field record component.
    • fieldMatcher

      private final Predicate<String> fieldMatcher
      The field for the fieldMatcher record component.
    • query

      private final Query query
      The field for the query record component.
    • terms

      private final BytesRef[] terms
      The field for the terms record component.
    • phraseHelper

      private final PhraseHelper phraseHelper
      The field for the phraseHelper record component.
    • automata

      private final LabelledCharArrayMatcher[] automata
      The field for the automata record component.
    • hasUnrecognizedQueryPart

      private final boolean hasUnrecognizedQueryPart
      The field for the hasUnrecognizedQueryPart record component.
    • highlightFlags

      private final Set<UnifiedHighlighter.HighlightFlag> highlightFlags
      The field for the highlightFlags record component.
  • Constructor Details

    • UHComponents

      public UHComponents(String field, Predicate<String> fieldMatcher, Query query, BytesRef[] terms, PhraseHelper phraseHelper, LabelledCharArrayMatcher[] automata, boolean hasUnrecognizedQueryPart, Set<UnifiedHighlighter.HighlightFlag> highlightFlags)
      Creates an instance of a UHComponents record class.
      Parameters:
      field - the value for the field record component
      fieldMatcher - the value for the fieldMatcher record component
      query - the value for the query record component
      terms - the value for the terms record component
      phraseHelper - the value for the phraseHelper record component
      automata - the value for the automata record component
      hasUnrecognizedQueryPart - the value for the hasUnrecognizedQueryPart record component
      highlightFlags - the value for the highlightFlags record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • field

      public String field()
      Returns the value of the field record component.
      Returns:
      the value of the field record component
    • fieldMatcher

      public Predicate<String> fieldMatcher()
      Returns the value of the fieldMatcher record component.
      Returns:
      the value of the fieldMatcher record component
    • query

      public Query query()
      Returns the value of the query record component.
      Returns:
      the value of the query record component
    • terms

      public BytesRef[] terms()
      Returns the value of the terms record component.
      Returns:
      the value of the terms record component
    • phraseHelper

      public PhraseHelper phraseHelper()
      Returns the value of the phraseHelper record component.
      Returns:
      the value of the phraseHelper record component
    • automata

      public LabelledCharArrayMatcher[] automata()
      Returns the value of the automata record component.
      Returns:
      the value of the automata record component
    • hasUnrecognizedQueryPart

      public boolean hasUnrecognizedQueryPart()
      Returns the value of the hasUnrecognizedQueryPart record component.
      Returns:
      the value of the hasUnrecognizedQueryPart record component
    • highlightFlags

      public Set<UnifiedHighlighter.HighlightFlag> highlightFlags()
      Returns the value of the highlightFlags record component.
      Returns:
      the value of the highlightFlags record component