Back to the module list

The Full Text Search

The Full Text Search permit to found some data in a database based on a user query (like the search engines in the web).


$fts = new fts ();
$res = $fts->search ("\"ABC KLM\" XYZ");

The class definition

Class \fts

Namespace \


 The Full Text Search
 Analyze the provided search text (like a search engine), and create the
 sql query to found the answer.
 Manage the sentences (enclosed in quotes), or the standalone words,
 Manage the non wanted field (beginning by -),
 Do not search if the word is smaller than a parameter.


public $minLength=3;
 The minimum length of a token to search


public function __construct ()
 The constructor check the availability of the MB module

public function getRegexes ()
 Get the regexes defined after the analyzer

public function getTokens ()
 Get the tokens store after the search

public function getTokensMin ()
 Get the tokens store after the search, without the too small ones

public function search ( $query)
 Search the text provided in $query in the database
 @param string $query The text to found in the database
 @return array The operator and the associated regex value to search

public function searchSQL ( $query, $dblayeroo, $fields)
 Search in SQL
 @param string $query The text to found in the database
 @param object $dblayeroo The dblayeroo object to query
 @param array|null $fields The fields in $dblayeroo to look for data. If
 null, look in all the fields defined in the dblayeroo object
 @return array The result of the query