Class DrillDownQuery
A Lucene.Net.Search.Query for drill-down over facet categories. You should call Add(string, params string[]) for every group of categories you want to drill-down over.
NOTE: if you choose to create your own Lucene.Net.Search.Query by calling Term(string, string, params string[]), it is recommended to wrap it with Lucene.Net.Search.ConstantScoreQuery and set the boost to0.0f
,
so that it does not affect the scores of the documents.
Collection initializer note: To create and populate a DrillDownQuery
in a single statement, you can use the following example as a guide:
var drillDownQuery = new DrillDownQuery(config)
{
{ "Publish Date", "2019" },
{ "Publish Date", "2020" },
{ "Publish Date", "2021" },
{ "timestamp", NumericRangeQuery.NewInt64Range("timestamp", range.Min, range.Max, range.MinInclusive, range.MaxInclusive) },
{ "filter", GetFilter() }
};
Note
This API is experimental and might change in incompatible ways in the next release.
Inherited Members
Namespace: Lucene.Net.Facet
Assembly: Lucene.Net.Facet.dll
Syntax
public sealed class DrillDownQuery : Query, IEnumerable<BooleanClause>, IEnumerable<KeyValuePair<string, int>>, IEnumerable
Constructors
DrillDownQuery(FacetsConfig)
Creates a new DrillDownQuery without a base query, to perform a pure browsing query (equivalent to using Lucene.Net.Search.MatchAllDocsQuery as base).
Declaration
public DrillDownQuery(FacetsConfig config)
Parameters
Type | Name | Description |
---|---|---|
FacetsConfig | config |
DrillDownQuery(FacetsConfig, Query)
Creates a new DrillDownQuery over the given base query. Can be
null
, in which case the result Lucene.Net.Search.Query from
Rewrite(IndexReader) will be a pure browsing query, filtering on
the added categories only.
Declaration
public DrillDownQuery(FacetsConfig config, Query baseQuery)
Parameters
Type | Name | Description |
---|---|---|
FacetsConfig | config | |
Query | baseQuery |
Methods
Add(string, Filter)
Expert: add a custom drill-down Filter, e.g. when drilling down after range faceting.
Declaration
public void Add(string dim, Filter subFilter)
Parameters
Type | Name | Description |
---|---|---|
string | dim | |
Filter | subFilter |
Add(string, Query)
Expert: add a custom drill-down subQuery. Use this when you have a separate way to drill-down on the dimension than the indexed facet ordinals.
Declaration
public void Add(string dim, Query subQuery)
Parameters
Type | Name | Description |
---|---|---|
string | dim | |
Query | subQuery |
Add(string, params string[])
Adds one dimension of drill downs; if you pass the same dimension more than once it is OR'd with the previous cofnstraints on that dimension, and all dimensions are AND'd against each other and the base query.
Declaration
public void Add(string dim, params string[] path)
Parameters
Type | Name | Description |
---|---|---|
string | dim | |
string[] | path |
Clone()
Returns a clone of this query.
Declaration
public override object Clone()
Returns
Type | Description |
---|---|
object |
Overrides
Equals(object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
bool | true if the specified object is equal to the current object; otherwise, false. |
Overrides
GetEnumerator()
Returns an iterator on the clauses in this query. It implements the IEnumerable{BooleanClause} interface to make it possible to do:
foreach (BooleanClause clause in drillDownQuery) {}
Declaration
public IEnumerator<BooleanClause> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<BooleanClause> |
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the current object. |
Overrides
Rewrite(IndexReader)
Expert: called to re-write queries into primitive queries. For example, a Lucene.Net.Search.PrefixQuery will be rewritten into a Lucene.Net.Search.BooleanQuery that consists of Lucene.Net.Search.TermQuerys.
Declaration
public override Query Rewrite(IndexReader r)
Parameters
Type | Name | Description |
---|---|---|
IndexReader | r |
Returns
Type | Description |
---|---|
Query |
Overrides
Term(string, string, params string[])
Creates a drill-down term.
Declaration
public static Term Term(string field, string dim, params string[] path)
Parameters
Type | Name | Description |
---|---|---|
string | field | |
string | dim | |
string[] | path |
Returns
Type | Description |
---|---|
Term |
ToString(string)
Prints a query to a string, with field
assumed to be the
default field and omitted.
Declaration
public override string ToString(string field)
Parameters
Type | Name | Description |
---|---|---|
string | field |
Returns
Type | Description |
---|---|
string |