/** * Returns an array of search results. This result is memoized for * performance though setting the search key anew clears the memo again. * * @return array an array of search results */ function getSearchResult() { # no search key -> return empty array if ($this->searchKey === '') { return array(); } # not memoized yet, do so now if (is_null($this->searchResult)) { $this->searchResult = StudipStudyArea::search($this->searchKey); usort($this->searchResult, array(__CLASS__, 'sortSearchResult')); } return $this->searchResult; }
public function searchSemTree($searchterm, $utf = true, $id_only = false) { $result = array(); $search = StudipStudyArea::search($searchterm); $root = StudipStudyArea::backwards($search); $result = $this->buildPartialSemTree($root, $utf, $id_only); if ($id_only) { return $result; } else { return json_encode($result); } }