public function find($string = '') { $this->searchTerms = array_filter(explode(' ', $string)); if ($this->autocompleteField !== '') { $this->params['facet'] = 'on'; if (!isset($this->params['facet.field'])) { $this->params['facet.field'] = array($this->autocompleteField); } else { $this->params['facet.field'][] = $this->autocompleteField; } $this->params['f.' . $this->autocompleteField . '.facet.sort'] = $this->autocompleteSort; $this->params['f.' . $this->autocompleteField . '.facet.limit'] = $this->autocompleteLimit; $this->params['f.' . $this->autocompleteField . '.facet.prefix'] = end($this->searchTerms); $this->params['f.' . $this->autocompleteField . '.facet.mincount'] = 1; } $response = $this->exec($this->buildQuery('standardQuery')); // PREPAIR PAGING if (isset($response->count) && isset($response->offset)) { $paging = new Paging($response->count, $this->params['rows'], null, $response->offset); foreach ($paging->calculate() as $key => $val) { $response->{$key} = $val; } } return $response; }