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 ()
 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 = '1'
 $operator_translate_table
 $sword_array
 $queryParts
 $other_where_clauses
 $fTable
 $res_offset = 0
 $res_shows = 20
 $res_count
 $pageIdList = ''
 $listOfSearchFields = ''

Detailed Description

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


Member Function Documentation

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

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

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

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

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

Definition at line 288 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)

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

Definition at line 374 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)

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

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

tslib_search::count_query  ) 
 

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

Returns:
boolean True, if $this->query was found

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

tslib_search::count_query  ) 
 

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

Returns:
boolean True, if $this->query was found

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

tslib_search::execute_query  ) 
 

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

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

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

tslib_search::execute_query  ) 
 

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

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

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

tslib_search::explodeCols in  ) 
 

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

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

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

tslib_search::explodeCols in  ) 
 

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

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

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

Referenced by register_tables_and_columns().

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).

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

Definition at line 416 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).

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

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

Referenced by register_and_explode_search_string().

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.

Returns:
string URL-parameters with the searchwords

Definition at line 465 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.

Returns:
string URL-parameters with the searchwords

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

tslib_search::get_searchwordsArray  ) 
 

Returns an array with the search words in

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

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

tslib_search::get_searchwordsArray  ) 
 

Returns an array with the search words in

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

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

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.

Parameters:
string String to pass through quotemeta()
Returns:
string Return value

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

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.

Parameters:
string String to pass through quotemeta()
Returns:
string Return value

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

Referenced by split().

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

Parameters:
string The input search-word string.
Returns:
void

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

References get_operator(), and split().

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

Parameters:
string The input search-word string.
Returns:
void

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

References get_operator(), and split().

tslib_search::register_tables_and_columns requestedCols,
allowedCols
 

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.

Parameters:
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.
Returns:
void

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

References explodeCols().

tslib_search::register_tables_and_columns requestedCols,
allowedCols
 

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.

Parameters:
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.
Returns:
void

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

References explodeCols().

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.

Parameters:
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)
Returns:
mixed Returns an ARRAY if there were search words, othervise the return value may be unset.

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

References quotemeta().

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.

Parameters:
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)
Returns:
mixed Returns an ARRAY if there were search words, othervise the return value may be unset.

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

References quotemeta().

Referenced by register_and_explode_search_string().


Member Data Documentation

tslib_search::$operator_translate_table
 

Initial value:

 Array (                                        // case-sensitiv. Defineres the words, which will be operators between words
                Array ('+' , 'AND'),
                Array ('-' , 'AND NOT'),
                        // english
                Array ('AND' , 'AND'),
                Array ('OR' , 'OR'),
                Array ('NOT' , 'AND NOT'),
                        // danish
                Array ('OG' , 'AND'),
                Array ('ELLER' , 'OR'),
                Array ('UDEN' , 'AND NOT')
        )

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


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


Généré par L'expert TYPO3 avec  doxygen 1.4.6