## Package org.apache.lucene.search.join

This module supports index-time joins while searching, where joined documents are indexed as a single document block using `IndexWriter.addDocuments(java.util.Collection<org.apache.lucene.document.Document>)`.

See:
Description

Class Summary
BlockJoinCollector: Collects parent document hits for a Query containing one more more BlockJoinQuery clauses, sorted by the specified parent Sort.
BlockJoinQuery: This query requires that you index children and parent docs as a single block, using the `IndexWriter.addDocuments(java.util.Collection<org.apache.lucene.document.Document>)` or `IndexWriter.updateDocuments(org.apache.lucene.index.Term, java.util.Collection<org.apache.lucene.document.Document>)` API.

Enum Summary
BlockJoinQuery.ScoreMode

## Package org.apache.lucene.search.join Description

This module supports index-time joins while searching, where joined documents are indexed as a single document block using `IndexWriter.addDocuments(java.util.Collection<org.apache.lucene.document.Document>)`. This is useful for any normalized content (XML documents or database tables). In database terms, all rows for all joined tables matching a single row of the primary table must be indexed as a single document block, with the parent document being last in the group.

When you index in this way, the documents in your index are divided into parent documents (the last document of each block) and child documents (all others). You provide a `Filter` that identifies the parent documents, as Lucene does not currently record any information about doc blocks.

At search time, use `BlockJoinQuery` to remap matches from any child `Query` (ie, a query that matches only child documents) up to the parent document space. The resulting `BlockJoinQuery` can then be used as a clause in any query that matches parent documents.

If you only care about the parent documents matching the query, you can use any collector to collect the parent hits, but if you'd also like to see which child documents match for each parent document, use the `BlockJoinCollector` to collect the hits. Once the search is done, you retrieve a `TopGroups` instance from the `BlockJoinCollector.getTopGroups(org.apache.lucene.search.join.BlockJoinQuery, org.apache.lucene.search.Sort, int, int, int, boolean)` method.

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.