src/services/ExtensibleSearchService.php
public function logSearch($term, $results, $time, $engine, $pageID) {

		// Make sure the search analytics are enabled.

		if(!Config::inst()->get(ExtensibleSearch::class, 'enable_analytics')) {
			return null;
		}

		// Log the details of the user search.

		$search = ExtensibleSearch::create(
			array(
				'Term'	=> $term,
				'Results' => $results,
				'Time' => $time,
				'SearchEngine' => $engine,
				'ExtensibleSearchPageID' => $pageID
			)
		);
		$search->write();

		// Log the details of the user search as a suggestion.

		if($results > 0) {
			$this->logSuggestion($term, $pageID);
		}
		return $search;
	}
public function logSearch($term, $results, $time, $engine, $pageID) {

		// Make sure the search analytics are enabled.

		if(!Config::inst()->get(ExtensibleSearch::class, 'enable_analytics')) {
			return null;
		}

		// Log the details of the user search.

		$search = ExtensibleSearch::create(
			array(
				'Term'	=> $term,
				'Results' => $results,
				'Time' => $time,
				'SearchEngine' => $engine,
				'ExtensibleSearchPageID' => $pageID
			)
		);
		$search->write();

		// Log the details of the user search as a suggestion.

		if($results > 0) {
			$this->logSuggestion($term, $pageID);
		}
		return $search;
	}
public function logSearch ( $ term , $ results , $ time , $ engine , $ pageID ) { // Make sure the search analytics are enabled. if ( ! Config :: inst ( ) -> get ( ExtensibleSearch :: class , 'enable_analytics' ) ) { return null ; } // Log the details of the user search. $ search = ExtensibleSearch :: create ( array ( 'Term' => $ term , 'Results' => $ results , 'Time' => $ time , 'SearchEngine' => $ engine , 'ExtensibleSearchPageID' => $ pageID ) ) ; $ search -> write ( ) ; // Log the details of the user search as a suggestion. if ( $ results > 0 ) { $ this -> logSuggestion ( $ term , $ pageID ) ; } return $ search ; }
Log the details of a user search for analytics.

@parameter <{SEARCH_TERM}> string
@parameter <{NUMBER_OF_SEARCH_RESULTS}> integer
@parameter <{SEARCH_TIME}> float
@parameter <{SEARCH_ENGINE}> string
@parameter <{EXTENSIBLE_SEARCH_PAGE_ID}> integer
@return extensible search
Log the details of a user search for analytics .