Click or drag to resize

IUserSessionLuceneQueryAllT, TIndex Method


Queries the content store using Lucene query syntax, returning a collection of objects of the given type.

The CSAPI creates indexes in the content store to expedite object lookup. The CSAPI comes with a set of indexes for its basic functionality. All strong-typed queries go through this method. Additional custom indexes can be created to provide further flexibility on fast lookup. Please refer to the Indexing topic for more information on indexes and custom indexes.

Namespace:  Ingeniux.CMS
Assembly:  Ingeniux.CMS.CSAPI (in Ingeniux.CMS.CSAPI.dll) Version: 10.6.308
Syntax
IEnumerable<T> LuceneQueryAll<T, TIndex>(
	string luceneQueryExpression,
	Action<int> stepFunc = null
)
where TIndex : new(), AbstractIndexCreationTask

Parameters

luceneQueryExpression
Type: SystemString

[Missing <param name="luceneQueryExpression"/> documentation for "M:Ingeniux.CMS.IUserSession.LuceneQueryAll``2(System.String,System.Action{System.Int32})"]

stepFunc (Optional)
Type: SystemActionInt32

[Missing <param name="stepFunc"/> documentation for "M:Ingeniux.CMS.IUserSession.LuceneQueryAll``2(System.String,System.Action{System.Int32})"]

Type Parameters

T
Type of objects to retrieve
TIndex
Type of the index class

Return Value

Type: IEnumerableT
A collection of objects of the given type. Deferred execution.
Remarks

Because the execution of the query is deferred, additional queries can be applied to the result and be executed on content-store side. For the query to be executed on content-store side, additional queries cannot use any of the object's methods, only fields and direct properties. If content store side–execution is not required, you should first convet the result to an array using the "ToArray()" method.

Examples

Lucene query syntax is fairly straightforward. Use the indexable property names and check if they contain the value.

For example, searching by name for a page that starts with the word "test" would look something like this:

C#
var pages = session.LuceneQuery<Page, PagesByHierarchy>(out c, "Name:test*");
See Also