Class PhraseTerm

    • Field Detail

      • startOffset

        protected int startOffset
      • endOffset

        protected int endOffset
      • annotations

        protected long annotations
        Arbitrary token annotations.
    • Constructor Detail

      • PhraseTerm

        protected PhraseTerm()
        Constructor.
      • PhraseTerm

        protected PhraseTerm​(TokenAnnotation annotation)
        Constructor.
      • PhraseTerm

        protected PhraseTerm​(TokenAnnotation... annotation)
        Constructor.
      • PhraseTerm

        protected PhraseTerm​(PhraseTerm base)
        Constructor.
    • Method Detail

      • setParameter

        public void setParameter​(java.lang.String name,
                                 java.lang.Object value)
        Description copied from class: Phrase
        Set parameter name to value.

        NOTE: name is case insensitive.

        Overrides:
        setParameter in class Phrase
      • getStartOffset

        public int getStartOffset()
        Get the start offset (0 indexed, inclusive) for this term in the original query string.

        This value is set during parsing and indicates the start offset into the original query string that this term represents. In general, offsets should not be set/modified by query transformers and it is recommended that start and end offsets are set to zero when cloning.

        NOTE: if Phrase.getStartOffset() == Phrase.getEndOffset(), this indicates that the term did not come from a parsed query string.

        Specified by:
        getStartOffset in class Phrase
      • setStartOffset

        public void setStartOffset​(int value)
        Set the start offset (0 indexed, inclusive) for this term in the original query string.
      • getEndOffset

        public int getEndOffset()
        Get the end offset (0 indexed, exclusive) for this term in the original query string.

        This value is set during parsing and indicates the end offset of the original query string that this term represents. In general, offsets should not be set/modified by query transformers and it is recommended that start and end offsets are set to zero when cloning.

        NOTE: if Phrase.getStartOffset() == Phrase.getEndOffset(), this indicates that the term did not come from a parsed query string.

        Specified by:
        getEndOffset in class Phrase
      • setEndOffset

        public void setEndOffset​(int value)
        Set the end offset (0 indexed, exclusive) for this term in the original query string.
      • setAnnotations

        public void setAnnotations​(long value)
        Set the token annotations from a bit mask.
        Specified by:
        setAnnotations in interface TokenAnnotationSet
      • offsetGap

        public int offsetGap​(PhraseTerm previous)
        Get the offset gap between previous and this term.

        NOTE: if this term or the previous term do not contain offsets, 1 is returned.

        NOTE: Returns 0 if previous is null.

      • containsParameters

        public boolean containsParameters​(boolean compact)
        Does this phrase operand contain any parameters in a non-default state.

        If compact is true this will only return true if at least one parameter in the compact representation of this phrase exists.

        Overrides:
        containsParameters in class Phrase
      • rewriteChildren

        public Phrase rewriteChildren​(PhraseHandler handler)
        Description copied from class: Phrase
        Rewrite any children of this phrase using handler.

        Returns the modified phrase, which may be null if all children were removed by handler.

        This method may have no effect if this Phrase represents a leaf in the tree.

        NOTE: child phrases are not recursively traversed.

        Specified by:
        rewriteChildren in class Phrase
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Phrase
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class Phrase