C# Class Rubber.DSL.Query.QueryStringQueryBuilder

A query that parses a query string and runs it. There are two modes that this operates. The first, when no field is added (using {@link #field(string)}, will run the query once and non prefixed fields will use the {@link #defaultField(string)} set. The second, when one or more fields are added (using {@link #field(string)}), will run the parsed query against the provided fields, and combine them either using DisMax or a plain boolean query (see {@link #useDisMax(boolean)}).
Inheritance: IQueryBuilder
Datei anzeigen Open project: stephenpope/Rubber

Public Methods

Method Description
AllowLeadingWildcard ( bool allowLeadingWildcard ) : QueryStringQueryBuilder

Should leading wildcards be allowed or not. Defaults to true.

AnalyzeWildcard ( bool analyzeWildcard ) : QueryStringQueryBuilder

Set to true to enable analysis on wildcard and prefix queries.

Analyzer ( string analyzer ) : QueryStringQueryBuilder

The optional analyzer used to analyze the query string. Note, if a field has search analyzer defined for it, then it will be used automatically. Defaults to the smart search analyzer.

AutoGeneratePhraseQueries ( bool autoGeneratePhraseQueries ) : QueryStringQueryBuilder

Set to true if phrase queries will be automatically generated when the analyzer returns more than one term from whitespace delimited text. NOTE: this behavior may not be suitable for all languages. Set to false if phrase queries should only be generated when surrounded by double quotes.

Boost ( float boost ) : QueryStringQueryBuilder

Sets the boost for this query. Documents matching this query will (in addition to the normal weightings) have their score multiplied by the boost provided.

DefaultField ( string defaultField ) : QueryStringQueryBuilder

The default field to run against when no prefix field is specified. Only relevant when not explicitly adding fields the query string will run against.

DefaultOperator ( Operator defaultOperator ) : QueryStringQueryBuilder

Sets the boolean operator of the query parser used to parse the query string. In default mode ({@link FieldQueryBuilder.Operator#OR}) terms without any modifiers are considered optional: for example capital of Hungary is equal to capital OR of OR Hungary. In {@link FieldQueryBuilder.Operator#AND} mode terms are considered to be in conjunction: the above mentioned query is parsed as capital AND of AND Hungary

EnablePositionIncrements ( bool enablePositionIncrements ) : QueryStringQueryBuilder

Set to true to enable position increments in result query. Defaults to true. When set, result phrase and multi-phrase queries will be aware of position increments. Useful when e.g. a StopFilter increases the position increment of the token that follows an omitted token.

Field ( string field ) : QueryStringQueryBuilder

Adds a field to run the query string against.

Field ( string field, float boost ) : QueryStringQueryBuilder

Adds a field to run the query string against with a specific boost.

FuzzyMinSim ( float fuzzyMinSim ) : QueryStringQueryBuilder

Set the minimum similarity for fuzzy queries. Default is 0.5f.

FuzzyPrefixLength ( int fuzzyPrefixLength ) : QueryStringQueryBuilder

Set the minimum similarity for fuzzy queries. Default is 0.5f.

LowercaseExpandedTerms ( bool lowercaseExpandedTerms ) : QueryStringQueryBuilder

Whether terms of wildcard, prefix, fuzzy and range queries are to be automatically lower-cased or not. Default is true.

MinimumShouldMatch ( string minimumShouldMatch ) : QueryStringQueryBuilder
PhraseSlop ( int phraseSlop ) : QueryStringQueryBuilder

Sets the default slop for phrases. If zero, then exact phrase matches are required. Default value is zero.

QueryStringQueryBuilder ( string querystring ) : System
Rewrite ( string rewrite ) : QueryStringQueryBuilder
TieBreaker ( float tieBreaker ) : QueryStringQueryBuilder

When more than one field is used with the query string, and combined queries are using dis max, control the tie breaker for it.

ToJsonObject ( ) : object
ToString ( ) : string
UseDisMax ( bool useDisMax ) : QueryStringQueryBuilder

When more than one field is used with the query string, should queries be combined using dis max, or boolean query. Defaults to dis max (true).

Method Details

AllowLeadingWildcard() public method

Should leading wildcards be allowed or not. Defaults to true.
public AllowLeadingWildcard ( bool allowLeadingWildcard ) : QueryStringQueryBuilder
allowLeadingWildcard bool
return QueryStringQueryBuilder

AnalyzeWildcard() public method

Set to true to enable analysis on wildcard and prefix queries.
public AnalyzeWildcard ( bool analyzeWildcard ) : QueryStringQueryBuilder
analyzeWildcard bool
return QueryStringQueryBuilder

Analyzer() public method

The optional analyzer used to analyze the query string. Note, if a field has search analyzer defined for it, then it will be used automatically. Defaults to the smart search analyzer.
public Analyzer ( string analyzer ) : QueryStringQueryBuilder
analyzer string
return QueryStringQueryBuilder

AutoGeneratePhraseQueries() public method

Set to true if phrase queries will be automatically generated when the analyzer returns more than one term from whitespace delimited text. NOTE: this behavior may not be suitable for all languages. Set to false if phrase queries should only be generated when surrounded by double quotes.
public AutoGeneratePhraseQueries ( bool autoGeneratePhraseQueries ) : QueryStringQueryBuilder
autoGeneratePhraseQueries bool
return QueryStringQueryBuilder

Boost() public method

Sets the boost for this query. Documents matching this query will (in addition to the normal weightings) have their score multiplied by the boost provided.
public Boost ( float boost ) : QueryStringQueryBuilder
boost float
return QueryStringQueryBuilder

DefaultField() public method

The default field to run against when no prefix field is specified. Only relevant when not explicitly adding fields the query string will run against.
public DefaultField ( string defaultField ) : QueryStringQueryBuilder
defaultField string
return QueryStringQueryBuilder

DefaultOperator() public method

Sets the boolean operator of the query parser used to parse the query string. In default mode ({@link FieldQueryBuilder.Operator#OR}) terms without any modifiers are considered optional: for example capital of Hungary is equal to capital OR of OR Hungary. In {@link FieldQueryBuilder.Operator#AND} mode terms are considered to be in conjunction: the above mentioned query is parsed as capital AND of AND Hungary
public DefaultOperator ( Operator defaultOperator ) : QueryStringQueryBuilder
defaultOperator Operator
return QueryStringQueryBuilder

EnablePositionIncrements() public method

Set to true to enable position increments in result query. Defaults to true. When set, result phrase and multi-phrase queries will be aware of position increments. Useful when e.g. a StopFilter increases the position increment of the token that follows an omitted token.
public EnablePositionIncrements ( bool enablePositionIncrements ) : QueryStringQueryBuilder
enablePositionIncrements bool
return QueryStringQueryBuilder

Field() public method

Adds a field to run the query string against.
public Field ( string field ) : QueryStringQueryBuilder
field string
return QueryStringQueryBuilder

Field() public method

Adds a field to run the query string against with a specific boost.
public Field ( string field, float boost ) : QueryStringQueryBuilder
field string
boost float
return QueryStringQueryBuilder

FuzzyMinSim() public method

Set the minimum similarity for fuzzy queries. Default is 0.5f.
public FuzzyMinSim ( float fuzzyMinSim ) : QueryStringQueryBuilder
fuzzyMinSim float
return QueryStringQueryBuilder

FuzzyPrefixLength() public method

Set the minimum similarity for fuzzy queries. Default is 0.5f.
public FuzzyPrefixLength ( int fuzzyPrefixLength ) : QueryStringQueryBuilder
fuzzyPrefixLength int
return QueryStringQueryBuilder

LowercaseExpandedTerms() public method

Whether terms of wildcard, prefix, fuzzy and range queries are to be automatically lower-cased or not. Default is true.
public LowercaseExpandedTerms ( bool lowercaseExpandedTerms ) : QueryStringQueryBuilder
lowercaseExpandedTerms bool
return QueryStringQueryBuilder

MinimumShouldMatch() public method

public MinimumShouldMatch ( string minimumShouldMatch ) : QueryStringQueryBuilder
minimumShouldMatch string
return QueryStringQueryBuilder

PhraseSlop() public method

Sets the default slop for phrases. If zero, then exact phrase matches are required. Default value is zero.
public PhraseSlop ( int phraseSlop ) : QueryStringQueryBuilder
phraseSlop int
return QueryStringQueryBuilder

QueryStringQueryBuilder() public method

public QueryStringQueryBuilder ( string querystring ) : System
querystring string
return System

Rewrite() public method

public Rewrite ( string rewrite ) : QueryStringQueryBuilder
rewrite string
return QueryStringQueryBuilder

TieBreaker() public method

When more than one field is used with the query string, and combined queries are using dis max, control the tie breaker for it.
public TieBreaker ( float tieBreaker ) : QueryStringQueryBuilder
tieBreaker float
return QueryStringQueryBuilder

ToJsonObject() public method

public ToJsonObject ( ) : object
return object

ToString() public method

public ToString ( ) : string
return string

UseDisMax() public method

When more than one field is used with the query string, should queries be combined using dis max, or boolean query. Defaults to dis max (true).
public UseDisMax ( bool useDisMax ) : QueryStringQueryBuilder
useDisMax bool
return QueryStringQueryBuilder