Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
Search_Manager Class Reference
Inheritance diagram for Search_Manager:
Asset MySource_Object

Public Member Functions

 __construct ($assetid=0)
 
 create (Array &$link)
 
 _getName ($short_name=FALSE)
 
 canDelete ()
 
 canClone ()
 
 onAssetUpdate (&$broadcaster, $vars=Array())
 
 onAssetCreate (&$broadcaster, $vars=Array())
 
 onAssetStatusUpdate (&$broadcaster, $vars=Array())
 
 onAttributeChange (&$broadcaster, $vars=Array())
 
 onContentsUpdated (&$broadcaster, $vars=Array())
 
 onAssetDeleted (&$broadcaster, $vars=Array())
 
 onContextDelete (&$broadcaster, $vars=Array())
 
 reindexAsset (&$asset, $vars=Array())
 
 reindexAttributes (&$asset, $vars=Array(), $all_contexts=FALSE)
 
 reindexContents (&$asset, $vars=Array(), $all_contexts=FALSE)
 
 getIndexingAssetid (&$asset)
 
 getIndexableAssetContent (&$asset, $changed_vars)
 
 getIndexableAttributeContent (&$asset, $changed_vars, $all_contexts=TRUE)
 
 getIndexableContent (&$asset)
 
 addIndexableContent ($assetid, &$index_content)
 
 flushIndexableContent ($assetid, $components=Array(), $contextids=NULL)
 
 flushDefaultIndexableContent ($assetid, $components=Array())
 
 getIndexedComponents ($assetid)
 
 getAssetidsByWordIntersection ($source_id, $type=NULL)
 
 getIndexableAssetComponents ()
 
 getIndexableAttributes ($type_code)
 
 isAttributeIndexable ($attrid)
 
 isAssetIndexable ($assetid)
 
 isWordIndexable ($word)
 
 _getRawNumberInText ($value)
 
 onMetadataUpdate (&$broadcaster, $vars=Array())
 
 onMetadataDeleted (&$broadcaster, $vars=Array())
 
 reindexMetadata ($assetid, $vars=Array(), $all_contexts=FALSE)
 
 getIndexableMetadataContent (&$asset, $fieldids=Array(), $all_contexts=TRUE)
 
 getWeightings ($assetid)
 
 getMetadataWeighting ($assetid, $fieldid)
 
 _getLocalMetadataWeightings ($weightings, $fieldid, $sectionid, $schemaids)
 
 getAssetTypeWeightings ($type_code=NULL, $strict_type_code=FALSE)
 
 getAssetTreeWeightings ($assetid=NULL, $strict_assetid=TRUE, $strict_type_code=FALSE, $type_weights_only=TRUE, $include_global_weights=TRUE)
 
 saveAssetTreeWeightings ($asset_tree_weightings)
 
 getAssetWeightings ($assetid=NULL)
 
 saveAssetWeightings ($asset_weightings)
 
 getMetadataWeightings ($assetid=NULL)
 
 saveMetadataWeightings ($metadata_weightings)
 
 _saveWeightings ($weightings, $type)
 
 extractKeywords (&$asset, $include_metadata=FALSE, $include_scores=FALSE)
 
 _strip_tags ($tags, $contents)
 
 generateWordList ($words)
 
 processSearch ($search_info, $include_context=FALSE)
 
 _prepareSearchField (&$field_details)
 
 _processWordSearch ($search_term, $data_source, $base_query, $word_logic='AND')
 
 _processDateSearch ($date_range, $data_source, $base_query)
 
 _processNumericSearch ($numeric_range, $data_source, $base_query)
 
 _combineResults ($results_so_far, $new_results, $logic)
 
 processBasicSearch ($search_info)
 
 spellCheckWord ($word, $language=SQ_TOOL_SPELL_CHECKER_LANG)
 
 spellCheckAvailable ()
 
 constructBaseSearchQuery ($search_info)
 
 combineAssetScores ($asset_scores1, $asset_scores2, $logic='AND', $word=NULL)
 
 getNoiseWords ()
 
 getWhiteWords ()
 
 isNoiseWord ($word)
 
 isWhiteWord ($word)
 
 getMinWordLength ()
 
_getDBPlugin ()
 
 getCondensedResults ($results)
 
 getFormattedResults ($results, $search_string, $full_content=TRUE)
 
- Public Member Functions inherited from Asset
 Asset ($assetid=0)
 
 create (Array &$link)
 
 load ($assetid)
 
 _loadDataPaths ()
 
 reload ()
 
 canDelete ()
 
 delete ($release_lock=TRUE, $check_locked=TRUE)
 
 useSystemVersion ()
 
 loadSystemVersion ()
 
 saveSystemVersion ()
 
 clearSystemVersion ()
 
 revertToSystemVersion ()
 
 revertNoticeLinksToSystemVersion ()
 
 _updated ($update_parents=TRUE)
 
 type ()
 
 getTypeAncestors ($include_asset=TRUE)
 
 incrementVersion ($number='micro', $update_parents=TRUE)
 
 getLanguages ()
 
 setLanguages (Array $languages)
 
 setCharset ($charset)
 
 setForceSecure ($force_secure)
 
 remapAssetids (Array $map)
 
 morph ($new_type_code)
 
 _morphCleanup ($new_type_code)
 
 onRequestKeywords (Asset $broadcaster, Array $vars=Array())
 
 canClone ()
 
 cloneComponents (Asset $clone, Array $components, $override=FALSE)
 
 cloneComponentsAdditional (Asset $clone, Array $components)
 
 cloneLinks (Asset $clone)
 
 getStatus ()
 
 getAvailableStatii ()
 
 getStatusDescription ()
 
 processStatusChange ($new_status, $update_parents=TRUE, $run_updated=TRUE)
 
 setDate ($date_type, $time=NULL, $userid=NULL)
 
 lockTypes ()
 
 canForceablyAcquireLock ($lock_type)
 
 getEditingLocks ($keywords)
 
 _getAllowedLinks ()
 
 createLink (Asset $minor, $link_type, $value='', $sort_order=NULL, $dependant='0', $exclusive='0', $moving=FALSE, $locked=0)
 
 prepareLink (Asset $asset, $side_of_link, &$link_type, &$value, &$sort_order, &$dependant, &$exclusive)
 
 canCreateLink (Asset $minor, $link_type, $exclusive)
 
 canMoveLink (Asset $minor, Asset $old_major, $link_type)
 
 describeLink ($linkid)
 
 isDeletableLink ($linkid)
 
 canDeleteLink ($linkid)
 
 deleteLink ($linkid, $check_locked=TRUE)
 
 linksUpdated ()
 
 canCloneLink ()
 
 saveAttributes ($dont_run_updated=FALSE, $log_message=TRUE)
 
 setAttrValue ($name, $value)
 
 attr ($name)
 
attrByRef ($name)
 
 getAttribute ($name, $mute_errors=FALSE)
 
 getAssetKeywords ($descriptions=FALSE)
 
 getAvailableKeywords ()
 
 getKeywordReplacement ($keyword)
 
 getAssetWebPathKeywordReplacement ()
 
 getCustomKeywordReplacements ($keywords=Array(), $invoke_backend=FALSE)
 
 processCustomKeywords ($keywords=Array())
 
 getContent ()
 
 setContent ()
 
 getEffectiveLastUpdatedTime ($assetids)
 
 readAccess (Array $assetids=Array())
 
 writeAccess ($lock_type='', Array $assetids=Array(), $only_workflow=TRUE)
 
 adminAccess ($lock_type='', Array $assetids=Array())
 
 backendAccess ()
 
 liveEditAccess ($lock_type)
 
 canliveEdit ($lock_type)
 
 effectiveUnrestricted ()
 
 checkAccess ($perm, $lock_type, Array $assetids=Array(), $only_workflow=TRUE)
 
 accessEffective ()
 
 permissionsUpdated ()
 
 printFrontend ()
 
 printFrontendAsset (Asset $asset, $design=NULL)
 
 getValidProtocols ()
 
 printHead ()
 
 printBody ()
 
 getCurrentPaintLayoutName ()
 
 getCurrentDesignName ()
 
 printBodyWithPaintLayout ($layout_id='')
 
 initLimbo ()
 
 printLimbo ()
 
 paintBackend (Backend_Outputter $o)
 
 getPrefix ()
 
 processBackend (Backend_Outputter $o, Array &$link)
 
 getEI ()
 
 getEditFns ()
 
 getBackendHref ($screen='', $backend_page=TRUE)
 
 getURL ($base_url=NULL, $ignore_rollback=FALSE, $base_contextid=NULL)
 
 getURLs ()
 
 getHref ($base_url=NULL, $ignore_rollback=FALSE)
 
 getWebDataPath ()
 
 getWebPaths ()
 
 saveWebPaths ($paths, $auto_add_remaps=TRUE)
 
 getLookups ($field='')
 
 getDesignLookups ()
 
 getLookupValues ($inherited=NULL, $prefix='', $like_search=TRUE, $ignore_override=FALSE)
 
 deleteLookupValue ($layout_name, $layout_value)
 
 setPaintLayouts ($layouts)
 
 updateLookups ($auto_add_remaps=TRUE)
 
 setLookupValues (Array $values)
 
 getAssetStatusDescriptionKeywordReplacement ()
 
 getAssetStatusColourKeywordReplacement ()
 
 replaceKeywordsInString ($string)
 
 fastTrack ($tasks)
 
 unFastTrack ($tasks)
 
 shouldFastTrack ($task, $assetid=NULL)
 
 getFaskTrackedTaskAssetids ($task)
 
 getDependantParentsURL ()
 
- Public Member Functions inherited from MySource_Object
 MySource_Object ()
 
 __sleep ()
 
 __wakeup ()
 

Data Fields

 $standard_date_fields = NULL
 
 $standard_text_fields = NULL
 
 $_db_plugin = NULL
 
- Data Fields inherited from Asset
 $id = 0
 
 $version = ''
 
 $name = ''
 
 $short_name = ''
 
 $status
 
 $languages = ''
 
 $charset = ''
 
 $force_secure = '0'
 
 $created
 
 $created_userid
 
 $updated
 
 $updated_userid
 
 $published
 
 $published_userid
 
 $status_changed
 
 $status_changed_userid
 
 $_is_cacheable = FALSE
 
 $vars = Array()
 
 $_available_keywords = Array()
 
 $data_path_suffix = ''
 
 $data_path = ''
 
 $data_path_public = ''
 
 $_ser_attrs = FALSE
 
- Data Fields inherited from MySource_Object
 $_tmp
 

Additional Inherited Members

- Protected Member Functions inherited from Asset
 _preCreateCheck (Array &$link)
 
 _createAdditional (Array &$link)
 
 _abortCreate ($trigger_level_changed=FALSE, $linkid=0)
 
 _loadVars ()
 
 _getName ($short_name=FALSE, $contextid=NULL)
 
 _getKeywordReplacement ($keyword)
 
 _checkPermissionAccess ($perm, $assetids=Array(), $only_workflow=TRUE)
 
 makeAndSaveInitialWebPath ($path, $parent_link=NULL)
 

Detailed Description

Definition at line 31 of file search_manager.inc.

Constructor & Destructor Documentation

__construct (   $assetid = 0)

Constructor

Parameters
int$assetidthe asset id to be loaded

Definition at line 52 of file search_manager.inc.

Member Function Documentation

_combineResults (   $results_so_far,
  $new_results,
  $logic 
)

Combine new results with results so far

If $results_so_far is null, $new_results are always returned. Otherwise if logic is 'AND' the return value contains only the results that are in both the first two params, with search scores added. If logic is 'OR' then the return value contains all results that are in either of the first two params, with search scores added for common results. This function can handle results with or without context (ie getAll or getAssoc return format)

Parameters
array$results_so_farResults so far. Null if no results so far
array$new_resultsNew results
string$logic'AND'|'OR'
Returns
array public

Definition at line 2806 of file search_manager.inc.

& _getDBPlugin ( )

Gets the appropriate plugin for the database engine

Database plugins live in the plugins/[db-type] sub-folder of the Search Manager and have a class name of Search_Manager_Plugin_[db-type]

Returns
object private

Definition at line 3482 of file search_manager.inc.

_getLocalMetadataWeightings (   $weightings,
  $fieldid,
  $sectionid,
  $schemaids 
)

Returns the metadata weightings for a fieldid from the appropriate metadata asset

Drills up the metadata tree going from the field => section => schema to find any metadata weightings applicable for this field Returns the weighting for the field or false if the fieldid is not to be indexed -1 if no weighting could be found

Parameters
array$weightingsthe weightigns to search
string$fieldidthe fieldid of the metadata field
string$sectionidthe sectionid that the field is a child of
string$schemaidsthe schemaid that the section is a child of
Returns
int private

Definition at line 1830 of file search_manager.inc.

_getName (   $short_name = FALSE)

Returns name of the asset

Parameters
boolean$short_namewhether or not we are after the shortname or the full name
Returns
string private
See Also
Asset::_getName()

Definition at line 117 of file search_manager.inc.

_getRawNumberInText (   $value)

Checks to see if the specified text is just a number representation.

If the text is just a number representation, the number is returned with its spaces and delimiters stripped, otherwise the string is returned unchanged

Parameters
string$valuethe text to check
Returns
string private

Definition at line 1316 of file search_manager.inc.

_prepareSearchField ( $field_details)

Prepares the supplied search field for searching

If all datasources are of type datetime, makes sure the 'words' array is appropriately set up as a date range. Otherwise gets the words from the search string, makes them into an array and removes unindexable words. Data sources that are not properly initialised are removed

Parameters
array&$field_detailsOne entry from the 'fields' array in processSearch()'s search_info parameter
Returns
void private

Definition at line 2521 of file search_manager.inc.

_processDateSearch (   $date_range,
  $data_source,
  $base_query 
)

Search for a date range in a particular data source

Parameters
string$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 2718 of file search_manager.inc.

_processNumericSearch (   $numeric_range,
  $data_source,
  $base_query 
)

Search for a numeric range in a particular data source

Parameters
string$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 2759 of file search_manager.inc.

_processWordSearch (   $search_term,
  $data_source,
  $base_query,
  $word_logic = 'AND' 
)

Processes a search for a particular word in a particular data source

Parameters
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_logicWord logic (for DBs that don't split up their terms here, ie. Oracle)
Returns
array public

Definition at line 2677 of file search_manager.inc.

_saveWeightings (   $weightings,
  $type 
)

Saves the weightings to the specified file

Parameters
array$weightingsthe weightings to save
string$typethe type of weightings, which should be one of asset_type, asset, asset_tree
Returns
boolean private

Definition at line 2138 of file search_manager.inc.

_strip_tags (   $tags,
  $contents 
)

Strip tags by tag name

Parameters
array$tagsthe array of tag names, e.g. Array('span', 'b', 'i')
string$contentsthe string that contains tags
Returns
string the result string that has tags removed private

Definition at line 2199 of file search_manager.inc.

addIndexableContent (   $assetid,
$index_content 
)

Adds the specified index content for the specified assetid to the indexing system

Parameters
string$assetidthe assetid to index the content under
array&$index_contentthe content to index
Returns
boolean public

Definition at line 837 of file search_manager.inc.

canClone ( )

returns FALSE always because we don't want to be able to clone a search manager

Returns
boolean public

Definition at line 143 of file search_manager.inc.

canDelete ( )

Can this asset have its last significant link removed (putting it in the trash)?

Returns
boolean public

Definition at line 130 of file search_manager.inc.

combineAssetScores (   $asset_scores1,
  $asset_scores2,
  $logic = 'AND',
  $word = NULL 
)

Combines asset scores according to the passed logic

Returns a mapping from assetids to combined scores

Parameters
array$asset_scores1a mapping from assetids to scores
array$asset_scores2a mapping from assetids to scores
string$logiceither 'AND' or 'OR'
string$wordword
Returns
array private

Definition at line 3325 of file search_manager.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()

We end up with a subquery from this method which the calling code then uses to restrict which assets the search index table will look at.

We end up with something like this for the subquery: select assetid from sq_ast inner join sq_ast_lnk inner join sq_ast_lnk_tree ... where tree.node like ('starting_tree_id') and assetid in ( select assetid from sq_ast_perm ... check all permissions are ok here. )

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

This is the main query that is returned. We only need to specify the from table and alias here The select fields are worked out by the calling method based on what is being searched and what it has been set up to return.

The subquery is the part that restricts the search based on:

  • which part of the asset tree we are looking at
  • what type of assets we're searching for

This becomes part of the subquery of $subquery at the end if we are restricting based on roles/groups/permissions.

Now we've worked out all of the restrictions:

  • which area we're searching
  • what asset types we're searching for
  • permissions checks etc.. put it all together into a big subquery. This then becomes part of the main query where clause.

If/only if we are checking permissions, make the permission checking a subquery off the other sub query. No need to include this if we're not checking permissions.

Add an extra condition here. We can push the assetid check (retrieved in the outer query) into the subquery as well which speeds up permission checking

put the base permission check query together

we use it as a subquery: .. a.assetid IN ( permission_check_query )

If we're using oracle, then do an IN() query We can't use the join trick below because it gives an error about "inconsistent datatypes"

If we're using postgres, do it as a JOIN instead it gives much better performance

Definition at line 3021 of file search_manager.inc.

create ( Array &  $link)

Create this asset

Parameters
array&$linkinformation used to create the initial link
Returns
mixed int|boolean public
See Also
Asset::create()

Definition at line 81 of file search_manager.inc.

extractKeywords ( $asset,
  $include_metadata = FALSE,
  $include_scores = FALSE 
)

Extracts keywords from the indexing table and ranks them in order of descending importance

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). Affects return value.
Returns
array public

Definition at line 2180 of file search_manager.inc.

flushDefaultIndexableContent (   $assetid,
  $components = Array() 
)

Flush all 'default' indexed data for an asset

Default indexed data are values indexed from a non-contextable attribute, or a contextable attribute using the default value.

If the components argument is provided, only those components will be flushed. Otherwise, all components of that asset will be deleted from the search index.

Parameters
int$assetidID of the asset
array$componentsthe components to which the keydata pertains (e.g. metadata or attribute)
array$contextidsArray of context IDs to flush key data. If omitted, all contexts (including defaults) will be flushed.
Returns
void public

Definition at line 1105 of file search_manager.inc.

flushIndexableContent (   $assetid,
  $components = Array(),
  $contextids = NULL 
)

Flush the keydata for an asset

If the components argument is provided, only those components will be flushed. Otherwise, all components of that asset will be deleted from the search index.

Parameters
int$assetidID of the asset
array$componentsthe components to which the keydata pertains (e.g. metadata or attribute)
array$contextidsArray of context IDs to flush key data. If omitted, all contexts (including defaults) will be flushed.
Returns
void public

Definition at line 1041 of file search_manager.inc.

generateWordList (   $words)

Generates a word list from the search string

Parameters
string$wordsthe words string
Returns
array public

Definition at line 2228 of file search_manager.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 1181 of file search_manager.inc.

getAssetTreeWeightings (   $assetid = NULL,
  $strict_assetid = TRUE,
  $strict_type_code = FALSE,
  $type_weights_only = TRUE,
  $include_global_weights = TRUE 
)

Returns the Asset Tree weightings for the specified assetid, or all weightings registered for asset trees if the specified assetid is null

Parameters
string$assetidthe assetid of the wanted tree weightings or null for all asset tree weightings
boolean$strict_assetidif TRUE only weightings that have been customised explicitly using the specified assetid will be returned, otherwise the closest weighting customisation will be returned
boolean$strict_type_codeif TRUE only weightings matching the asset type of the specified assetid will be returned
boolean$type_weights_onlyApplies only if $assetid is not NULL and $strict_assetid is FALSE. if TRUE only type weights data according to $strict_type_code is returned. if FALSE $strict_type_code is ineffective & both type_weights & metadata_weights data is returned.
boolean$include_global_weightsif TRUE, the asset tree weights will include the root folder weight which defines global weights.
Returns
array public
See Also
saveTypeWeightings()
getMetadataWeighting()

Definition at line 1936 of file search_manager.inc.

getAssetTypeWeightings (   $type_code = NULL,
  $strict_type_code = FALSE 
)

Returns the Asset Type weightings for the specified asset type, or all asset types if the specified type code is null

Parameters
string$type_codethe type code of the wanted weightings, or null for all asset type weightings
boolean$strict_type_codestrict or inherit type code
Returns
array public
See Also
saveTypeWeightings()

Definition at line 1885 of file search_manager.inc.

getAssetWeightings (   $assetid = NULL)

Returns the Asset Type weightings

Parameters
string$assetidthe assetid of the wanted weightings if null, weightings for all assets set will be returned
Returns
array public
See Also
saveTypeWeightings()

Definition at line 2051 of file search_manager.inc.

getCondensedResults (   $results)

Reduce results to be keyed based on asset ID

Parameters
array$resultsraw results array
Returns
array public

Definition at line 3506 of file search_manager.inc.

getFormattedResults (   $results,
  $search_string,
  $full_content = TRUE 
)

Provide generic format of search results data

Results array is in the format returned by search manager when a detailed searched is made

Parameters
array$resultsCONDENSED search results (returned by getCondensedResults())
string$search_stringstring searched for
string$full_contentreturn full formatted content or not
Returns
array public

Definition at line 3541 of file search_manager.inc.

getIndexableAssetComponents ( )

Returns a list of indexable compents for all assets

Returns
array public

Definition at line 1197 of file search_manager.inc.

getIndexableAssetContent ( $asset,
  $changed_vars 
)

Returns the indexable standard field content for the specified asset

Parameters
object&$assetthe asset to obtain the indexable content for
array$changed_varsthe asset vars that have changed
Returns
array public

Definition at line 547 of file search_manager.inc.

getIndexableAttributeContent ( $asset,
  $changed_vars,
  $all_contexts = TRUE 
)

Returns the indexable content for the specified asset's attributes

Parameters
object&$assetthe asset to obtain the indexable content for
array$changed_varsattributes that have been changed
Returns
array public

Definition at line 638 of file search_manager.inc.

getIndexableAttributes (   $type_code)

Returns a list of indexable components for a specified asset type

Parameters
string$type_codethe type code
Returns
array public

Definition at line 1223 of file search_manager.inc.

getIndexableContent ( $asset)

Returns the content for the specfied asset

Parameters
object&$assetthe asset to obtain the indexable content for
Returns
array public

Definition at line 796 of file search_manager.inc.

getIndexableMetadataContent ( $asset,
  $fieldids = Array(),
  $all_contexts = TRUE 
)

Returns the indexable metadata content for the specified asset

Parameters
object&$assetThe asset to get the indexable content fors
array$fieldidsArray of fieldid => type_code to limit to
boolean$all_contextsTRUE = attributes are reindexed in all contexts. FALSE = only current context is reindexed
Returns
array public

Definition at line 1454 of file search_manager.inc.

getIndexedComponents (   $assetid)

Returns a list of components that the specified asset has indexed

Parameters
string$assetidthe assetid of the wanted components
Returns
array public

Definition at line 1148 of file search_manager.inc.

getIndexingAssetid ( $asset)

Returns the assetid in which content should be indexed under for the specified asset

Parameters
object&$assetthe asset to find the indexing asset for
Returns
mixed int|boolean public

Definition at line 519 of file search_manager.inc.

getMetadataWeighting (   $assetid,
  $fieldid 
)

Returns the metadata weightings for the specified assetid and metadata fieldid

The following presedence rules are followed in order when finding the weightings for a particular asset:

  • Any explicit weightings for the asset id are checked
  • Any weightings for a tree in which the asset resides are checked
  • Any weightings for a asset type are checked
  • Any global weightings for all asset types are checked
  • A default weighing of 1 is returned
Parameters
string$assetidthe assetid to get the weightings for
string$fieldidthe fieldid of the metadata field
Returns
mixed array|boolean public

Definition at line 1754 of file search_manager.inc.

getMetadataWeightings (   $assetid = NULL)

Returns the Asset Type weightings

Parameters
string$assetidthe assetid of the wanted weightings if null, weightings for all assets set will be returned
Returns
array public
See Also
saveTypeWeightings()

Definition at line 2095 of file search_manager.inc.

getMinWordLength ( )

Return the minimum indexable word lenght

Returns
int public

Definition at line 3466 of file search_manager.inc.

getNoiseWords ( )

Return an array of noise words

Returns
array public

Definition at line 3402 of file search_manager.inc.

getWeightings (   $assetid)

Returns the weightings for an assets core components and its attributes

The Following presedence rules are followed in order when finding the weightings for a particular asset:

  • Any explicit weightings for the asset id are checked
  • Any weightings for a tree in which the asset resides are checked
  • Any weightings for a asset type are checked
  • Any global weightings for all asset types are checked
  • All components are returned a default weighing of 1

Weightings are now cached inside the search manager, per asset, to improve performance (instead of loading up the cached weightings file four times for a reindex, it only gets loaded once). Cached weightings are unset when the weightings are saved in _saveWeightings().

Parameters
string$assetidthe assetid to obtain the weightings for
Returns
array public

Definition at line 1675 of file search_manager.inc.

getWhiteWords ( )

Return an array of white words

Returns
array public

Definition at line 3415 of file search_manager.inc.

isAssetIndexable (   $assetid)

Returns TRUE if the specified asset is indexable

Parameters
string$assetidthe assetid to check
Returns
boolean public

Definition at line 1262 of file search_manager.inc.

isAttributeIndexable (   $attrid)

Returns TRUE if the specified attribute is indexable

Parameters
int$attridthe attribute id
Returns
boolean public

Definition at line 1246 of file search_manager.inc.

isNoiseWord (   $word)

Return true if word is in noise words

Parameters
string$wordThe word to compare
Returns
boolean public

Definition at line 3430 of file search_manager.inc.

isWhiteWord (   $word)

Return true if word is in white words

Parameters
string$wordThe word to compare
Returns
boolean public

Definition at line 3449 of file search_manager.inc.

isWordIndexable (   $word)

Check if the word is indexable

Check is performed according to the current indexing parameters

Parameters
string$wordword to check
Returns
boolean public

Definition at line 1289 of file search_manager.inc.

onAssetCreate ( $broadcaster,
  $vars = Array() 
)

Event fired when an asset is created

Parameters
object&$broadcasterthe asset that triggered the event
array$varsthe vars that get submitted by the broadcaster Component is set as $vars['component']
Returns
boolean public

Definition at line 183 of file search_manager.inc.

onAssetDeleted ( $broadcaster,
  $vars = Array() 
)

Event fired when an asset gets deleted. We want to flush any key data in the index table

Parameters
object&$broadcasterthe asset that triggered the event
array$varsthe vars that get submitted by the broadcaster Component is set as $vars['component']
Returns
void public

Definition at line 263 of file search_manager.inc.

onAssetStatusUpdate ( $broadcaster,
  $vars = Array() 
)

Event fired when an asset has its status changed

Parameters
object&$broadcasterthe asset that triggered the event
array$varsthe vars that get submitted by the broadcaster Component is set as $vars['component']
Returns
boolean public

Definition at line 204 of file search_manager.inc.

onAssetUpdate ( $broadcaster,
  $vars = Array() 
)

Event fired when an asset is updated

Parameters
object&$broadcasterthe asset that triggered the event
array$varsthe vars that get submitted by the broadcaster Component is set as $vars['component']
Returns
boolean public

Definition at line 163 of file search_manager.inc.

onAttributeChange ( $broadcaster,
  $vars = Array() 
)

Event fired when an assets atrtributes have changed

Parameters
object&$broadcasterthe asset that triggered the event
array$varsa list of attributes that have changed
Returns
boolean public

Definition at line 223 of file search_manager.inc.

onContentsUpdated ( $broadcaster,
  $vars = Array() 
)

Event fired when an asset is created

Parameters
object&$broadcasterthe asset that triggered the event
array$varsthe vars that get submitted by the broadcaster Component is set as $vars['component']
Returns
boolean public

Definition at line 243 of file search_manager.inc.

onContextDelete ( $broadcaster,
  $vars = Array() 
)

Event fired when a context gets deleted.

We want to flush any key data in the index table related to that context. This is necessary because the values may linger in the table, and cause key duplication issues.

Parameters
object&$broadcasterthe asset that triggered the event
array$varsthe vars that get submitted by the broadcaster Context deleted is set as $vars['contextid']
Returns
void public

Definition at line 285 of file search_manager.inc.

onMetadataDeleted ( $broadcaster,
  $vars = Array() 
)

Event fired when metadata manager wants some metadata deleted

Parameters
object&$broadcasterthe asset that triggered the event (should be meta. mgr)
array$varsthe vars that get submitted by the broadcaster Asset ID is set as $vars['assetid'] Schema Asset IDs is set as $vars['schemaids']
Returns
void public

Definition at line 1372 of file search_manager.inc.

onMetadataUpdate ( $broadcaster,
  $vars = Array() 
)

Event fired when metadata manager wants some metadata reindexed

Parameters
object&$broadcasterthe asset that triggered the event (should be meta. mgr)
array$varsthe vars that get submitted by the broadcaster Asset ID is set as $vars['assetid'] Schema Asset IDs is set as $vars['schemaids']
Returns
void public

Definition at line 1350 of file search_manager.inc.

processBasicSearch (   $search_info)

Processes a basic search request without search terms

Accepts the same input array as processSearch but does not use any search terms

Parameters
array$search_infoan array of search settings
Returns
array public
See Also
processSearch()

Definition at line 2872 of file search_manager.inc.

processSearch (   $search_info,
  $include_context = FALSE 
)

Processes a search request Formulates search query and returns the results

Each search request is logged to the 'search' log in the format:

Array('terms'   => array (
                    first term => count of result assets for this term only
                    second term => ...
                    ),
    'results' => total number of result assets for this request,
    'assetid' => id of the asset requesting this search
);

This array will be in the 'data' section of the log entry (to be accessed via the log manager)

Parameters
array$search_infoan array of search settings in the form
'requester' => ID of asset that requested the search
'asset_types'   => Array of type code => whether to inherit
'statuses'  => Array of asset statuses, or empty array for default of live+
'roots'     => Array of assetids to use as roots for the search
'root_logic'    => 'AND'|'OR', depending on whether we want a result to be under all roots or any root
'fields'        => Array(
                field_name  => Array(
                                'words'             => 'cat sat mat',
                                'word_logic'        => 'AND'|'OR' (all words or any word, default 'AND')
                                'data_source_logic' => 'AND'|'OR' (all DSes or any DS, default 'OR')
                                'data_sources'      => Array(
                                                        i   => Array(
                                                                'type'      => 'asset_attrib' for eg
                                                                'params'    => Array(...)
                                                               ),
                                                       ),
                               ),
               ),
'field_logic'   => 'AND'|'OR', depending on whether we want results that match all fields or any field
'exclude'       => Array of words to exclude from results
boolean$include_contextWhether to include the context in which the match was found
Returns
array public

Definition at line 2280 of file search_manager.inc.

reindexAsset ( $asset,
  $vars = Array() 
)

Reindex this asset and, if specified, the metadata associated with this asset

No multi-context support is required here, as standard asset fields and metadata do not vary based on context.

Parameters
object&$assetthe asset to reindex
array$varsthe components to reindex - 'asset' to reindex the core components of the asset, and 'metadata' to reindex metadata or 'all' for both
Returns
void public

Definition at line 310 of file search_manager.inc.

reindexAttributes ( $asset,
  $vars = Array(),
  $all_contexts = FALSE 
)

Reindex the specified asset's attributes

With multi-context searching, extra parameters have been added. The $all_contexts flag will be set to TRUE when a "all contexts reindex" is necessary. This will be when the Reindex HIPO job is called, or when the asset is first created.

Parameters
object&$assetthe asset to reindex
array$varsa list of attribute names that have changed
boolean$all_contextsTRUE = attributes are reindexed in all contexts. FALSE = only current context is reindexed.
Returns
void public

Definition at line 358 of file search_manager.inc.

reindexContents ( $asset,
  $vars = Array(),
  $all_contexts = FALSE 
)

Reindex the specified asset's custom contents

With multi-context searching, extra parameters have been added. The $all_contexts flag will be set to TRUE when a "all contexts reindex" is necessary. This will be when the Reindex HIPO job is called. (Contents are not reindexed when the asset is first created.)

Parameters
object&$assetthe asset to reindex
array$varsa list of attribute names that have changed
boolean$all_contextsIf TRUE, the asset contents wil be reindexed from all contexts' perspective. FALSE = only current context.
Returns
void public

Definition at line 456 of file search_manager.inc.

reindexMetadata (   $assetid,
  $vars = Array(),
  $all_contexts = FALSE 
)

Re-indexes the metadata components for the specified asset

Parameters
string$assetidthe assetid to reindex
array$varsthe schemas to renidex
boolean$all_contextsTRUE = attributes are reindexed in all contexts. FALSE = only current context is reindexed.
Returns
void public

Definition at line 1395 of file search_manager.inc.

saveAssetTreeWeightings (   $asset_tree_weightings)

Saves the asset tree weightings to file

Parameters
array$asset_tree_weightingsthe complete asset tree weightings to save
Returns
boolean public

Definition at line 2034 of file search_manager.inc.

saveAssetWeightings (   $asset_weightings)

Saves the Asset Weightings

Parameters
array$asset_weightingsthe array of weights to save
Returns
boolean public
See Also
getTypeWeightings

Definition at line 2078 of file search_manager.inc.

saveMetadataWeightings (   $metadata_weightings)

Saves the metadata weightings to file

Parameters
array$metadata_weightingsthe complete metadata weightings to save
Returns
boolean public

Definition at line 2121 of file search_manager.inc.

spellCheckAvailable ( )

Returns true if the spell checker is available

Written as a wrapper function so that if the spell-checker changes for some reason, then this can be updated. It currently just checks whether the pSpell extension is available.

Returns
boolean public

Definition at line 2989 of file search_manager.inc.

spellCheckWord (   $word,
  $language = SQ_TOOL_SPELL_CHECKER_LANG 
)

Spell-checks a word and returns a list of suggestions if available

This function checks for the existence of the pSpell extension. If it does not exist (eg. Windows server), or an error otherwise occurs in the loading of the pSpell instance, we will proceed as if no suggestions are available.

Parameters
string$wordthe word to be checked
string$languagethe language to be used to spell-check
Returns
array public

Definition at line 2938 of file search_manager.inc.


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