SearchQuery Class
Represents a search query in object form.
Inheritance Hierarchy
SystemObject
  GroupDocs.SearchSearchQuery

Namespace: GroupDocs.Search
Assembly: GroupDocs.Search (in GroupDocs.Search.dll) Version: 22.11
Syntax
public abstract class SearchQuery

The SearchQuery type exposes the following members.

Properties
  NameDescription
Public propertyChildCount
Gets the number of child queries.
Public propertyFieldName
Gets the field name.
Public propertyFirstChild
Gets the first child query.
Public propertySearchOptions
Gets or sets the search options of this seach query.
Public propertySecondChild
Gets the second child query.
Methods
  NameDescription
Public methodStatic memberCreateAndQuery
Creates a combined query that will find only documents which will be found for each original query.
Public methodStatic memberCreateDateRangeQuery
Creates a date range query.
Public methodStatic memberCreateFieldQuery
Adds a field to the specified query.
Public methodStatic memberCreateNotQuery
Creates an inverted query that will find the rest documents in an index against ones which will be found for the original query.
Public methodStatic memberCreateNumericRangeQuery
Creates a numeric range query.
Public methodStatic memberCreateOrQuery
Creates a combined query that will find all the documents which will be found at least for one of the original queries.
Public methodStatic memberCreatePhraseSearchQuery
Creates a phrase search query.
Public methodStatic memberCreateRegexQuery(String)
Creates a regular expression query.
Public methodStatic memberCreateRegexQuery(String, RegexOptions)
Creates a regular expression query.
Public methodStatic memberCreateWildcardQuery(Int32)
Creates a wildcard for the phrase search.
Public methodStatic memberCreateWildcardQuery(Int32, Int32)
Creates a wildcard for the phrase search.
Public methodStatic memberCreateWordPatternQuery
Creates a word pattern query.
Public methodStatic memberCreateWordQuery
Creates a simple word query.
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetChild
Gets a child query by an index.
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString
Returns a String that represents the current SearchQuery instance.
(Overrides ObjectToString.)
Remarks
Examples
The example demonstrates a typical usage of the class.
C#
string indexFolder = @"c:\MyIndex\";
string documentsFolder = @"c:\MyDocuments\";

Index index = new Index(indexFolder); // Creating index in the specified folder
index.Add(documentsFolder); // Indexing documents from the specified folder

// Creating subquery of date range search
SearchQuery subquery1 = SearchQuery.CreateDateRangeQuery(new DateTime(2011, 6, 17), new DateTime(2013, 1, 1));

// Creating subquery of wildcard with number of missed words from 0 to 2
SearchQuery subquery2 = SearchQuery.CreateWildcardQuery(0, 2);

// Creating subquery of simple word
SearchQuery subquery3 = SearchQuery.CreateWordQuery("birth");
subquery3.SearchOptions = new SearchOptions(); // Setting search options only for subquery 3
subquery3.SearchOptions.FuzzySearch.Enabled = true;
subquery3.SearchOptions.FuzzySearch.FuzzyAlgorithm = new TableDiscreteFunction(1);

// Combining subqueries into one query
SearchQuery query = SearchQuery.CreatePhraseSearchQuery(subquery1, subquery2, subquery3);

// Creating search options object with increased capacity of found occurrences
SearchOptions options = new SearchOptions(); // Overall search options
options.MaxOccurrenceCountPerTerm = 1000000;
options.MaxTotalOccurrenceCount = 10000000;

SearchResult result = index.Search(query, options); // Searching
See Also