Table of Contents

Class LuceneSearchQuery

Namespace
Examine.Lucene.Search
Assembly
Examine.Lucene.dll

This class is used to query against Lucene.Net

public class LuceneSearchQuery : LuceneSearchQueryBase, IQuery, INestedQuery, IQueryExecutor
Inheritance
LuceneSearchQuery
Implements
Inherited Members
Extension Methods

Constructors

LuceneSearchQuery(ISearchContext, string, Analyzer, LuceneSearchOptions, BooleanOperation)

[Obsolete("To be removed in Examine V5")]
public LuceneSearchQuery(ISearchContext searchContext, string category, Analyzer analyzer, LuceneSearchOptions searchOptions, BooleanOperation occurance)

Parameters

searchContext ISearchContext
category string
analyzer Analyzer
searchOptions LuceneSearchOptions
occurance BooleanOperation

LuceneSearchQuery(ISearchContext, string?, Analyzer, LuceneSearchOptions, BooleanOperation, FacetsConfig)

public LuceneSearchQuery(ISearchContext searchContext, string? category, Analyzer analyzer, LuceneSearchOptions searchOptions, BooleanOperation occurance, FacetsConfig facetsConfig)

Parameters

searchContext ISearchContext
category string
analyzer Analyzer
searchOptions LuceneSearchOptions
occurance BooleanOperation
facetsConfig FacetsConfig

Properties

SearchContext

public ISearchContext SearchContext { get; }

Property Value

ISearchContext

Methods

CreateOp()

Creates a new LuceneBooleanOperation

protected override LuceneBooleanOperationBase CreateOp()

Returns

LuceneBooleanOperationBase

DrillDownQuery(Action<IDrillDownQueryDimensions>, Func<INestedQuery, INestedBooleanOperation>?, Action<IDrillSideways>?, BooleanOperation)

Query for drill-down over facet categories. Call dimensions.Add() for each group of categories to drill-down over

public override IOrdering DrillDownQuery(Action<IDrillDownQueryDimensions> dimensions, Func<INestedQuery, INestedBooleanOperation>? baseQuery = null, Action<IDrillSideways>? drillSideways = null, BooleanOperation defaultOp = BooleanOperation.Or)

Parameters

dimensions Action<IDrillDownQueryDimensions>

Facet Dimensions to Drill Down

baseQuery Func<INestedQuery, INestedBooleanOperation>

Base Query to Drill Down on

drillSideways Action<IDrillSideways>

Facet Dimensions to Drill Sideways

defaultOp BooleanOperation

Base Query default Op

Returns

IOrdering

Execute(QueryOptions?)

Executes the query

public ISearchResults Execute(QueryOptions? options = null)

Parameters

options QueryOptions

Returns

ISearchResults

FieldNested<T>(string, T)

Query on a specific field

protected override INestedBooleanOperation FieldNested<T>(string fieldName, T fieldValue) where T : struct

Parameters

fieldName string
fieldValue T

Returns

INestedBooleanOperation

Type Parameters

T

Field<T>(string, T)

Query on the specified field for a struct value which will try to be auto converted with the correct query

public override IBooleanOperation Field<T>(string fieldName, T fieldValue) where T : struct

Parameters

fieldName string
fieldValue T

Returns

IBooleanOperation

Type Parameters

T

ManagedQuery(string, string[]?)

The index will determine the most appropriate way to search given the query and the fields provided

public override IBooleanOperation ManagedQuery(string query, string[]? fields = null)

Parameters

query string
fields string[]

Returns

IBooleanOperation

ManagedQueryNested(string, string[]?)

The index will determine the most appropiate way to query the fields specified

protected override INestedBooleanOperation ManagedQueryNested(string query, string[]? fields = null)

Parameters

query string
fields string[]

Returns

INestedBooleanOperation

OrderBy(params SortableField[])

Sets the order by of the query

public virtual IBooleanOperation OrderBy(params SortableField[] fields)

Parameters

fields SortableField[]

Returns

IBooleanOperation

OrderByDescending(params SortableField[])

Sets the order by of the query in a descending manner

public virtual IBooleanOperation OrderByDescending(params SortableField[] fields)

Parameters

fields SortableField[]

Returns

IBooleanOperation

RangeQueryNested<T>(string[], T?, T?, bool, bool)

Matches items as defined by the IIndexFieldValueType used for the fields specified. If a type is not defined for a field name, or the type does not implement IIndexRangeValueType for the types of min and max, nothing will be added

protected override INestedBooleanOperation RangeQueryNested<T>(string[] fields, T? min, T? max, bool minInclusive = true, bool maxInclusive = true) where T : struct

Parameters

fields string[]
min T?
max T?
minInclusive bool
maxInclusive bool

Returns

INestedBooleanOperation

Type Parameters

T

RangeQuery<T>(string[], T?, T?, bool, bool)

Matches items as defined by the IIndexFieldValueType used for the fields specified. If a type is not defined for a field name, or the type does not implement IIndexRangeValueType for the types of min and max, nothing will be added

public override IBooleanOperation RangeQuery<T>(string[] fields, T? min, T? max, bool minInclusive = true, bool maxInclusive = true) where T : struct

Parameters

fields string[]
min T?
max T?
minInclusive bool
maxInclusive bool

Returns

IBooleanOperation

Type Parameters

T

SelectAllFieldsInternal()

Selects all fields

public IBooleanOperation SelectAllFieldsInternal()

Returns

IBooleanOperation

SetSearchAfter(SearchAfter)

Set the SearchAfter to continue the search from a previous position

public virtual void SetSearchAfter(SearchAfter searchAfter)

Parameters

searchAfter SearchAfter

Search After Options

SpatialOperationQuery(string, ExamineSpatialOperation, Func<IExamineSpatialShapeFactory, IExamineSpatialShape>)

Executes Spatial operation on field and shape as a Query

public override IBooleanOperation SpatialOperationQuery(string field, ExamineSpatialOperation spatialOperation, Func<IExamineSpatialShapeFactory, IExamineSpatialShape> shape)

Parameters

field string

Index field name

spatialOperation ExamineSpatialOperation
shape Func<IExamineSpatialShapeFactory, IExamineSpatialShape>

Shape

Returns

IBooleanOperation

WithFilter(Action<IFilter>)

Apply a filter

public override IQuery WithFilter(Action<IFilter> filter)

Parameters

filter Action<IFilter>

Returns

IQuery