Namespace Lucene.Net.Search.Join
Classes
FixedBitSetCachingWrapperFilter
A Lucene.Net.Search.CachingWrapperFilter that caches sets using a Lucene.Net.Util.FixedBitSet, as required for joins.
JoinUtil
Utility for query time joining using TermsQuery and TermsCollector.
Note
This API is experimental and might change in incompatible ways in the next release.
ToChildBlockJoinQuery
Just like ToParentBlockJoinQuery, except this query joins in reverse: you provide a Lucene.Net.Search.Query matching parent documents and it joins down to child documents.
Note
This API is experimental and might change in incompatible ways in the next release.
ToParentBlockJoinCollector
Collects parent document hits for a Lucene.Net.Search.Query containing one more more BlockJoinQuery clauses, sorted by the specified parent Lucene.Net.Search.Sort. Note that this cannot perform arbitrary joins; rather, it requires that all joined documents are indexed as a doc block (using AddDocuments(IEnumerable<IEnumerable<IIndexableField>>, Analyzer) or UpdateDocuments(Term, IEnumerable<IEnumerable<IIndexableField>>, Analyzer). Ie, the join is computed at index time.
The parent Lucene.Net.Search.Sort must only use fields from the parent documents; sorting by field in the child documents is not supported.
You should only use this collector if one or more of the clauses in the query is a ToParentBlockJoinQuery. This collector will find those query clauses and record the matching child documents for the top scoring parent documents.
Multiple joins (star join) and nested joins and a mix of the two are allowed, as long as in all cases the documents corresponding to a single row of each joined parent table were indexed as a doc block.
For the simple star join you can retrieve the Lucene.Net.Search.Grouping.ITopGroups<TGroupValue> instance containing each ToParentBlockJoinQuery's matching child documents for the top parent groups, using GetTopGroups(ToParentBlockJoinQuery, Sort, int, int, int, bool). Ie, a single query, which will contain two or more ToParentBlockJoinQuery's as clauses representing the star join, can then retrieve two or more Lucene.Net.Search.Grouping.ITopGroups<TGroupValue> instances.
For nested joins, the query will run correctly (ie, match the right parent and child documents), however, because Lucene.Net.Search.Grouping.TopGroups<TGroupValue> is currently unable to support nesting (each group is not able to hold another Lucene.Net.Search.Grouping.TopGroups<TGroupValue>), you are only able to retrieve the Lucene.Net.Search.Grouping.TopGroups<TGroupValue> of the first join. The Lucene.Net.Search.Grouping.TopGroups<TGroupValue> of the nested joins will not be correct.
See http://lucene.apache.org/core/4_8_0/join/ for a code sample.
Note
This API is experimental and might change in incompatible ways in the next release.
ToParentBlockJoinFieldComparer
A field comparer that allows parent documents to be sorted by fields from the nested / child documents.
Note
This API is experimental and might change in incompatible ways in the next release.
ToParentBlockJoinFieldComparer.Highest
Concrete implementation of ToParentBlockJoinSortField to sorts the parent docs with the highest values in the child / nested docs first.
ToParentBlockJoinFieldComparer.Lowest
Concrete implementation of ToParentBlockJoinSortField to sorts the parent docs with the lowest values in the child / nested docs first.
ToParentBlockJoinQuery
This query requires that you index children and parent docs as a single block, using the AddDocuments(IEnumerable<IEnumerable<IIndexableField>>, Analyzer) or UpdateDocuments(Term, IEnumerable<IEnumerable<IIndexableField>>, Analyzer) API. In each block, the child documents must appear first, ending with the parent document. At search time you provide a Lucene.Net.Search.Filter identifying the parents, however this Lucene.Net.Search.Filter must provide an Lucene.Net.Util.FixedBitSet per sub-reader.
Once the block index is built, use this query to wrap any sub-query matching only child docs and join matches in that child document space up to the parent document space. You can then use this Lucene.Net.Search.Query as a clause with other queries in the parent document space.
See ToChildBlockJoinQuery if you need to join in the reverse order.
The child documents must be orthogonal to the parent documents: the wrapped child query must never return a parent document.
If you'd like to retrieve Lucene.Net.Search.Grouping.ITopGroups<TGroupValue> for the resulting query, use the ToParentBlockJoinCollector. Note that this is not necessary, ie, if you simply want to collect the parent documents and don't need to see which child documents matched under that parent, then you can use any collector.
NOTE: If the overall query contains parent-only matches, for example you OR a parent-only query with a joined child-only query, then the resulting collected documents will be correct, however the Lucene.Net.Search.Grouping.ITopGroups<TGroupValue> you get from ToParentBlockJoinCollector will not contain every child for parents that had matched.
See http://lucene.apache.org/core/4_8_0/join/ for an overview.
Note
This API is experimental and might change in incompatible ways in the next release.
ToParentBlockJoinSortField
A special sort field that allows sorting parent docs based on nested / child level fields. Based on the sort order it either takes the document with the lowest or highest field value into account.
Note
This API is experimental and might change in incompatible ways in the next release.
Enums
ScoreMode
How to aggregate multiple child hit scores into a single parent score.