org.exist.dom
Class Match

java.lang.Object
  extended by org.exist.dom.Match
All Implemented Interfaces:
Comparable
Direct Known Subclasses:
FTMatch

public abstract class Match
extends Object
implements Comparable

Used to track fulltext matches throughout the query. TextSearchEngine will add a match object to every NodeProxy that triggered a fulltext match for every term matched. The Match object contains the nodeId of the text node that triggered the match, the string value of the matching term and a frequency count, indicating the frequency of the matching term string within the corresponding single text node. All path operations copy existing match objects, i.e. the match objects are copied to the selected descendant or child nodes. This means that every NodeProxy being the direct or indirect result of a fulltext selection will have one or more match objects, indicating which text nodes among its descendant nodes contained a fulltext match.

Author:
wolf

Nested Class Summary
static class Match.Offset
           
 
Method Summary
 void addOffset(int offset, int length)
           
 int compareTo(Object o)
          Used to sort matches.
abstract  Match createInstance(int contextId, NodeId nodeId, String matchTerm)
           
 boolean equals(Object other)
           
 int getContextId()
           
 int getFrequency()
           
abstract  String getIndexId()
           
 String getMatchTerm()
           
 Match getNextMatch()
           
 NodeId getNodeId()
           
 Match.Offset getOffset(int pos)
           
 boolean hasMatchAround(int pos)
          Returns true if the given position is within a match.
 boolean hasMatchAt(int pos)
          Return true if there's a match starting at the given character position.
 Match isAfter(Match other)
           
 boolean matchEquals(Match other)
           
 void mergeOffsets(Match other)
           
abstract  Match newCopy()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getNodeId

public NodeId getNodeId()

getFrequency

public int getFrequency()

getMatchTerm

public String getMatchTerm()

getContextId

public int getContextId()

createInstance

public abstract Match createInstance(int contextId,
                                     NodeId nodeId,
                                     String matchTerm)

newCopy

public abstract Match newCopy()

getIndexId

public abstract String getIndexId()

addOffset

public void addOffset(int offset,
                      int length)

getOffset

public Match.Offset getOffset(int pos)

isAfter

public Match isAfter(Match other)

hasMatchAt

public boolean hasMatchAt(int pos)
Return true if there's a match starting at the given character position.

Parameters:
pos - the position
Returns:
true if a match starts at the given position

hasMatchAround

public boolean hasMatchAround(int pos)
Returns true if the given position is within a match.

Parameters:
pos - the position
Returns:
true if the given position is within a match

mergeOffsets

public void mergeOffsets(Match other)

getNextMatch

public Match getNextMatch()

equals

public boolean equals(Object other)
Overrides:
equals in class Object

matchEquals

public boolean matchEquals(Match other)

compareTo

public int compareTo(Object o)
Used to sort matches. Terms are compared by their string length to have the longest string first.

Specified by:
compareTo in interface Comparable
See Also:
Comparable.compareTo(java.lang.Object)

toString

public String toString()
Overrides:
toString in class Object


Copyright (C) Wolfgang Meier. All rights reserved.