/** * @see ISearchDocuments::searchDocuments * * @return ElasticSearch_SearchResultCollection */ public function searchInFields(array $fields, $request, $offset) { $terms = trim($request->getValidated('search_fulltext', 'string', '')); $results = array(); if ($terms) { $query = $this->getSearchInFieldsQuery($terms, $fields, $offset); $searchResult = $this->client->search($query); $results = $this->result_factory->getChangesetIds($searchResult); } return $results; }
public function itSkipsResultIfUserCannotAccessProject() { $query_result = json_decode(file_get_contents(dirname(__FILE__) . '/../_fixtures/ES_query_result_01.txt'), true); $project_01 = mock('Project'); $project_02 = mock('Project'); stub($this->project_manager)->getProject(116)->returns($project_01); stub($this->project_manager)->getProject(168)->returns($project_02); stub($this->url_verification)->userCanAccessProject('*', $project_01)->returns(true); stub($this->url_verification)->userCanAccessProject('*', $project_02)->throws(new Project_AccessPrivateException()); $this->assertCount($this->result_factory->getSearchResults($query_result), 2); }