Squiz Matrix
4.12.2
|
Public Member Functions | |
processWordSearch (&$sm, $search_term, $data_source, $base_query, $word_logic='AND') | |
processNumericSearch (&$sm, $numeric_range, $data_source, $base_query) | |
processDateSearch (&$sm, $date_range, $data_source, $base_query) | |
processExcludeQuery (&$sm, $search_term, $base_query) | |
constructBaseSearchQuery ($search_info) | |
extractKeywords (&$asset, $include_metadata=FALSE, $include_scores=FALSE) | |
generateWordList ($words) | |
splitIndexableContent ($contents, $type_code, $data_type, $component, $weighting, $contextid, $use_default) | |
handleMultipleMetadataSelect ($value) | |
_parseBrackets (&$terms) | |
_parseOperators (&$terms) | |
_parseTerms (Search_Manager $sm, &$terms, $word_logic) | |
_replaceOperators ($terms, $clear=FALSE) | |
_getWords (&$terms, $remove_stop_words=FALSE, $return_stop_words=FALSE, $replace=FALSE, $ignore_chars=Array()) | |
_buildContainsQuery (Search_Manager $sm, $column, $terms, $word_logic='AND', $score=1, $exact=FALSE) | |
_getDateCompareWithClobSql ($date1, $date2, $operator='=') | |
getAssetidsByWordIntersection ($source_id, $type=NULL) | |
getMaxWordLength () | |
_escapeContainReservedWords ($word) | |
_escapeContainReservedChars ($word) | |
getWords ($search_string) | |
getSearchListAssets (&$search_list, &$search_page) | |
Definition at line 32 of file search_manager_plugin_oci.inc.
_buildContainsQuery | ( | Search_Manager | $sm, |
$column, | |||
$terms, | |||
$word_logic = 'AND' , |
|||
$score = 1 , |
|||
$exact = FALSE |
|||
) |
Builds sql to perform a contains query using the ctx_sys.contains function in the oracle text package.
Note that if the length of terms is > 252 characters, the CONTAINS function will not be used (due to CONTAINS itself having a 255 character limit) and will switch to LIKE instead. This is lot slower than the text package function but avoids the possible truncation.
Search_Manager | $sm | The search manager |
string | $column | the column with the ctx_context index |
string | $terms | the terms from the text box (unquoted) |
string | $word_logic | operator to use for intra-word logic |
string | $score | the score to use in the score() function |
string | $exact | whether to require an exact match |
Definition at line 1022 of file search_manager_plugin_oci.inc.
_escapeContainReservedChars | ( | $word | ) |
Returns words with reserved characters escaped for used within "contains" queries.
string | $word | the word to be escaped |
Definition at line 1303 of file search_manager_plugin_oci.inc.
_escapeContainReservedWords | ( | $word | ) |
Returns words that are reserved within contains queries escaped with {}'s Because all contains queries are currently done with all lower case strings this function assumes keywords will be in lowercase!
string | $word | the word to be escaped |
Definition at line 1256 of file search_manager_plugin_oci.inc.
_getDateCompareWithClobSql | ( | $date1, | |
$date2, | |||
$operator = '=' |
|||
) |
Returns sql for comparing a CLOB field with a date string
string | $date1 | the left date operand |
string | $date2 | the right date operand |
string | $operator | the operator to perform the comparison with |
Definition at line 1152 of file search_manager_plugin_oci.inc.
_getWords | ( | & | $terms, |
$remove_stop_words = FALSE , |
|||
$return_stop_words = FALSE , |
|||
$replace = FALSE , |
|||
$ignore_chars = Array() |
|||
) |
Returns the words contained within the terms string.
string | &$terms | the terms string |
boolean | $remove_stop_words | if TRUE stop words will be removed from the terms string |
boolean | $return_stop_words | if TRUE stop words will be returned in the list |
boolean | $replace | if TRUE the words will be replaced with a # for building generalization strings. Non-indexable words will be stripped completely instead of being #'d. |
array | $ignore_chars | a list of characters that will be ignored and not added to the words array nor stripped from the $terms list |
Definition at line 948 of file search_manager_plugin_oci.inc.
_parseBrackets | ( | & | $terms | ) |
Parses the brackets found within the terms to ensure that all opening brackets have a closing bracket.
returns TRUE if a reparse is required
string | &$terms | the terms |
Definition at line 739 of file search_manager_plugin_oci.inc.
_parseOperators | ( | & | $terms | ) |
Parses the operators to ensure they are in valid locations and applied on valid operands
returns TRUE if a reparse is required
string | &$terms | the terms |
Definition at line 803 of file search_manager_plugin_oci.inc.
_parseTerms | ( | Search_Manager | $sm, |
& | $terms, | ||
$word_logic | |||
) |
Parses the terms to ensure the are in valid locations and have the valid operators between them
returns TRUE if a reparse is required
string | &$terms | the terms |
string | $word_logic | operator to use for intra-word logic |
Definition at line 861 of file search_manager_plugin_oci.inc.
_replaceOperators | ( | $terms, | |
$clear = FALSE |
|||
) |
Replaces the literal operator strings with their symbols or space if $clear is TRUE
string | $terms | the terms |
boolean | $clear | if TRUE the operators are replaced with space |
Definition at line 901 of file search_manager_plugin_oci.inc.
constructBaseSearchQuery | ( | $search_info | ) |
Populates a search query array given an array of search settings
Accepts the same search info array as processSearch() Does not put the search index table or anything like that in the query Returns components of search query in a format ready for implode_sql()
array | $search_info | an array of search settings |
Definition at line 432 of file search_manager_plugin_oci.inc.
extractKeywords | ( | & | $asset, |
$include_metadata = FALSE , |
|||
$include_scores = FALSE |
|||
) |
Extracts keywords from the indexing table and ranks them in order of descending importance
If $include_scores is TRUE, the returned array is of (keyword => score). If it is FALSE, the array is of (keyword) without any particular key
object | &$asset | The asset whose keywords are to be extracted |
boolean | $include_metadata | If FALSE, metadata components are excluded |
boolean | $include_scores | Determines whether scores are returned (TRUE) or just the keywords (FALSE) |
Definition at line 565 of file search_manager_plugin_oci.inc.
generateWordList | ( | $words | ) |
Breaks apart a string into a list of words so the search manager can use it
For Oracle, we actually don't want to break up the string, so that Oracle Text can have a look at the whole string. So we return the word string back as a single element array
string | array | $words | A string of words, or an array of string |
Definition at line 629 of file search_manager_plugin_oci.inc.
getAssetidsByWordIntersection | ( | $source_id, | |
$type = NULL |
|||
) |
Get ids of assets having same words as the supplied asset
string | $source_id | ID of the asset |
string | $type | type of the asset to restrict the search by |
Definition at line 1168 of file search_manager_plugin_oci.inc.
getMaxWordLength | ( | ) |
Get the maximum size of a search index field
Definition at line 1239 of file search_manager_plugin_oci.inc.
getSearchListAssets | ( | & | $search_list, |
& | $search_page | ||
) |
Get the list of assets to be printed in Search List Page
object | &$search_list | the reference to Search List Page asset |
object | &$search_page | the reference to Search Page asset |
Definition at line 1341 of file search_manager_plugin_oci.inc.
getWords | ( | $search_string | ) |
External access to function that gets the list of search terms from the search string
string | $search_string | the terms string |
Definition at line 1325 of file search_manager_plugin_oci.inc.
handleMultipleMetadataSelect | ( | $value | ) |
Returns the content to be indexed for a multiple metadata select value
By default, values will be stored as a semi-colon separated list; just send that back if you don't want that changed.
string | $value | semi-colon separated list of selected values |
Definition at line 712 of file search_manager_plugin_oci.inc.
processDateSearch | ( | & | $sm, |
$date_range, | |||
$data_source, | |||
$base_query | |||
) |
Search for a date range in a particular data source
The $date_range field is a two-value array containing 'from' and 'to' keys. Specifying both will make it a "between" query. Specifying one and leaving the other as NULL will make it a greater/less than (or equal to) query. If both 'from' and 'to' are NULL, then no condition is imposed, and it degenerates into the base query.
string | &$sm | The search manager |
array | $date_range | Range of dates to search for |
array | $data_source | Details of the data source to search in |
array | $base_query | The base of the sql query to use |
Definition at line 278 of file search_manager_plugin_oci.inc.
processExcludeQuery | ( | & | $sm, |
$search_term, | |||
$base_query | |||
) |
Search for terms in all components
This can be used for an include all or exclude search - Search Manager will likely use it for the latter.
string | &$sm | The search manager |
string | $search_term | Word to search for |
array | $base_query | The base of the sql query to use |
Definition at line 360 of file search_manager_plugin_oci.inc.
processNumericSearch | ( | & | $sm, |
$numeric_range, | |||
$data_source, | |||
$base_query | |||
) |
Search for a numeric range in a particular data source
The $numeric_range field is a two-value array containing 'lower' and 'upper' keys. If both are filled, then it is handled as a 'BETWEEN' query. If one is NULL, then it is handled as a 'greater than' or 'less than' query, depending on which one is NULL. If both are NULL, then no condition is imposed, and it degenerates into the base query.
string | &$sm | The search manager |
array | $numeric_range | Range of numbers to search for |
array | $data_source | Details of the data source to search in |
array | $base_query | The base of the sql query to use |
Definition at line 186 of file search_manager_plugin_oci.inc.
processWordSearch | ( | & | $sm, |
$search_term, | |||
$data_source, | |||
$base_query, | |||
$word_logic = 'AND' |
|||
) |
Processes a search for a particular word in a particular data source
Return value is based on what has been set as the 'select' fields in the base query ($base_query). Typically this will be (keyword => score) but this can obviously be changed.
string | &$sm | The search manager |
string | $search_term | Word to search for |
array | $data_source | Details of the data source to search in |
array | $base_query | The base of the sql query to use |
string | $word_logic | operator to use for intra-word logic |
Definition at line 52 of file search_manager_plugin_oci.inc.
splitIndexableContent | ( | $contents, | |
$type_code, | |||
$data_type, | |||
$component, | |||
$weighting, | |||
$contextid, | |||
$use_default | |||
) |
Returns the indexable content for the specified asset's attributes
In Oracle-based systems, for Oracle Text's OR searching to work properly, attribute content is indexed as a whole, rather than being broken up into separate words.
string | $contents | The contents |
string | $type_code | The type code |
string | $data_type | The data type |
string | $component | The component |
string | $weighting | The weighting |
mixed | (int|string) $contextid The contextid (or 'default' if not contextable) | |
boolean | $use_default | TRUE indicates this is a default value |
Definition at line 664 of file search_manager_plugin_oci.inc.