|
Moodle
2.2.1
http://www.collinsharper.com
|
Go to the source code of this file.
Data Structures | |
| class | search_token |
| class | search_lexer |
| class | search_parser |
Namespaces | |
| namespace | core |
| namespace | moodlecore |
Enumerations | |
| enum | TOKEN_USER |
| enum | TOKEN_META |
| enum | TOKEN_EXACT |
| enum | TOKEN_NEGATE |
| enum | TOKEN_STRING |
| enum | TOKEN_USERID |
| enum | TOKEN_DATEFROM |
| enum | TOKEN_DATETO |
| enum | TOKEN_INSTANCE |
Functions | |
| search_generate_text_SQL ($parsetree, $datafield, $metafield, $mainidfield, $useridfield, $userfirstnamefield, $userlastnamefield, $timefield, $instancefield) | |
| search_generate_SQL ($parsetree, $datafield, $metafield, $mainidfield, $useridfield, $userfirstnamefield, $userlastnamefield, $timefield, $instancefield) | |
| enum TOKEN_DATEFROM |
Definition at line 38 of file searchlib.php.
| enum TOKEN_DATETO |
Definition at line 39 of file searchlib.php.
| enum TOKEN_EXACT |
Definition at line 34 of file searchlib.php.
| enum TOKEN_INSTANCE |
Definition at line 40 of file searchlib.php.
| enum TOKEN_META |
Definition at line 33 of file searchlib.php.
| enum TOKEN_NEGATE |
Definition at line 35 of file searchlib.php.
| enum TOKEN_STRING |
Definition at line 36 of file searchlib.php.
| enum TOKEN_USER |
Definition at line 32 of file searchlib.php.
| enum TOKEN_USERID |
Definition at line 37 of file searchlib.php.
| search_generate_SQL | ( | $ | parsetree, |
| $ | datafield, | ||
| $ | metafield, | ||
| $ | mainidfield, | ||
| $ | useridfield, | ||
| $ | userfirstnamefield, | ||
| $ | userlastnamefield, | ||
| $ | timefield, | ||
| $ | instancefield | ||
| ) |
Primitive function to generate a SQL string from a parse tree. Parameters:
$parsetree should be a parse tree generated by a search_lexer/search_parser combination. Other fields are database table names to search.
object object
Under Oracle and MSSQL, transform TOKEN searches into STRING searches and trim +- chars
Definition at line 497 of file searchlib.php.

| search_generate_text_SQL | ( | $ | parsetree, |
| $ | datafield, | ||
| $ | metafield, | ||
| $ | mainidfield, | ||
| $ | useridfield, | ||
| $ | userfirstnamefield, | ||
| $ | userlastnamefield, | ||
| $ | timefield, | ||
| $ | instancefield | ||
| ) |
Primitive function to generate a SQL string from a parse tree using TEXT indexes. If searches aren't suitable to use TEXT this function calls the default search_generate_SQL() one.
$parsetree should be a parse tree generated by a search_lexer/search_parser combination. Other fields are database table names to search.
object object
First of all, search for reasons to switch to standard SQL generation Only mysql are supported for now
Some languages don't have "word separators" and MySQL FULLTEXT doesn't perform well with them, so switch to standard SQL search generation
Here we'll acumulate non-textual tokens
If it's a multiword token, quote it
Simple word token, search for it as prefix
token must be exactly as requested
token must not exist as prefix
token in metafield, search for it as prefix
delegate to standard search
Call to standard search for pending tokens
Build the final SQL clause
Must have $datafield to search within
And optionally $metafield
Begin with the AGAINST clause
Add the search terms
Close AGAINST clause
Now add the metasearch_clause
Must have $metafield to search within
AND operator if needed
Begin with the AGAINST clause
Add the search terms
Close AGAINST clause
Finally add the non-text conditions
AND operator if needed
Definition at line 355 of file searchlib.php.

