include/SugarSearchEngine/Elastic/Elastica/Query/QueryString.php
QueryString query
- Author
- Nicolas Ruflin
, Jasper van Wanrooy - Category
- Xodoa
- Link
- http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html
- Package
- Elastica
- Uses
- \Elastica_Query_Abstract
\Elastica_Query_QueryString
QueryString query
This function can be used to handle params for queries, filter, facets
- Parent(s)
- \Elastica_Query_Abstract < \Elastica_Param
- Author
- Nicolas Ruflin
, Jasper van Wanrooy - Category
- Xodoa
- Link
- http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html
- Uses
- \Elastica_Query_Abstract
Properties

array
$_params= 'array()'
array()Details- Type
- array
- Inherited_from
- \Elastica_Param::$$_params
- Inherited_from
- \Elastica_Query_Abstract::$$_params

$_rawParams= 'array()'
array()Details- Type
- n/a
- Inherited_from
- \Elastica_Param::$$_rawParams
- Inherited_from
- \Elastica_Query_Abstract::$$_rawParams
Methods

__construct(
string $queryString
=
''
)
:
voidCreates query string object. Calls setQuery with argument
| Name | Type | Description |
|---|---|---|
| $queryString | string | OPTIONAL Query string for object |

_setRawParam(
string $key, mixed $value
)
:
\Elastica_ParamSets params not inside params array
Inherited from: \Elastica_Param::_setRawParam()\Elastica_Query_Abstract::_setRawParam()| Name | Type | Description |
|---|---|---|
| $key | string | |
| $value | mixed |
| Type | Description |
|---|---|
| \Elastica_Param |

addParam(
string $key, mixed $value
)
:
\Elastica_ParamAdds a param to the list
Inherited from: \Elastica_Param::addParam()\Elastica_Query_Abstract::addParam()This function can be used to add an array of params
| Name | Type | Description |
|---|---|---|
| $key | string | Param key |
| $value | mixed | Value to set |
| Type | Description |
|---|---|
| \Elastica_Param |

getParam(
string $key
)
:
mixedReturns a specific param
Inherited from: \Elastica_Param::getParam()\Elastica_Query_Abstract::getParam()| Name | Type | Description |
|---|---|---|
| $key | string | Key to return |
| Type | Description |
|---|---|
| mixed | Key value |
| Exception | Description |
|---|---|
| \Elastica_Exception_Invalid | If requested key is not set |

getParams(
)
:
arrayReturns the params array
Inherited from: \Elastica_Param::getParams()\Elastica_Query_Abstract::getParams()| Type | Description |
|---|---|
| array | Params |

setAllowLeadingWildcard(
bool $allow
=
true
)
:
\Elastica_Query_QueryStringSets the parameter to allow * and ? as first characters.
If not set, defaults to true.
| Name | Type | Description |
|---|---|---|
| $allow | bool |
| Type | Description |
|---|---|
| \Elastica_Query_QueryString | Current object |

setAnalyzeWildcard(
bool $analyze
=
true
)
:
\Elastica_Query_QueryStringAllows analyzing of wildcard terms.
If not set, defaults to false
| Name | Type | Description |
|---|---|---|
| $analyze | bool |
| Type | Description |
|---|---|
| \Elastica_Query_QueryString | Current object |

setAnalyzer(
string $analyzer
)
:
\Elastica_Query_QueryStringSets the analyzer to analyze the query with.
| Name | Type | Description |
|---|---|---|
| $analyzer | string | Analyser to use |
| Type | Description |
|---|---|
| \Elastica_Query_QueryString | Current object |

setAutoGeneratePhraseQueries(
bool $autoGenerate
=
true
)
:
\Elastica_Query_QueryStringSets the param to automatically generate phrase queries.
If not set, defaults to false.
| Name | Type | Description |
|---|---|---|
| $autoGenerate | bool |
| Type | Description |
|---|---|
| \Elastica_Query_QueryString | Current object |

setBoost(
float $boost
=
1.0
)
:
\Elastica_Query_QueryStringSets the boost value of the query.
If not set, defaults to 1.0.
| Name | Type | Description |
|---|---|---|
| $boost | float |
| Type | Description |
|---|---|
| \Elastica_Query_QueryString | Current object |

setDefaultField(
string $field
)
:
\Elastica_Query_QueryStringSets the default field
If no field is set, _all is chosen
| Name | Type | Description |
|---|---|---|
| $field | string | Field |
| Type | Description |
|---|---|
| \Elastica_Query_QueryString | Current object |

setDefaultOperator(
string $operator
)
:
\Elastica_Query_QueryStringSets the default operator AND or OR
If no operator is set, OR is chosen
| Name | Type | Description |
|---|---|---|
| $operator | string | Operator |
| Type | Description |
|---|---|
| \Elastica_Query_QueryString | Current object |

setEnablePositionIncrements(
bool $enabled
=
true
)
:
\Elastica_Query_QueryStringSets the paramater to enable the position increments in result queries.
If not set, defaults to true.
| Name | Type | Description |
|---|---|---|
| $enabled | bool |
| Type | Description |
|---|---|
| \Elastica_Query_QueryString | Current object |

setFields(
array $fields
)
:
\Elastica_Query_QueryStringSets the fields
If no fields are set, _all is chosen
| Name | Type | Description |
|---|---|---|
| $fields | array | Fields |
| Type | Description |
|---|---|
| \Elastica_Query_QueryString | Current object |

setFuzzyMinSim(
float $minSim
=
0.5
)
:
\Elastica_Query_QueryStringSets the fuzzy minimal similarity parameter.
If not set, defaults to 0.5
| Name | Type | Description |
|---|---|---|
| $minSim | float |
| Type | Description |
|---|---|
| \Elastica_Query_QueryString | Current object |

setFuzzyPrefixLength(
int $length
=
0
)
:
\Elastica_Query_QueryStringSets the fuzzy prefix length parameter.
If not set, defaults to 0.
| Name | Type | Description |
|---|---|---|
| $length | int |
| Type | Description |
|---|---|
| \Elastica_Query_QueryString | Current object |

setLowercaseExpandedTerms(
bool $lowercase
=
true
)
:
\Elastica_Query_QueryStringSets the parameter to auto-lowercase terms of some queries.
If not set, defaults to true.
| Name | Type | Description |
|---|---|---|
| $lowercase | bool |
| Type | Description |
|---|---|
| \Elastica_Query_QueryString | Current object |

setParam(
string $key, mixed $value
)
:
voidSets (overwrites) the value at the given key
Inherited from: \Elastica_Param::setParam()\Elastica_Query_Abstract::setParam()| Name | Type | Description |
|---|---|---|
| $key | string | Key to set |
| $value | mixed | Key Value |

setParams(
array $params
)
:
\Elastica_ParamSets (overwrites) all params of this object
Inherited from: \Elastica_Param::setParams()\Elastica_Query_Abstract::setParams()| Name | Type | Description |
|---|---|---|
| $params | array | Parameter list |
| Type | Description |
|---|---|
| \Elastica_Param |

setPhraseSlop(
int $phraseSlop
=
0
)
:
\Elastica_Query_QueryStringSets the phrase slop.
If zero, exact phrases are required. If not set, defaults to zero.
| Name | Type | Description |
|---|---|---|
| $phraseSlop | int |
| Type | Description |
|---|---|
| \Elastica_Query_QueryString | Current object |

setQuery(
string $query
=
''
)
:
\Elastica_Query_QueryStringSets a new query string for the object
| Name | Type | Description |
|---|---|---|
| $query | string | Query string |
| Type | Description |
|---|---|
| \Elastica_Query_QueryString | Current object |

setQueryString(
string $queryString
)
:
\Elastica_Query_QueryStringSets the default operator AND or OR
If no operator is set, OR is chosen
| Name | Type | Description |
|---|---|---|
| $queryString | string | Query string |
| Type | Description |
|---|---|
| \Elastica_Query_QueryString | Current object |
- Deprecated
- Please use setQuery instead

setRewrite(
string $rewrite
=
""
)
:
\Elastica_ParamSet a re-write condition. See https://github.com/elasticsearch/elasticsearch/issues/1186 for additional information
| Name | Type | Description |
|---|---|---|
| $rewrite | string |
| Type | Description |
|---|---|
| \Elastica_Param |
- Author
- Andreas Sandberg @sugarcrm Added pull request https://github.com/ruflin/Elastica/pull/141

setTieBraker(
int $tieBreaker
=
0
)
:
\Elastica_Query_QueryStringWhen using dis_max, the disjunction max tie breaker.
If not set, defaults to 0.
| Name | Type | Description |
|---|---|---|
| $tieBreaker | int |
| Type | Description |
|---|---|
| \Elastica_Query_QueryString | Current object |

setUseDisMax(
bool $value
=
true
)
:
\Elastica_Query_QueryStringWhether to use bool or dis_max quueries to internally combine results for multi field search.
| Name | Type | Description |
|---|---|---|
| $value | bool | Determines whether to use |
| Type | Description |
|---|---|
| \Elastica_Query_QueryString | Current object |