use of org.exist.dom.persistent.Match in project exist by eXist-db.
the class NodeProxies method filterMatches.
/**
* Filters the full-text matches on the supplied node, leaving only those for which the predicate is true.
*
* @param node
* the node whose full-text matches are to be filtered
* @param predicate
* the predicate based on which the full-text matches are filtered: If the predicate returns true the
* match stays, if not the match is removed.
*/
public static void filterMatches(final NodeProxy node, final Predicate<Match> predicate) {
Match m = node.getMatches();
node.setMatches(null);
while (m != null) {
if (predicate.test(m)) {
node.addMatch(m);
}
m = m.getNextMatch();
}
}
use of org.exist.dom.persistent.Match in project exist by eXist-db.
the class LuceneMatchListener method startElement.
@Override
public void startElement(final QName qname, final AttrList attribs) throws SAXException {
Match nextMatch = match;
// the node contents
while (nextMatch != null) {
if (nextMatch.getNodeId().equals(getCurrentNode().getNodeId())) {
scanMatches(new NodeProxy(getCurrentNode()));
break;
}
nextMatch = nextMatch.getNextMatch();
}
super.startElement(qname, attribs);
}
Aggregations