src/pages/ExtensibleSearchPage.php
public function getSelectableFields() {

		// Instantiate some default selectable fields, just in case the search engine does not provide any.

		$selectable = array(
			'LastEdited' => _t('EXTENSIBLE_SEARCH.LAST_EDITED', 'Last Edited'),
			'ID' => _t('EXTENSIBLE_SEARCH.CREATED', 'Created'),
			'ClassName' => _t('EXTENSIBLE_SEARCH.TYPE', 'Type')
		);

		// Determine the search engine that has been selected.

		if(($this->SearchEngine !== 'Full-Text') && ClassInfo::exists($this->SearchEngine)) {

			// Determine the search engine specific selectable fields.

			$fields = singleton($this->SearchEngine)->getSelectableFields($this) ?: array();
			return $fields + $selectable;
		}
		else if(($this->SearchEngine === 'Full-Text') && is_array($classes = Config::inst()->get(FulltextSearchable::class, 'searchable_classes')) && (count($classes) > 0)) {

			// Determine the full-text specific selectable fields.

			$selectable = array(
				'Relevance' => _t('EXTENSIBLE_SEARCH.RELEVANCE', 'Relevance')
			) + $selectable;
			foreach($classes as $class) {
				$fields = DataObject::getSchema()->databaseFields($class);

				// Determine the most appropriate fields, primarily for sorting.

				if(isset($fields['Title'])) {
					$selectable['Title'] = _t('EXTENSIBLE_SEARCH.TITLE', 'Title');
				}
				if(isset($fields['MenuTitle'])) {
					$selectable['MenuTitle'] = _t('EXTENSIBLE_SEARCH.NAVIGATION_TITLE', 'Navigation Title');
				}
				if(isset($fields['Sort'])) {
					$selectable['Sort'] = _t('EXTENSIBLE_SEARCH.DISPLAY_ORDER', 'Display Order');
				}

				// This is specific to file searching.

				if(isset($fields['Name'])) {
					$selectable['Name'] = _t('EXTENSIBLE_SEARCH.FILE_NAME', 'File Name');
				}
			}
		}

		// Allow extension customisation, so custom fields may be selectable.

		$this->extend('updateExtensibleSearchPageSelectableFields', $selectable);
		return $selectable;
	}
public function getSelectableFields() {

		// Instantiate some default selectable fields, just in case the search engine does not provide any.

		$selectable = array(
			'LastEdited' => _t('EXTENSIBLE_SEARCH.LAST_EDITED', 'Last Edited'),
			'ID' => _t('EXTENSIBLE_SEARCH.CREATED', 'Created'),
			'ClassName' => _t('EXTENSIBLE_SEARCH.TYPE', 'Type')
		);

		// Determine the search engine that has been selected.

		if(($this->SearchEngine !== 'Full-Text') && ClassInfo::exists($this->SearchEngine)) {

			// Determine the search engine specific selectable fields.

			$fields = singleton($this->SearchEngine)->getSelectableFields($this) ?: array();
			return $fields + $selectable;
		}
		else if(($this->SearchEngine === 'Full-Text') && is_array($classes = Config::inst()->get(FulltextSearchable::class, 'searchable_classes')) && (count($classes) > 0)) {

			// Determine the full-text specific selectable fields.

			$selectable = array(
				'Relevance' => _t('EXTENSIBLE_SEARCH.RELEVANCE', 'Relevance')
			) + $selectable;
			foreach($classes as $class) {
				$fields = DataObject::getSchema()->databaseFields($class);

				// Determine the most appropriate fields, primarily for sorting.

				if(isset($fields['Title'])) {
					$selectable['Title'] = _t('EXTENSIBLE_SEARCH.TITLE', 'Title');
				}
				if(isset($fields['MenuTitle'])) {
					$selectable['MenuTitle'] = _t('EXTENSIBLE_SEARCH.NAVIGATION_TITLE', 'Navigation Title');
				}
				if(isset($fields['Sort'])) {
					$selectable['Sort'] = _t('EXTENSIBLE_SEARCH.DISPLAY_ORDER', 'Display Order');
				}

				// This is specific to file searching.

				if(isset($fields['Name'])) {
					$selectable['Name'] = _t('EXTENSIBLE_SEARCH.FILE_NAME', 'File Name');
				}
			}
		}

		// Allow extension customisation, so custom fields may be selectable.

		$this->extend('updateExtensibleSearchPageSelectableFields', $selectable);
		return $selectable;
	}
public function getSelectableFields ( ) { // Instantiate some default selectable fields, just in case the search engine does not provide any. $ selectable = array ( 'LastEdited' => _t ( 'EXTENSIBLE_SEARCH.LAST_EDITED' , 'Last Edited' ) , 'ID' => _t ( 'EXTENSIBLE_SEARCH.CREATED' , 'Created' ) , 'ClassName' => _t ( 'EXTENSIBLE_SEARCH.TYPE' , 'Type' ) ) ; // Determine the search engine that has been selected. if ( ( $ this -> SearchEngine !== 'Full-Text' ) && ClassInfo :: exists ( $ this -> SearchEngine ) ) { // Determine the search engine specific selectable fields. $ fields = singleton ( $ this -> SearchEngine ) -> getSelectableFields ( $ this ) ? : array ( ) ; return $ fields + $ selectable ; } else if ( ( $ this -> SearchEngine === 'Full-Text' ) && is_array ( $ classes = Config :: inst ( ) -> get ( FulltextSearchable :: class , 'searchable_classes' ) ) && ( count ( $ classes ) > 0 ) ) { // Determine the full-text specific selectable fields. $ selectable = array ( 'Relevance' => _t ( 'EXTENSIBLE_SEARCH.RELEVANCE' , 'Relevance' ) ) + $ selectable ; foreach ( $ classes as $ class ) { $ fields = DataObject :: getSchema ( ) -> databaseFields ( $ class ) ; // Determine the most appropriate fields, primarily for sorting. if ( isset ( $ fields [ 'Title' ] ) ) { $ selectable [ 'Title' ] = _t ( 'EXTENSIBLE_SEARCH.TITLE' , 'Title' ) ; } if ( isset ( $ fields [ 'MenuTitle' ] ) ) { $ selectable [ 'MenuTitle' ] = _t ( 'EXTENSIBLE_SEARCH.NAVIGATION_TITLE' , 'Navigation Title' ) ; } if ( isset ( $ fields [ 'Sort' ] ) ) { $ selectable [ 'Sort' ] = _t ( 'EXTENSIBLE_SEARCH.DISPLAY_ORDER' , 'Display Order' ) ; } // This is specific to file searching. if ( isset ( $ fields [ 'Name' ] ) ) { $ selectable [ 'Name' ] = _t ( 'EXTENSIBLE_SEARCH.FILE_NAME' , 'File Name' ) ; } } } // Allow extension customisation, so custom fields may be selectable. $ this -> extend ( 'updateExtensibleSearchPageSelectableFields' , $ selectable ) ; return $ selectable ; }
Determine the search engine specific selectable fields, primarily for sorting.

@return array(string, string)
Determine the search engine specific selectable fields primarily for sorting .