Documentation TYPO3 par Ameos

tslib_search Class Reference

List of all members.

Public Member Functions

 register_tables_and_columns ($requestedCols, $allowedCols)
 explodeCols ($in)
 register_and_explode_search_string ($sword)
 split ($origSword, $specchars='+-', $delchars='+.,-')
 quotemeta ($str)
 build_search_query ($endClause)
 build_search_query_for_searchwords ()
 get_operator ($operator)
 count_query ()
 execute_query ()
 get_searchwords ()
 get_searchwordsArray ()

Public Attributes

 $tables = Array ()
 $group_by = 'PRIMARY_KEY'
 $default_operator = 'AND'
 $operator_translate_table_caseinsensitive = TRUE
 $res_offset = 0
 $res_shows = 20
 $pageIdList = ''
 $listOfSearchFields = ''

Detailed Description

Definition at line 88 of file class.tslib_search.php.

Member Function Documentation

tslib_search::register_tables_and_columns ( requestedCols,

Creates the $this->tables-array. The 'pages'-table is ALWAYS included as the search is page-based. Apart from this there may be one and only one table, joined with the pages-table. This table is the first table mentioned in the requested-list. If any more tables are set here, they are ignored.

string is a list (-) of columns that we want to search. This could be input from the search-form (see TypoScript documentation)
string $allowedCols: is the list of columns, that MAY be searched. All allowed cols are set as result-fields. All requested cols MUST be in the allowed-fields list.

Definition at line 127 of file class.tslib_search.php.

References explodeCols().

tslib_search::explodeCols ( in  ) 

Function that can convert the syntax for entering which tables/fields the search should be conducted in.

string This is the code-line defining the tables/fields to search. Syntax: '[table1].[field1]-[field2]-[field3] : [table2].[field1]-[field2]'
array An array where the values is "[table].[field]" strings to search
See also:

Definition at line 168 of file class.tslib_search.php.

Referenced by register_tables_and_columns().

tslib_search::register_and_explode_search_string ( sword  ) 

Takes a search-string (WITHOUT SLASHES or else it'll be a little sppooky , NOW REMEMBER to unslash!!) Sets up $this->sword_array op with operators. This function uses $this->operator_translate_table as well as $this->default_operator

string The input search-word string.

Definition at line 193 of file class.tslib_search.php.

References get_operator(), and split().

tslib_search::split ( origSword,
specchars = '+-',
delchars = '+.,

Used to split a search-word line up into elements to search for. This function will detect boolean words like AND and OR, + and -, and even find sentences encapsulated in "" This function could be re-written to be more clean and effective - yet it's not that important.

string The raw sword string from outside
string Special chars which are used as operators (+- is default)
string Special chars which are deleted if the append the searchword (+-., is default)
mixed Returns an ARRAY if there were search words, othervise the return value may be unset.

Definition at line 226 of file class.tslib_search.php.

References quotemeta().

Referenced by register_and_explode_search_string().

tslib_search::quotemeta ( str  ) 

Local version of quotemeta. This is the same as the PHP function but the vertical line, |, and minus, -, is also escaped with a slash.

string String to pass through quotemeta()
string Return value

Definition at line 269 of file class.tslib_search.php.

Referenced by split().

tslib_search::build_search_query ( endClause  ) 

This creates the search-query. In TypoScript this is used for searching only records not hidden, start/endtimed and fe_grouped! (enable-fields, see tt_content) Sets $this->queryParts

string $endClause is some extra conditions that the search must match.
boolean Returns true no matter what - sweet isn't it! private
See also:

Definition at line 285 of file class.tslib_search.php.

tslib_search::build_search_query_for_searchwords (  ) 

Creates the part of the SQL-sentence, that searches for the search-words ($this->sword_array)

string Part of where class limiting result to the those having the search word. private

Definition at line 371 of file class.tslib_search.php.

tslib_search::get_operator ( operator  ) 

This returns an SQL search-operator (eg. AND, OR, NOT) translated from the current localized set of operators (eg. in danish OG, ELLER, IKKE).

string The possible operator to find in the internal operator array.
string If found, the SQL operator for the localized input operator. private

Definition at line 413 of file class.tslib_search.php.

Referenced by register_and_explode_search_string().

tslib_search::count_query (  ) 

Counts the results and sets the result in $this->res_count

boolean True, if $this->query was found

Definition at line 436 of file class.tslib_search.php.

tslib_search::execute_query (  ) 

Executes the search, sets result pointer in $this->result

boolean True, if $this->query was set and query performed

Definition at line 449 of file class.tslib_search.php.

tslib_search::get_searchwords (  ) 

Returns URL-parameters with the current search words. Used when linking to result pages so that search words can be highlighted.

string URL-parameters with the searchwords

Definition at line 462 of file class.tslib_search.php.

tslib_search::get_searchwordsArray (  ) 

Returns an array with the search words in

array IF the internal sword_array contained search words it will return these, otherwise "void"

Definition at line 477 of file class.tslib_search.php.

Member Data Documentation


Initial value:

 Array (                                        // case-sensitiv. Defineres the words, which will be operators between words
                Array ('+' , 'AND'),
                Array ('|' , 'AND'),
                Array ('-' , 'AND NOT'),
                        // english
                Array ('and' , 'AND'),
                Array ('or' , 'OR'),
                Array ('not' , 'AND NOT'),

Definition at line 94 of file class.tslib_search.php.

The documentation for this class was generated from the following file:

Généré par Le spécialiste TYPO3 avec  doxygen 1.4.6