PHP Класс Contao\Search

The class takes the HTML markup of a page, exctracts the content and writes it to the database (search index). It also provides a method to query the seach index, returning the matching entries. Usage: Search::indexPage($objPage->row()); $result = Search::searchFor('keyword'); while ($result->next()) { echo $result->url; }
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$objInstance Search Object instance (Singleton)

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

Метод Описание
__clone ( ) Prevent cloning of the object (Singleton)
getInstance ( ) : Search Return the object instance (Singleton)
indexPage ( array $arrData ) : boolean Index a page
removeEntry ( string $strUrl ) Remove an entry from the search index
searchFor ( string $strKeywords, boolean $blnOrSearch = false, array $arrPid = [], integer $intRows, integer $intOffset, boolean $blnFuzzy = false ) : Result Search the index and return the result object

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

__clone() закрытый публичный Метод

Prevent cloning of the object (Singleton)
Устаревший: Deprecated since Contao 4.0, to be removed in Contao 5.0. The Search class is now static.
final public __clone ( )

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

Return the object instance (Singleton)
Устаревший: Deprecated since Contao 4.0, to be removed in Contao 5.0. The Search class is now static.
public static getInstance ( ) : Search
Результат Search The object instance

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

Index a page
public static indexPage ( array $arrData ) : boolean
$arrData array The data array
Результат boolean True if a new record was created

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

Remove an entry from the search index
public static removeEntry ( string $strUrl )
$strUrl string The URL to be removed

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

Search the index and return the result object
public static searchFor ( string $strKeywords, boolean $blnOrSearch = false, array $arrPid = [], integer $intRows, integer $intOffset, boolean $blnFuzzy = false ) : Result
$strKeywords string The keyword string
$blnOrSearch boolean If true, the result can contain any keyword
$arrPid array An optional array of page IDs to limit the result to
$intRows integer An optional maximum number of result rows
$intOffset integer An optional result offset
$blnFuzzy boolean If true, the search will be fuzzy
Результат Contao\Database\Result The database result object

Описание свойств

$objInstance защищенное статическое свойство

Object instance (Singleton)
protected static Search,contao $objInstance
Результат Search