src/services/ExtensibleSearchService.php
public function getPageSuggestions($pageID, $limit = 0, $approved = true) {

		// Make sure the current user has appropriate permission.

		$pageID = (int)$pageID;
		if(($page = ExtensibleSearchPage::get_by_id(ExtensibleSearchPage::class, $pageID)) && $page->canView()) {

			// Retrieve the search suggestions.

			$suggestions = ExtensibleSearchSuggestion::get()->filter(array(
				'Approved' => (int)$approved,
				'ExtensibleSearchPageID' => $pageID
			))->sort('Frequency', 'DESC');
			if($limit) {
				$suggestions = $suggestions->limit($limit);
			}

			// Make sure the search suggestions are unique.

			return $suggestions->column('Term');
		}
		return array();
	}
public function getPageSuggestions($pageID, $limit = 0, $approved = true) {

		// Make sure the current user has appropriate permission.

		$pageID = (int)$pageID;
		if(($page = ExtensibleSearchPage::get_by_id(ExtensibleSearchPage::class, $pageID)) && $page->canView()) {

			// Retrieve the search suggestions.

			$suggestions = ExtensibleSearchSuggestion::get()->filter(array(
				'Approved' => (int)$approved,
				'ExtensibleSearchPageID' => $pageID
			))->sort('Frequency', 'DESC');
			if($limit) {
				$suggestions = $suggestions->limit($limit);
			}

			// Make sure the search suggestions are unique.

			return $suggestions->column('Term');
		}
		return array();
	}
public function getPageSuggestions ( $ pageID , $ limit = 0 , $ approved = true ) { // Make sure the current user has appropriate permission. $ pageID = ( int ) $ pageID ; if ( ( $ page = ExtensibleSearchPage :: get_by_id ( ExtensibleSearchPage :: class , $ pageID ) ) && $ page -> canView ( ) ) { // Retrieve the search suggestions. $ suggestions = ExtensibleSearchSuggestion :: get ( ) -> filter ( array ( 'Approved' => ( int ) $ approved , 'ExtensibleSearchPageID' => $ pageID ) ) -> sort ( 'Frequency' , 'DESC' ) ; if ( $ limit ) { $ suggestions = $ suggestions -> limit ( $ limit ) ; } // Make sure the search suggestions are unique. return $ suggestions -> column ( 'Term' ) ; } return array ( ) ; }
Retrieve the search suggestions for a page.

@parameter <{EXTENSIBLE_SEARCH_PAGE_ID}> integer
@parameter <{LIMIT}> integer
@parameter <{APPROVED_ONLY}> boolean
@return array
Retrieve the search suggestions for a page .