Class 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 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.
Inheritance
Inherited Members
Namespace: Lucene.Net.Join
Assembly: Lucene.Net.Join.dll
Syntax
public class ToParentBlockJoinQuery : Query
Constructors
| Improve this Doc View SourceToParentBlockJoinQuery(Query, Filter, ScoreMode)
Create a ToParentBlockJoinQuery.
Declaration
public ToParentBlockJoinQuery(Query childQuery, Filter parentsFilter, ScoreMode scoreMode)
Parameters
Type | Name | Description |
---|---|---|
Lucene.Net.Search.Query | childQuery | Lucene.Net.Search.Query matching child documents. |
Lucene.Net.Search.Filter | parentsFilter | Lucene.Net.Search.Filter (must produce FixedBitSet per-segment, like FixedBitSetCachingWrapperFilter) identifying the parent documents. |
ScoreMode | scoreMode | How to aggregate multiple child scores into a single parent score. |
Methods
| Improve this Doc View SourceCreateWeight(IndexSearcher)
Declaration
public override Weight CreateWeight(IndexSearcher searcher)
Parameters
Type | Name | Description |
---|---|---|
Lucene.Net.Search.IndexSearcher | searcher |
Returns
Type | Description |
---|---|
Lucene.Net.Search.Weight |
Overrides
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
| Improve this Doc View SourceExtractTerms(ISet<Term>)
Declaration
public override void ExtractTerms(ISet<Term> terms)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.ISet<Term> | terms |
Overrides
| Improve this Doc View SourceGetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
Rewrite(IndexReader)
Declaration
public override Query Rewrite(IndexReader reader)
Parameters
Type | Name | Description |
---|---|---|
Lucene.Net.Index.IndexReader | reader |
Returns
Type | Description |
---|---|
Lucene.Net.Search.Query |
Overrides
ToString(String)
Declaration
public override string ToString(string field)
Parameters
Type | Name | Description |
---|---|---|
System.String | field |
Returns
Type | Description |
---|---|
System.String |