CWIS Developer Documentation

- Home
- Main Page
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | List of all members
SPTSearchEngine Class Reference
Inheritance diagram for SPTSearchEngine:
[legend]
Collaboration diagram for SPTSearchEngine:
[legend]

## Public Member Functions
| SPTSearchEngine ()
| GetFieldContent ($ItemId, $FieldName)
| Overloaded version of method to retrieve text from DB. More...
| SearchFieldForPhrases ($FieldName, $Phrase)
| SearchFieldsForComparisonMatches ($FieldNames, $Operators, $Values)
| UpdateForResource ($ItemId)
Public Member Functions inherited from SearchEngine
| SearchEngine ($ItemTableName, $ItemIdFieldName)
| Object constructor. More...
| AddField ($FieldName, $FieldType, $Weight, $UsedInKeywordSearch)
| Add field to include in searching. More...
| FieldType ($FieldName)
| Get type of specified field (text/numeric/date/daterange). More...
| FieldWeight ($FieldName)
| Get search weight for specified field. More...
| FieldInKeywordSearch ($FieldName)
| Get whether specified field is included in keyword searches. More...
| DebugLevel ($NewValue)
| Set debug output level. More...
| Search ($SearchString, $StartingResult=0, $NumberOfResults=10, $SortByField=NULL, $SortDescending=TRUE)
| Perform keyword search. More...
| FieldedSearch ($SearchStrings, $StartingResult=0, $NumberOfResults=10, $SortByField=NULL, $SortDescending=TRUE)
| Perform search across multiple fields, with different values or comparisons specified for each field. More...
| GroupedSearch ($SearchGroups, $StartingResult=0, $NumberOfResults=10, $SortByField=NULL, $SortDescending=TRUE)
| Perform search with logical groups of fielded searches. More...
| AddResultFilterFunction ($FunctionName)
| Add function that will be called to filter search results. More...
| DefaultSearchLogic ($NewSetting=NULL)
| Get/set default search logic (LOGIC_AND or LOGIC_OR). More...
| SearchTermsRequiredByDefault ($NewSetting=TRUE)
| Set default search logic. More...
| NumberOfResults ()
| Get number of results found by most recent search. More...
| SearchTerms ()
| Get normalized list of search terms. More...
| SearchTime ()
| Get time that last search took, in seconds. More...
| FieldedSearchWeightScale ($SearchStrings)
| Get total of weights for all fields involved in search, useful for assessing scale of scores in search results. More...
| UpdateForItem ($ItemId)
| Update search database for the specified item. More...
| UpdateForItems ($StartingItemId, $NumberOfItems)
| Update search database for the specified range of items. More...
| DropItem ($ItemId)
| Drop all data pertaining to item from search database. More...
| DropField ($FieldName)
| Drop all data pertaining to field from search database. More...
| SearchTermCount ()
| Get total number of search terms indexed by search engine. More...
| ItemCount ()
| Get total number of items indexed by search engine. More...
| AddSynonyms ($Word, $Synonyms)
| Add synonyms. More...
| RemoveSynonyms ($Word, $Synonyms=NULL)
| Remove synonym(s). More...
| RemoveAllSynonyms ()
| Remove all synonyms. More...
| GetSynonyms ($Word)
| Get synonyms for word. More...
| GetAllSynonyms ()
| Get all synonyms. More...
| SetAllSynonyms ($SynonymList)
| Set all synonyms. More...
| LoadSynonymsFromFile ($FileName)
| Load synonyms from a file. More...

## Static Public Member Functions
static | GetItemIdsSortedByField ($FieldName, $SortDescending)
static | QueueUpdateForItem ($ItemId, $TaskPriority=ApplicationFramework::PRIORITY_LOW)
static | RunUpdateForItem ($ItemId)
static | GetResultFacets ($SearchResults, $User)
| Generate a list of suggested additional search terms that can be used for faceted searching. More...

## Additional Inherited Members
Public Attributes inherited from SearchEngine
const | LOGIC_AND = 1
const | LOGIC_OR = 2
const | FIELDTYPE_TEXT = 1
const | FIELDTYPE_NUMERIC = 2
const | FIELDTYPE_DATE = 3
const | FIELDTYPE_DATERANGE = 4
const | WORD_PRESENT = 1
const | WORD_EXCLUDED = 2
const | WORD_REQUIRED = 4
const | STEM_ID_OFFSET = 1000000
const | SEARCHLOGIC_AND = 1
const | SEARCHLOGIC_OR = 2
Protected Member Functions inherited from SearchEngine
| SearchFieldForPhrases ($FieldName, $Phrase)
| FilterOnSuppliedFunctions ($Scores)
| GetFieldContent ($ItemId, $FieldName)
| DMsg ($Level, $Msg)
Protected Attributes inherited from SearchEngine
| $DB
| $DebugLevel
| $ItemTableName
| $ItemIdFieldName
| $NumberOfResultsAvailable
| $LastSearchTime
| $FilterFuncs
| $DefaultSearchLogic = self::LOGIC_AND
| $StemmingEnabled = TRUE
| $SynonymsEnabled = TRUE

## Detailed Description

Definition at line 10 of file SPTSearchEngine.php.

## Member Function Documentation

SPTSearchEngine::GetFieldContent | ( |  | $ItemId,
|  |  | $FieldName
| ) |  |

Overloaded version of method to retrieve text from DB.

Parameters

  int | $ItemId | ID of item to retrieve value for.
  string | $FieldName | Name of field to retrieve value for.

Returns
  mixed Text value or array of text values or NULL or empty array if no values available.

Definition at line 78 of file SPTSearchEngine.php.

References MetadataSchema\MDFTYPE_REFERENCE.

static SPTSearchEngine::GetItemIdsSortedByField | ( |  | $FieldName,
|  |  | $SortDescending
| ) |  |
| static

Definition at line 599 of file SPTSearchEngine.php.

static SPTSearchEngine::GetResultFacets | ( |  | $SearchResults,
|  |  | $User
| ) |  |
| static

Generate a list of suggested additional search terms that can be used for faceted searching.

Parameters

  $SearchResults | A set of results from a from which to generate facets.
  $User | to employ in permission checks.

Returns
  An array of suggestions. Keys are the field names and values are arrays of (ValueId => SuggestedValue)

Definition at line 634 of file SPTSearchEngine.php.

References SearchEngine\$DB, and MetadataSchema\MDFSTAT_OK.

static SPTSearchEngine::QueueUpdateForItem | ( |  | $ItemId,
|  |  | $TaskPriority = `ApplicationFramework::PRIORITY_LOW`
| ) |  |
| static

Definition at line 605 of file SPTSearchEngine.php.

static SPTSearchEngine::RunUpdateForItem | ( |  | $ItemId | ) |
| static

Definition at line 616 of file SPTSearchEngine.php.

References SPTSearchEngine().

SPTSearchEngine::SearchFieldForPhrases | ( |  | $FieldName,
|  |  | $Phrase
| ) |  |

Definition at line 110 of file SPTSearchEngine.php.

References SearchEngine\DebugLevel(), SearchEngine\DMsg(), MetadataSchema\MDFTYPE_CONTROLLEDNAME, MetadataSchema\MDFTYPE_DATE, MetadataSchema\MDFTYPE_FILE, MetadataSchema\MDFTYPE_FLAG, MetadataSchema\MDFTYPE_IMAGE, MetadataSchema\MDFTYPE_NUMBER, MetadataSchema\MDFTYPE_OPTION, MetadataSchema\MDFTYPE_PARAGRAPH, MetadataSchema\MDFTYPE_REFERENCE, MetadataSchema\MDFTYPE_TEXT, MetadataSchema\MDFTYPE_TIMESTAMP, MetadataSchema\MDFTYPE_TREE, MetadataSchema\MDFTYPE_URL, and MetadataSchema\MDFTYPE_USER.

SPTSearchEngine::SearchFieldsForComparisonMatches | ( |  | $FieldNames,
|  |  | $Operators,
|  |  | $Values
| ) |  |

Definition at line 240 of file SPTSearchEngine.php.

References SearchEngine\DefaultSearchLogic(), SearchEngine\DMsg(), MetadataSchema\MDFTYPE_CONTROLLEDNAME, MetadataSchema\MDFTYPE_DATE, MetadataSchema\MDFTYPE_FILE, MetadataSchema\MDFTYPE_FLAG, MetadataSchema\MDFTYPE_IMAGE, MetadataSchema\MDFTYPE_NUMBER, MetadataSchema\MDFTYPE_OPTION, MetadataSchema\MDFTYPE_PARAGRAPH, MetadataSchema\MDFTYPE_REFERENCE, MetadataSchema\MDFTYPE_TEXT, MetadataSchema\MDFTYPE_TIMESTAMP, MetadataSchema\MDFTYPE_TREE, MetadataSchema\MDFTYPE_URL, and MetadataSchema\MDFTYPE_USER.

SPTSearchEngine::SPTSearchEngine | ( |  | ) |

Definition at line 12 of file SPTSearchEngine.php.

References SearchEngine\AddField(), MetadataSchema\MDFTYPE_CONTROLLEDNAME, MetadataSchema\MDFTYPE_DATE, MetadataSchema\MDFTYPE_FILE, MetadataSchema\MDFTYPE_FLAG, MetadataSchema\MDFTYPE_IMAGE, MetadataSchema\MDFTYPE_NUMBER, MetadataSchema\MDFTYPE_OPTION, MetadataSchema\MDFTYPE_PARAGRAPH, MetadataSchema\MDFTYPE_POINT, MetadataSchema\MDFTYPE_REFERENCE, MetadataSchema\MDFTYPE_TEXT, MetadataSchema\MDFTYPE_TIMESTAMP, MetadataSchema\MDFTYPE_TREE, MetadataSchema\MDFTYPE_URL, MetadataSchema\MDFTYPE_USER, and SearchEngine\SearchEngine().

Referenced by RunUpdateForItem().

Here is the caller graph for this function:

SPTSearchEngine::UpdateForResource | ( |  | $ItemId | ) |

Definition at line 747 of file SPTSearchEngine.php.

References SearchEngine\UpdateForItem().

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

- objects/SPTSearchEngine.php