protected function SearchApiWebTest::doSearch in Search API 7
Executes a search on the test index.
Helper method used for testing search results.
Parameters
int|null $offset: (optional) The offset for the returned results.
int|null $limit: (optional) The limit for the returned results.
Return value
array Search results as specified by SearchApiQueryInterface::execute().
4 calls to SearchApiWebTest::doSearch()
- SearchApiWebTest::checkIndexingOrder in ./
search_api.test - Tests whether items are indexed in the right order.
- SearchApiWebTest::checkServerTasks in ./
search_api.test - Tests whether the server tasks system works correctly.
- SearchApiWebTest::searchNoResults in ./
search_api.test - Asserts that a search on the index works but yields no results.
- SearchApiWebTest::searchSuccess in ./
search_api.test - Tests whether searches yield the right results after indexing.
File
- ./
search_api.test, line 370 - Contains the SearchApiWebTest and the SearchApiUnitTest classes.
Class
- SearchApiWebTest
- Class for testing Search API functionality via the UI.
Code
protected function doSearch($offset = NULL, $limit = NULL) {
// Since we change server and index settings via the UI (and, therefore, in
// different page requests), the static cache in this page request
// (executing the tests) will get stale. Therefore, we clear it before
// executing the search.
$this
->index();
$this
->server();
$query = search_api_query($this->index_id);
if ($offset || $limit) {
$query
->range($offset, $limit);
}
return $query
->execute();
}