Class PhraseMatcher

java.lang.Object
org.apache.lucene.search.PhraseMatcher
Direct Known Subclasses:
ExactPhraseMatcher, SloppyPhraseMatcher

public abstract class PhraseMatcher extends Object
Base class for exact and sloppy phrase matching

To find matches on a document, first advance approximation() to the relevant document, then call reset(). Clients can then call nextMatch() to iterate over the matches

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final float
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    PhraseMatcher(float matchCost)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) abstract DocIdSetIterator
    Approximation that only matches documents that have all terms.
    (package private) abstract int
    The end offset of the current match
    (package private) abstract int
    The end position of the current match
    float
    An estimate of the average cost of finding all matches on a document
    (package private) abstract ImpactsDISI
    Approximation that is aware of impacts.
    (package private) abstract float
    An upper bound on the number of possible matches on this document
    abstract boolean
    Find the next match on the current document, returning false if there are none.
    abstract void
    Called after approximation() has been advanced
    (package private) abstract float
    The slop-adjusted weight of the current match
    (package private) abstract int
    The start offset of the current match
    (package private) abstract int
    The start position of the current match

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • matchCost

      private final float matchCost
  • Constructor Details

    • PhraseMatcher

      PhraseMatcher(float matchCost)
  • Method Details

    • approximation

      abstract DocIdSetIterator approximation()
      Approximation that only matches documents that have all terms.
    • impactsApproximation

      abstract ImpactsDISI impactsApproximation()
      Approximation that is aware of impacts.
    • maxFreq

      abstract float maxFreq() throws IOException
      An upper bound on the number of possible matches on this document
      Throws:
      IOException
    • reset

      public abstract void reset() throws IOException
      Called after approximation() has been advanced
      Throws:
      IOException
    • nextMatch

      public abstract boolean nextMatch() throws IOException
      Find the next match on the current document, returning false if there are none.
      Throws:
      IOException
    • sloppyWeight

      abstract float sloppyWeight()
      The slop-adjusted weight of the current match

      The sum of the slop-adjusted weights is used as the freq for scoring

    • startPosition

      abstract int startPosition()
      The start position of the current match
    • endPosition

      abstract int endPosition()
      The end position of the current match
    • startOffset

      abstract int startOffset() throws IOException
      The start offset of the current match
      Throws:
      IOException
    • endOffset

      abstract int endOffset() throws IOException
      The end offset of the current match
      Throws:
      IOException
    • getMatchCost

      public float getMatchCost()
      An estimate of the average cost of finding all matches on a document
      See Also: