PHP Класс Frontend\Modules\Search\Engine\Model

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Описание методов

buildTerm() публичный статический Метод

Build the search term
public static buildTerm ( array $terms ) : array
$terms array The string to build.
Результат array

execSearch() публичный статический Метод

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.
Результат array

getStartsWith() публичный статический Метод

..
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.
Результат array

getSynonyms() публичный статический Метод

Get synonyms
public static getSynonyms ( string $term ) : array
$term string The term to get synonyms for.
Результат array

getTotal() публичный статический Метод

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).
Результат integer

save() публичный статический Метод

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

statusIndex() публичный статический Метод

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() публичный статический Метод

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