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

Public Member Functions

 __construct ()
 
 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)
 
 getAssetidsByWordIntersection ($source_id, $type=NULL)
 
 getMaxWordLength ()
 
 getWords ($search_string)
 
 getSearchListAssets (&$search_list, &$search_page)
 

Detailed Description

Definition at line 29 of file search_manager_plugin_pgsql.inc.

Constructor & Destructor Documentation

__construct ( )

Constructor

Definition at line 40 of file search_manager_plugin_pgsql.inc.

Member Function Documentation

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 448 of file search_manager_plugin_pgsql.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 610 of file search_manager_plugin_pgsql.inc.

generateWordList (   $words)

Generates a word list from the search string

Parameters
string$wordsthe words string
Returns
array public

Definition at line 662 of file search_manager_plugin_pgsql.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 783 of file search_manager_plugin_pgsql.inc.

getMaxWordLength ( )

Get the maximum size of a search index field

Returns
int public

Definition at line 821 of file search_manager_plugin_pgsql.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 853 of file search_manager_plugin_pgsql.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 837 of file search_manager_plugin_pgsql.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 767 of file search_manager_plugin_pgsql.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
object&$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 310 of file search_manager_plugin_pgsql.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
object&$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 397 of file search_manager_plugin_pgsql.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
object&$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 217 of file search_manager_plugin_pgsql.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.

A NULL result means the word was skipped due to not having been indexable in the first place. Terms returning NULL should be ignored for word logic purposes in the Search Manager. A NULL result will never occur for data sources of metadata selection type (including multiple text and hierarchy)

  • this allows all options to be searched regardless of length.
Parameters
object&$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 (IGNORED in PostgreSQL as the words are already split up)
Returns
mixed array|NULL public

Definition at line 86 of file search_manager_plugin_pgsql.inc.

splitIndexableContent (   $contents,
  $type_code,
  $data_type,
  $component,
  $weighting,
  $contextid,
  $use_default 
)

Returns the indexable content for the specified asset's attributes

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 698 of file search_manager_plugin_pgsql.inc.


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