/** * * * @param stdClass $command * * @return array */ public function find($command) { $this->liveSearch->setStartCount($command->start); $this->liveSearch->setLimitCount($command->limit); $this->liveSearch->setQueryString($command->query); // jump & edit - find page and retrieve an edit link (this is only for pages if ($this->queryParser->isValidPageJump($command->query)) { $this->searchResults['pageJump'] = $this->liveSearch->findPage($command->query); $commandQuery = $this->queryParser->getCommandForPageJump($command->query); if ($commandQuery) { $command->query = $commandQuery; } } // search through the database and find records who match to the given search string $resultArray = $this->liveSearch->find($command->query); foreach ($resultArray as $resultFromTable) { foreach ($resultFromTable as $item) { $this->searchResults['searchItems'][] = $item; } } return $this->searchResults; }
/** * Find records from database based on the given $searchQuery. * * @param string $searchQuery * @return array Result list of database search. */ public function find($searchQuery) { $recordArray = array(); $pageIdList = $this->getAvailablePageIds(implode(',', $GLOBALS['BE_USER']->returnWebmounts()), self::RECURSIVE_PAGE_LEVEL); $limit = $this->startCount . ',' . $this->limitCount; if ($this->queryParser->isValidCommand($searchQuery)) { $this->setQueryString($this->queryParser->getSearchQueryValue($searchQuery)); $tableName = $this->queryParser->getTableNameFromCommand($searchQuery); if ($tableName) { $recordArray[] = $this->findByTable($tableName, $pageIdList, $limit); } } else { $this->setQueryString($searchQuery); $recordArray = $this->findByGlobalTableList($pageIdList); } return $recordArray; }