Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
Search_Manager_Plugin_OCI Class Reference

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)
 

Detailed Description

Definition at line 32 of file search_manager_plugin_oci.inc.

Member Function Documentation

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

Parameters
Search_Manager$smThe search manager
string$columnthe column with the ctx_context index
string$termsthe terms from the text box (unquoted)
string$word_logicoperator to use for intra-word logic
string$scorethe score to use in the score() function
string$exactwhether to require an exact match
Returns
mixed string|boolean private

Definition at line 1022 of file search_manager_plugin_oci.inc.

_escapeContainReservedChars (   $word)

Returns words with reserved characters escaped for used within "contains" queries.

Parameters
string$wordthe word to be escaped
Returns
string private

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!

Parameters
string$wordthe word to be escaped
Returns
string private

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

Parameters
string$date1the left date operand
string$date2the right date operand
string$operatorthe operator to perform the comparison with
Returns
string private

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.

Parameters
string&$termsthe terms string
boolean$remove_stop_wordsif TRUE stop words will be removed from the terms string
boolean$return_stop_wordsif TRUE stop words will be returned in the list
boolean$replaceif 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_charsa list of characters that will be ignored and not added to the words array nor stripped from the $terms list
Returns
array private

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

Parameters
string&$termsthe terms
Returns
boolean private

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

Parameters
string&$termsthe terms
Returns
boolean private

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

Parameters
string&$termsthe terms
string$word_logicoperator to use for intra-word logic
Returns
boolean private

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

Parameters
string$termsthe terms
boolean$clearif TRUE the operators are replaced with space
Returns
string private

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

Parameters
array$search_infoan array of search settings
Returns
array public
See Also
Search_Manager::processSearch(), general_occasional.inc::implode_sql()

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

Parameters
object&$assetThe asset whose keywords are to be extracted
boolean$include_metadataIf FALSE, metadata components are excluded
boolean$include_scoresDetermines whether scores are returned (TRUE) or just the keywords (FALSE)
Returns
array public

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

Parameters
string | array$wordsA string of words, or an array of string
Returns
array public

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

Parameters
string$source_idID of the asset
string$typetype of the asset to restrict the search by
Returns
array public

Definition at line 1168 of file search_manager_plugin_oci.inc.

getMaxWordLength ( )

Get the maximum size of a search index field

Returns
mixed int|NULL public

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

Parameters
object&$search_listthe reference to Search List Page asset
object&$search_pagethe reference to Search Page asset
Returns
array public

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

Parameters
string$search_stringthe terms string
Returns
array private

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.

Parameters
string$valuesemi-colon separated list of selected values
Returns
string public

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.

Parameters
string&$smThe search manager
array$date_rangeRange of dates to search for
array$data_sourceDetails of the data source to search in
array$base_queryThe base of the sql query to use
Returns
void private

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.

Parameters
string&$smThe search manager
string$search_termWord to search for
array$base_queryThe base of the sql query to use
Returns
array public

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.

Parameters
string&$smThe search manager
array$numeric_rangeRange of numbers to search for
array$data_sourceDetails of the data source to search in
array$base_queryThe base of the sql query to use
Returns
void private

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.

Parameters
string&$smThe search manager
string$search_termWord to search for
array$data_sourceDetails of the data source to search in
array$base_queryThe base of the sql query to use
string$word_logicoperator to use for intra-word logic
Returns
array public

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.

Parameters
string$contentsThe contents
string$type_codeThe type code
string$data_typeThe data type
string$componentThe component
string$weightingThe weighting
mixed(int|string) $contextid The contextid (or 'default' if not contextable)
boolean$use_defaultTRUE indicates this is a default value
Returns
array public

Definition at line 664 of file search_manager_plugin_oci.inc.


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