Package org.apache.lucene.search
Class NamedMatches
- java.lang.Object
-
- org.apache.lucene.search.NamedMatches
-
public class NamedMatches extends Object implements Matches
Utility class to help extract the set of sub queries that have matched from a larger query.Individual subqueries may be wrapped using
wrapQuery(String, Query)
, and the matching queries for a particular document can then be pulled from the parent Query'sMatches
object by callingfindNamedMatches(Matches)
-
-
Constructor Summary
Constructors Constructor Description NamedMatches(String name, Matches in)
Wraps aMatches
object and associates a name with it
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static List<NamedMatches>
findNamedMatches(Matches matches)
Finds allNamedMatches
in aMatches
treeMatchesIterator
getMatches(String field)
Returns aMatchesIterator
over the matches for a single field, ornull
if there are no matches in that field.String
getName()
Returns the name of thisMatches
Collection<Matches>
getSubMatches()
Returns a collection of Matches that make up this instance; if it is not a composite, then this returns an empty listIterator<String>
iterator()
static Query
wrapQuery(String name, Query in)
Wrap a Query so that it associates a name with itsMatches
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
getMatches
public MatchesIterator getMatches(String field) throws IOException
Description copied from interface:Matches
Returns aMatchesIterator
over the matches for a single field, ornull
if there are no matches in that field.- Specified by:
getMatches
in interfaceMatches
- Throws:
IOException
-
getSubMatches
public Collection<Matches> getSubMatches()
Description copied from interface:Matches
Returns a collection of Matches that make up this instance; if it is not a composite, then this returns an empty list- Specified by:
getSubMatches
in interfaceMatches
-
wrapQuery
public static Query wrapQuery(String name, Query in)
Wrap a Query so that it associates a name with itsMatches
-
findNamedMatches
public static List<NamedMatches> findNamedMatches(Matches matches)
Finds allNamedMatches
in aMatches
tree
-
-