PHP Class Frontend\Modules\Search\Engine\Model

Afficher le fichier Open project: forkcms/forkcms Class Usage Examples

Méthodes publiques

Méthode Description
buildTerm ( array $terms ) : array Build the search term
execSearch ( mixed $term, integer $limit = 20, integer $offset ) : array Execute actual search
getStartsWith ( string $term, string $language = '', integer $limit = 10 ) : array Get preview searches that start with .
getSynonyms ( string $term ) : array Get synonyms
getTotal ( string $term ) : integer Get total results
save ( array $item ) Save a search
search ( string $term, integer $limit = 20, integer $offset ) : array Search The actual search will be performed by the execSearch() method.
statusIndex ( string $module, array $otherIds, boolean $active = true ) Deactivate an index (no longer has to be searched)
validateSearch ( ) Validate searches: check everything that has been marked as 'inactive', if should still be inactive

Method Details

buildTerm() public static méthode

Build the search term
public static buildTerm ( array $terms ) : array
$terms array The string to build.
Résultat array

execSearch() public static méthode

This function can be called with either a string as parameter (simple search) or an array (advanced search) Simple search: all search index fields will be searched for the given term Advanced search: only the given fields (keys in the array) will be matched to the corresponding values (corresponding values in the array)
public static execSearch ( mixed $term, integer $limit = 20, integer $offset ) : array
$term mixed The search term (simple search) or the fields to search for (advanced search - please note that the field names may not be consistent throughout several modules).
$limit integer The number of articles to get.
$offset integer The offset.
Résultat array

getStartsWith() public static méthode

..
public static getStartsWith ( string $term, string $language = '', integer $limit = 10 ) : array
$term string The first letters of the term we're looking for.
$language string The language to search in.
$limit integer Limit result set.
Résultat array

getSynonyms() public static méthode

Get synonyms
public static getSynonyms ( string $term ) : array
$term string The term to get synonyms for.
Résultat array

getTotal() public static méthode

Note: please be aware that this is an approximate amount. It IS possible that this is not the exact amount of search results, since search results may vary in time (entries may not yet/no longer be shown) and we will not rebuild the entire search index on every search (would be a great performance killer and huge scalability loss) This function can be called with either a string as parameter (simple search) or an array (advanced search) Simple search: all search index fields will be searched for the given term Advanced search: only the given fields (keys in the array) will be matched to the corresponding values (corresponding values in the array)
public static getTotal ( string $term ) : integer
$term string The search term (simple search) or the fields to search for (advanced search - please note that the field names may not be consistent throughout several modules).
Résultat integer

save() public static méthode

Save a search
public static save ( array $item )
$item array The data to store.

statusIndex() public static méthode

Deactivate an index (no longer has to be searched)
public static statusIndex ( string $module, array $otherIds, boolean $active = true )
$module string The module we're deleting an item from.
$otherIds array An array of other_id's for this module.
$active boolean Set the index to active?

validateSearch() public static méthode

Validate searches: check everything that has been marked as 'inactive', if should still be inactive
public static validateSearch ( )