org.apache.lucene.search.join
Class JoinUtil

java.lang.Object
  extended by org.apache.lucene.search.join.JoinUtil

public final class JoinUtil
extends Object

Utility for query time joining using TermsQuery and TermsCollector.

WARNING: This API is experimental and might change in incompatible ways in the next release.

Method Summary
static Query createJoinQuery(String fromField, String toField, Query fromQuery, IndexSearcher fromSearcher)
          Method for query time joining.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createJoinQuery

public static Query createJoinQuery(String fromField,
                                    String toField,
                                    Query fromQuery,
                                    IndexSearcher fromSearcher)
                             throws IOException
Method for query time joining.

Execute the returned query with a IndexSearcher to retrieve all documents that have the same terms in the to field that match with documents matching the specified fromQuery and have the same terms in the from field. Notice: Can't join documents with a fromField that holds more then one term.

Parameters:
fromField - The from field to join from
toField - The to field to join to
fromQuery - The query to match documents on the from side
fromSearcher - The searcher that executed the specified fromQuery
Returns:
a Query instance that can be used to join documents based on the terms in the from and to field
Throws:
IOException - If I/O related errors occur