wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
SearchUtil Class Reference

Static Public Member Functions

static getIndex ($create=true)
 
static resetIndex ()
 
static indexInSearch (&$obj)
 
static deleteFromSearch (&$obj)
 
static commitIndex ($optimize=true)
 
static optimizeIndex ()
 
static isActivated ()
 
static getStopWords ()
 
static find ($searchTerm, &$pagingInfo)
 

Public Attributes

const INI_SECTION = 'search'
 
const INI_INDEX_PATH = 'indexPath'
 

Static Private Member Functions

static encodeValue ($value, $inputType)
 
static getIndexPath ()
 

Static Private Attributes

static $isActivated = null
 
static $index
 
static $indexPath
 
static $indexIsDirty = false
 

Detailed Description

This class provides access to the search based on Zend_Search_Lucene. The search index stored in the location that is defined by the configuration key 'indexPath' in the configuration section 'search'. To manage PersistentObjects in the index use the methods SearchUtil::indexInSearch() and SearchIndex::deleteFromSearch() and SearchUtil::commitIndex(). The method SearchUtil::getIndex() offers direct access to the search index for advanced operations.

Author
Niko enika.nosp@m.o@us.nosp@m.ers.s.nosp@m.ourc.nosp@m.eforg.nosp@m.e.ne.nosp@m.t

Definition at line 37 of file class.SearchUtil.php.

Member Function Documentation

static SearchUtil::getIndex (   $create = true)
static

Get the search index.

Parameters
createBoolean whether to create the index, if it does not exist [default: true]
Returns
An instance of Zend_Search_Lucene_Interface or null

Definition at line 52 of file class.SearchUtil.php.

References $indexPath.

static SearchUtil::resetIndex ( )
static

Reset the search index.

Definition at line 89 of file class.SearchUtil.php.

References $indexPath.

Referenced by SearchIndexController\getWorkPackage().

static SearchUtil::indexInSearch ( $obj)
static

Add a PersistentObject instance to the search index. This method modifies the index. For that reason SearchUtil::commitIndex() should be called afterwards.

Parameters
objThe PersistentObject instance.

Definition at line 103 of file class.SearchUtil.php.

References $index, and DATATYPE_ATTRIBUTE.

Referenced by SearchIndexController\index(), and PersistentObject\save().

static SearchUtil::encodeValue (   $value,
  $inputType 
)
staticprivate

Definition at line 146 of file class.SearchUtil.php.

static SearchUtil::deleteFromSearch ( $obj)
static

Delete a PersistentObject instance from the search index.

Parameters
objThe PersistentObject instance.

Definition at line 158 of file class.SearchUtil.php.

References $index.

Referenced by PersistentObject\delete().

static SearchUtil::commitIndex (   $optimize = true)
static

Commit any changes made by using SearchUtil::indexInSearch() and SearchIndex::deleteFromSearch().

Note
This method only commits the index if changes were made using the methods mentioned above.
Parameters
optimizeBoolean whether the index should be optimized after commit [default: true].

Definition at line 182 of file class.SearchUtil.php.

References $index.

Referenced by SearchIndexController\index().

static SearchUtil::optimizeIndex ( )
static

Optimize the index

Definition at line 202 of file class.SearchUtil.php.

References $index.

Referenced by SearchIndexController\optimize().

static SearchUtil::getIndexPath ( )
staticprivate

Get the path to the index.

Returns
The path.

Definition at line 217 of file class.SearchUtil.php.

References Log\debug(), Log\error(), InifileParser\getInstance(), and FileUtil\mkdirRec().

+ Here is the call graph for this function:

static SearchUtil::isActivated ( )
static

Check if a index path is defined in the configuration.

Returns
Boolean

Definition at line 248 of file class.SearchUtil.php.

References InifileParser\getInstance().

Referenced by SearchIndexController\getWorkPackage().

+ Here is the call graph for this function:

static SearchUtil::getStopWords ( )
static

Get a list of words that are forbidden to search for

Returns
Array

Definition at line 261 of file class.SearchUtil.php.

References $GLOBALS.

static SearchUtil::find (   $searchTerm,
$pagingInfo 
)
static

Search for searchTerm in index

Parameters
searchTerm
pagingInfo
Returns
Associative array with object ids as keys and associative array with keys 'oid', 'score', 'summary' as value

Definition at line 273 of file class.SearchUtil.php.

References $index, BUILDDEPTH_SINGLE, DATATYPE_ATTRIBUTE, StringUtil\excerpt(), and PersistenceFacade\getInstance().

Referenced by SearchController\getObjects().

+ Here is the call graph for this function:

Member Data Documentation

const SearchUtil::INI_SECTION = 'search'

Definition at line 39 of file class.SearchUtil.php.

const SearchUtil::INI_INDEX_PATH = 'indexPath'

Definition at line 40 of file class.SearchUtil.php.

SearchUtil::$isActivated = null
staticprivate

Definition at line 42 of file class.SearchUtil.php.

SearchUtil::$index
staticprivate
SearchUtil::$indexPath
staticprivate

Definition at line 44 of file class.SearchUtil.php.

Referenced by getIndex(), and resetIndex().

SearchUtil::$indexIsDirty = false
staticprivate

Definition at line 45 of file class.SearchUtil.php.


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