Browse Source

Options parameter added to "\yii\mogo\Collection::fullTextSearch()"

tags/2.0.0-beta
Paul Klimov 11 years ago
parent
commit
47249ff381
  1. 14
      extensions/mongo/Collection.php

14
extensions/mongo/Collection.php

@ -577,14 +577,15 @@ class Collection extends Object
* @param string $search string of terms that MongoDB parses and uses to query the text index. * @param string $search string of terms that MongoDB parses and uses to query the text index.
* @param array $condition criteria for filtering a results list. * @param array $condition criteria for filtering a results list.
* @param array $fields list of fields to be returned in result. * @param array $fields list of fields to be returned in result.
* @param integer $limit the maximum number of documents to include in the response (by default 100). * @param array $options additional optional parameters to the mapReduce command. Valid options include:
* @param string $language he language that determines the list of stop words for the search * - limit - the maximum number of documents to include in the response (by default 100).
* - language - the language that determines the list of stop words for the search
* and the rules for the stemmer and tokenizer. If not specified, the search uses the default * and the rules for the stemmer and tokenizer. If not specified, the search uses the default
* language of the index. * language of the index.
* @return array the highest scoring documents, in descending order by score. * @return array the highest scoring documents, in descending order by score.
* @throws Exception on failure. * @throws Exception on failure.
*/ */
public function fullTextSearch($search, $condition = [], $fields = [], $limit = null, $language = null) { public function fullTextSearch($search, $condition = [], $fields = [], $options = []) {
$command = [ $command = [
'search' => $search 'search' => $search
]; ];
@ -594,11 +595,8 @@ class Collection extends Object
if (!empty($fields)) { if (!empty($fields)) {
$command['project'] = $fields; $command['project'] = $fields;
} }
if ($limit !== null) { if (!empty($options)) {
$command['limit'] = $limit; $command = array_merge($command, $options);
}
if ($language !== null) {
$command['language'] = $language;
} }
$token = $this->composeLogToken('text', $command); $token = $this->composeLogToken('text', $command);
Yii::info($token, __METHOD__); Yii::info($token, __METHOD__);

Loading…
Cancel
Save