ejsQueryStringQuery

A query that is parsed using Lucene's default query parser. Although Lucene provides the ability to create your own queries through its API, it also provides a rich query language through the Query Parser, a lexer which interprets a string into a Lucene Query.

See the Lucene Query Parser Syntax for more information.

Module

 QueryStringQuery

QueryStringQuery ( qstr )
A query that is parsed using Lucene's default query parser.

Parameters
qstr <String> A valid Lucene query string.

Method Summary

Returns Name Description
String_type()The type of ejs object. For internal use only.
ObjectallowLeadingWildcard(trueFalse)Sets whether or not wildcard characters (* and ?) are allowed as the first character of the Query. Default: true.
Objectanalyzer(analyzer)Sets the analyzer name used to analyze the Query object.
ObjectanalyzeWildcard(trueFalse)Sets whether or not we should attempt to analyzed wilcard terms in the Query. By default, wildcard terms are not analyzed. Analysis of wildcard characters is not perfect. Default: false.
ObjectautoGeneratePhraseQueries(trueFalse)Sets whether or not we should auto generate phrase queries *if* the analyzer returns more than one term. Default: false.
Objectboost(boost)Sets the boost value for documents matching the Query.
ObjectdefaultField(fieldName)Sets the default field/property this query should execute against.
ObjectdefaultOperator(op)Set the default Boolean operator. This operator is used to join individual query terms when no operator is explicity used in the query string (i.e., this AND that). Defaults to OR.
ObjectenablePositionIncrements(trueFalse)Sets whether or not position increments will be used in the Query. Default: true.
Objectescape(trueFalse)If they query string should be escaped or not.
Objectfields(fieldNames)A set of fields/properties this query should execute against. Pass a single value to add to the existing list of fields and pass an array to overwrite all existing fields. For each field, you can apply a field specific boost by appending a ^boost to the field name. For example, title^10, to give the title field a boost of 10.
ObjectfuzzyMaxExpansions(max)Sets the max number of term expansions for fuzzy queries.
ObjectfuzzyMinSim(minSim)Set the minimum similarity for fuzzy queries. Default: 0.5.
ObjectfuzzyPrefixLength(fuzzLen)Sets the prefix length for fuzzy queries. Default: 0.
ObjectfuzzyRewrite(m)Sets fuzzy rewrite method. Valid values are: constant_score_auto - tries to pick the best constant-score rewrite method based on term and document counts from the query scoring_boolean - translates each term into boolean should and keeps the scores as computed by the query constant_score_boolean - same as scoring_boolean, expect no scores are computed. constant_score_filter - first creates a private Filter, by visiting each term in sequence and marking all docs for that term top_terms_boost_N - first translates each term into boolean should and scores are only computed as the boost using the top N scoring terms. Replace N with an integer value. top_terms_N - first translates each term into boolean should and keeps the scores as computed by the query. Only the top N scoring terms are used. Replace N with an integer value. Default is constant_score_auto. This is an advanced option, use with care.
Objectlenient(trueFalse)Enables lenient parsing of the query string.
ObjectlowercaseExpandedTerms(trueFalse)Sets whether or not terms from wildcard, prefix, fuzzy, and range queries should automatically be lowercased in the Query since they are not analyzed. Default: true.
ObjectminimumShouldMatch(minMatch)Sets a percent value controlling how many "should" clauses in the resulting Query should match.
ObjectphraseSlop(slop)Sets the default slop for phrases. If zero, then exact phrase matches are required. Default: 0.
Objectquery(qstr)Sets the query string on this Query object.
ObjectquoteAnalyzer(analyzer)Sets the quote analyzer name used to analyze the query when in quoted text.
ObjectquoteFieldSuffix(s)Sets the suffix to automatically add to the field name when performing a quoted search.
Objectrewrite(m)Sets rewrite method. Valid values are: constant_score_auto - tries to pick the best constant-score rewrite method based on term and document counts from the query scoring_boolean - translates each term into boolean should and keeps the scores as computed by the query constant_score_boolean - same as scoring_boolean, expect no scores are computed. constant_score_filter - first creates a private Filter, by visiting each term in sequence and marking all docs for that term top_terms_boost_N - first translates each term into boolean should and scores are only computed as the boost using the top N scoring terms. Replace N with an integer value. top_terms_N - first translates each term into boolean should and keeps the scores as computed by the query. Only the top N scoring terms are used. Replace N with an integer value. Default is constant_score_auto. This is an advanced option, use with care.
ObjecttieBreaker(tieBreaker)Sets the tie breaker value for a Query using DisMax. The tie breaker capability allows results that include the same term in multiple fields to be judged better than results that include this term in only the best of those multiple fields, without confusing this with the better case of two different terms in the multiple fields. Default: 0.0.
StringtoJSON()Retrieves the internal query object. This is typically used by internal API functions so use with caution.
ObjectuseDisMax(trueFalse)Sets whether or not queries against multiple fields should be combined using Lucene's DisjunctionMaxQuery

Method Detail

 _type

String _type ( )
The type of ejs object. For internal use only.

Returns
the type of object

 allowLeadingWildcard

Object allowLeadingWildcard ( trueFalse )
Sets whether or not wildcard characters (* and ?) are allowed as the first character of the Query. Default: true.

Parameters
trueFalse <Boolean> A true/false value.
Returns
returns this so that calls can be chained.

 analyzer

Object analyzer ( analyzer )
Sets the analyzer name used to analyze the Query object.

Parameters
analyzer <String> A valid analyzer name.
Returns
returns this so that calls can be chained.

 analyzeWildcard

Object analyzeWildcard ( trueFalse )
Sets whether or not we should attempt to analyzed wilcard terms in the Query. By default, wildcard terms are not analyzed. Analysis of wildcard characters is not perfect. Default: false.

Parameters
trueFalse <Boolean> A true/false value.
Returns
returns this so that calls can be chained.

 autoGeneratePhraseQueries

Object autoGeneratePhraseQueries ( trueFalse )
Sets whether or not we should auto generate phrase queries *if* the analyzer returns more than one term. Default: false.

Parameters
trueFalse <Boolean> A true/false value.
Returns
returns this so that calls can be chained.

 boost

Object boost ( boost )
Sets the boost value for documents matching the Query.

Parameters
boost <Double> A positive double value.
Returns
returns this so that calls can be chained.

 defaultField

Object defaultField ( fieldName )
Sets the default field/property this query should execute against.

Parameters
fieldName <String> The name of document field/property.
Returns
returns this so that calls can be chained.

 defaultOperator

Object defaultOperator ( op )
Set the default Boolean operator. This operator is used to join individual query terms when no operator is explicity used in the query string (i.e., this AND that). Defaults to OR.

Parameters
op <String> The operator to use, AND or OR.
Returns
returns this so that calls can be chained.

 enablePositionIncrements

Object enablePositionIncrements ( trueFalse )
Sets whether or not position increments will be used in the Query. Default: true.

Parameters
trueFalse <Boolean> A true/false value.
Returns
returns this so that calls can be chained.

 escape

Object escape ( trueFalse )
If they query string should be escaped or not.

Parameters
trueFalse <Boolean> A true/false value.
Returns
returns this so that calls can be chained.

 fields

Object fields ( fieldNames )
A set of fields/properties this query should execute against. Pass a single value to add to the existing list of fields and pass an array to overwrite all existing fields. For each field, you can apply a field specific boost by appending a ^boost to the field name. For example, title^10, to give the title field a boost of 10.

Parameters
fieldNames <Array> A list of document fields/properties.
Returns
returns this so that calls can be chained.

 fuzzyMaxExpansions

Object fuzzyMaxExpansions ( max )
Sets the max number of term expansions for fuzzy queries.

Parameters
max <Integer> A positive integer value.
Returns
returns this so that calls can be chained.

 fuzzyMinSim

Object fuzzyMinSim ( minSim )
Set the minimum similarity for fuzzy queries. Default: 0.5.

Parameters
minSim <Double> A double value between 0 and 1.
Returns
returns this so that calls can be chained.

 fuzzyPrefixLength

Object fuzzyPrefixLength ( fuzzLen )
Sets the prefix length for fuzzy queries. Default: 0.

Parameters
fuzzLen <Integer> A positive integer value.
Returns
returns this so that calls can be chained.

 fuzzyRewrite

Object fuzzyRewrite ( m )
Sets fuzzy rewrite method. Valid values are: constant_score_auto - tries to pick the best constant-score rewrite method based on term and document counts from the query scoring_boolean - translates each term into boolean should and keeps the scores as computed by the query constant_score_boolean - same as scoring_boolean, expect no scores are computed. constant_score_filter - first creates a private Filter, by visiting each term in sequence and marking all docs for that term top_terms_boost_N - first translates each term into boolean should and scores are only computed as the boost using the top N scoring terms. Replace N with an integer value. top_terms_N - first translates each term into boolean should and keeps the scores as computed by the query. Only the top N scoring terms are used. Replace N with an integer value. Default is constant_score_auto. This is an advanced option, use with care.

Parameters
m <String> The rewrite method as a string.
Returns
returns this so that calls can be chained.

 lenient

Object lenient ( trueFalse )
Enables lenient parsing of the query string.

Parameters
trueFalse <Boolean> A boolean value
Returns
returns this so that calls can be chained.

 lowercaseExpandedTerms

Object lowercaseExpandedTerms ( trueFalse )
Sets whether or not terms from wildcard, prefix, fuzzy, and range queries should automatically be lowercased in the Query since they are not analyzed. Default: true.

Parameters
trueFalse <Boolean> A true/false value.
Returns
returns this so that calls can be chained.

 minimumShouldMatch

Object minimumShouldMatch ( minMatch )
Sets a percent value controlling how many "should" clauses in the resulting Query should match.

Parameters
minMatch <String> A min should match parameter.
Returns
returns this so that calls can be chained.

 phraseSlop

Object phraseSlop ( slop )
Sets the default slop for phrases. If zero, then exact phrase matches are required. Default: 0.

Parameters
slop <Integer> A positive integer value.
Returns
returns this so that calls can be chained.

 query

Object query ( qstr )
Sets the query string on this Query object.

Parameters
qstr <String> A valid Lucene query string.
Returns
returns this so that calls can be chained.

 quoteAnalyzer

Object quoteAnalyzer ( analyzer )
Sets the quote analyzer name used to analyze the query when in quoted text.

Parameters
analyzer <String> A valid analyzer name.
Returns
returns this so that calls can be chained.

 quoteFieldSuffix

Object quoteFieldSuffix ( s )
Sets the suffix to automatically add to the field name when performing a quoted search.

Parameters
s <String> The suffix as a string.
Returns
returns this so that calls can be chained.

 rewrite

Object rewrite ( m )
Sets rewrite method. Valid values are: constant_score_auto - tries to pick the best constant-score rewrite method based on term and document counts from the query scoring_boolean - translates each term into boolean should and keeps the scores as computed by the query constant_score_boolean - same as scoring_boolean, expect no scores are computed. constant_score_filter - first creates a private Filter, by visiting each term in sequence and marking all docs for that term top_terms_boost_N - first translates each term into boolean should and scores are only computed as the boost using the top N scoring terms. Replace N with an integer value. top_terms_N - first translates each term into boolean should and keeps the scores as computed by the query. Only the top N scoring terms are used. Replace N with an integer value. Default is constant_score_auto. This is an advanced option, use with care.

Parameters
m <String> The rewrite method as a string.
Returns
returns this so that calls can be chained.

 tieBreaker

Object tieBreaker ( tieBreaker )
Sets the tie breaker value for a Query using DisMax. The tie breaker capability allows results that include the same term in multiple fields to be judged better than results that include this term in only the best of those multiple fields, without confusing this with the better case of two different terms in the multiple fields. Default: 0.0.

Parameters
tieBreaker <Double> A positive double value.
Returns
returns this so that calls can be chained.

 toJSON

String toJSON ( )
Retrieves the internal query object. This is typically used by internal API functions so use with caution.

Returns
returns this object's internal query property.

 useDisMax

Object useDisMax ( trueFalse )
Sets whether or not queries against multiple fields should be combined using Lucene's DisjunctionMaxQuery

Parameters
trueFalse <String> A true/false value.
Returns
returns this so that calls can be chained.

Request

Queries

Filters

Aggregations

Facets

Suggesters

Geo