- java.lang.Object
-
- org.apache.lucene.search.NamedMatches
-
- All Implemented Interfaces:
java.lang.Iterable<java.lang.String>
,Matches
public class NamedMatches extends java.lang.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)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
NamedMatches.NamedQuery
-
Constructor Summary
Constructors Constructor Description NamedMatches(java.lang.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 java.util.List<NamedMatches>
findNamedMatches(Matches matches)
Finds allNamedMatches
in aMatches
treeMatchesIterator
getMatches(java.lang.String field)
Returns aMatchesIterator
over the matches for a single field, ornull
if there are no matches in that field.java.lang.String
getName()
Returns the name of thisMatches
java.util.Collection<Matches>
getSubMatches()
Returns a collection of Matches that make up this instance; if it is not a composite, then this returns an empty listjava.util.Iterator<java.lang.String>
iterator()
static Query
wrapQuery(java.lang.String name, Query in)
Wrap a Query so that it associates a name with itsMatches
-
-
-
Field Detail
-
in
private final Matches in
-
name
private final java.lang.String name
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns the name of thisMatches
-
getMatches
public MatchesIterator getMatches(java.lang.String field) throws java.io.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:
java.io.IOException
-
getSubMatches
public java.util.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
-
iterator
public java.util.Iterator<java.lang.String> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<java.lang.String>
-
wrapQuery
public static Query wrapQuery(java.lang.String name, Query in)
Wrap a Query so that it associates a name with itsMatches
-
findNamedMatches
public static java.util.List<NamedMatches> findNamedMatches(Matches matches)
Finds allNamedMatches
in aMatches
tree
-
-