|
CWIS Developer Documentation
|


Public Member Functions | |
| __construct () | |
| Class constructor. More... | |
| GetFieldContent ($ItemId, $FieldId) | |
| Overloaded version of method to retrieve text from DB. More... | |
| SearchFieldForPhrases ($FieldId, $Phrase) | |
| Perform phrase searching. More... | |
| SearchFieldsForComparisonMatches ($FieldIds, $Operators, $Values, $Logic) | |
| Perform comparison searches. More... | |
| GroupedSearch ($SearchGroups, $StartingResult=0, $NumberOfResults=10, $SortByField=NULL, $SortDescending=TRUE) | |
| Perform search with logical groups of fielded searches. More... | |
Public Member Functions inherited from SearchEngine | |
| __construct ($ItemTableName, $ItemIdFieldName, $ItemTypeFieldName) | |
| Object constructor. More... | |
| AddField ($FieldId, $FieldType, $ItemTypes, $Weight, $UsedInKeywordSearch) | |
| Add field to include in searching. More... | |
| FieldType ($FieldId) | |
| Get type of specified field (text/numeric/date/daterange). More... | |
| FieldWeight ($FieldId) | |
| Get search weight for specified field. More... | |
| FieldInKeywordSearch ($FieldId) | |
| Get whether specified field is included in keyword searches. More... | |
| DebugLevel ($NewValue) | |
| Set debug output level. More... | |
| Search ($SearchParams, $StartingResult=0, $NumberOfResults=PHP_INT_MAX, $SortByField=NULL, $SortDescending=TRUE) | |
| Perform search with specified parameters. 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... | |
| AddResultFilterFunction ($FunctionName) | |
| Add function that will be called to filter search results. More... | |
| NumberOfResults ($ItemType=NULL) | |
| 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 ($SearchParams) | |
| Get total of weights for all fields involved in search, useful for assessing scale of scores in search results. More... | |
| UpdateForItem ($ItemId, $ItemType) | |
| 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 ($FieldId) | |
| 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 ($ItemType, $FieldId, $SortDescending) |
| Return item IDs sorted by a specified field. More... | |
| static | QueueUpdateForItem ($ItemOrItemId, $TaskPriority=NULL) |
| Queue background update for an item. More... | |
| static | RunUpdateForItem ($ItemId) |
| Update search index for an item. More... | |
| static | GetResultFacets ($SearchResults, $User) |
| Generate a list of suggested additional search terms that can be used for faceted searching. More... | |
| static | SetUpdatePriority ($NewPriority) |
| Set the default priority for background tasks. More... | |
| static | SetNumResourcesForFacets ($NumToUse) |
| Set the number of resources used for search facets. More... | |
| static | FilterTextDisplay ($ParamDesc) |
| Filter for text display of search parameters. More... | |
Static Public Member Functions inherited from SearchEngine | |
| static | FlattenMultiTypeResults ($Results) |
| Flatten a two-dimensional array keyed by ItemType with results for each type as the outer values into array(ItemId => ItemScore). More... | |
| static | BuildMultiTypeResults ($Results) |
| Expand a one-dimensional array(ItemId => ItemScore) into a two-dimensional array(ItemType => array(ItemId => ItemScore)). 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 | KEYWORD_FIELD_ID = -100 |
| const | STEM_ID_OFFSET = 1000000 |
| const | SEARCHLOGIC_AND = 1 |
| const | SEARCHLOGIC_OR = 2 |
| const | COMPARISON_OPERATOR_PATTERN = '/^([><=^$@]+|!=)([^><=^$@])/' |
Protected Member Functions inherited from SearchEngine | |
| SearchFieldForPhrases ($FieldId, $Phrase) | |
| Search for phrase in specified field. More... | |
| FilterOnSuppliedFunctions ($Scores) | |
| Filter search scores through any supplied functions. More... | |
| GetFieldContent ($ItemId, $FieldId) | |
| Retrieve content for specified field for specified item. More... | |
| DMsg ($Level, $Msg) | |
| Print debug message if level set high enough. More... | |
Protected Attributes inherited from SearchEngine | |
| $DB | |
| $DebugLevel | |
| $FilterFuncs | |
| $ItemIdFieldName | |
| $ItemTableName | |
| $ItemTypeFieldName | |
| $LastSearchTime | |
| $NumberOfResultsAvailable | |
| $StemmingEnabled = TRUE | |
| $SynonymsEnabled = TRUE | |
Definition at line 10 of file SPTSearchEngine.php.
| SPTSearchEngine::__construct | ( | ) |
Class constructor.
Definition at line 15 of file SPTSearchEngine.php.
References SearchEngine\AddField(), MetadataSchema\GetAllSchemas(), 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, and MetadataSchema\MDFTYPE_USER.
|
static |
Filter for text display of search parameters.
| string | $ParamDesc | Unfiltered parameter description. |
Definition at line 961 of file SPTSearchEngine.php.
References SearchEngine\$DB, and ApplicationFramework\PRIORITY_BACKGROUND.
| SPTSearchEngine::GetFieldContent | ( | $ItemId, | |
| $FieldId | |||
| ) |
Overloaded version of method to retrieve text from DB.
| int | $ItemId | ID of item to retrieve value for. |
| string | $FieldId | ID of field to retrieve value for. |
Definition at line 89 of file SPTSearchEngine.php.
References MetadataSchema\MDFTYPE_REFERENCE.
|
static |
Return item IDs sorted by a specified field.
| int | $ItemType | Type of item. |
| int | $FieldId | ID of field by which to sort. |
| bool | $SortDescending | If TRUE, sort in descending order, otherwise sort in ascending order. |
Definition at line 646 of file SPTSearchEngine.php.
|
static |
Generate a list of suggested additional search terms that can be used for faceted searching.
| array | $SearchResults | A set of results from a from which to generate facets. |
| User | $User | User to employ in permission checks. |
Definition at line 728 of file SPTSearchEngine.php.
References SearchEngine\$DB, and MetadataSchema\MDFSTAT_OK.
Referenced by SearchFacetUI\__construct().

| SPTSearchEngine::GroupedSearch | ( | $SearchGroups, | |
$StartingResult = 0, |
|||
$NumberOfResults = 10, |
|||
$SortByField = NULL, |
|||
$SortDescending = TRUE |
|||
| ) |
Perform search with logical groups of fielded searches.
This method is DEPRECATED – please use SearchEngine::Search() with a SearchParameterSet object instead.
| mixed | $SearchGroups | Search parameters as SearchParameterSet object or legacy array format. |
| int | $StartingResult | Starting index into results. (OPTIONAL, defaults to 0) |
| int | $NumberOfResults | Number of results to return. (OPTIONAL, defaults to 10) |
| string | $SortByField | Name of field to sort results by. (OPTIONAL, defaults to relevance score) |
| bool | $SortDescending | If TRUE, results will be sorted in descending order, otherwise results will be sorted in ascending order. (OPTIONAL, defaults to TRUE) |
Definition at line 921 of file SPTSearchEngine.php.
References MetadataSchema\SCHEMAID_DEFAULT, and SearchEngine\Search().
|
static |
Queue background update for an item.
| mixed | $ItemOrItemId | Item to update. |
| int | $TaskPriority | Priority for the task, if the default is not suitable |
Definition at line 659 of file SPTSearchEngine.php.
|
static |
Update search index for an item.
| int | $ItemId | Item to update. |
Definition at line 697 of file SPTSearchEngine.php.
| SPTSearchEngine::SearchFieldForPhrases | ( | $FieldId, | |
| $Phrase | |||
| ) |
Perform phrase searching.
| string | $FieldId | ID of field to search. |
| string | $Phrase | Phrase to look for. |
Definition at line 125 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 | ( | $FieldIds, | |
| $Operators, | |||
| $Values, | |||
| $Logic | |||
| ) |
Perform comparison searches.
| array | $FieldIds | IDs of fields to search. |
| array | $Operators | Search operators. |
| array | $Values | Target values. |
| string | $Logic | Search logic ("AND" or "OR"). |
Definition at line 269 of file SPTSearchEngine.php.
References SearchEngine\DMsg(), MetadataSchema\FieldExistsInAnySchema(), MetadataSchema\GetAllSchemaIds(), MetadataSchema\MDFTYPE_CONTROLLEDNAME, MetadataSchema\MDFTYPE_DATE, MetadataSchema\MDFTYPE_FLAG, 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.
|
static |
Set the number of resources used for search facets.
| int | $NumToUse | Updated value. |
Definition at line 895 of file SPTSearchEngine.php.
|
static |
Set the default priority for background tasks.
| mixed | $NewPriority | New task priority (one of ApplicationFramework::PRIORITY_*) |
Definition at line 886 of file SPTSearchEngine.php.