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... | |
![]() | |
__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 | ConvertToDisplayParameters ($SearchParams) |
Get a simplified SearchParameterSet for display purposes. More... | |
Additional Inherited Members | |
![]() | |
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 = '/^([><=^$@]+|!=)([^><=^$@])/' |
![]() | |
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... | |
![]() | |
$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 |
Get a simplified SearchParameterSet for display purposes.
When searches are constructed using the faceting code, search groups for "is 'X' OR begins with 'X -- ' are added to the search", however these are less than idea for display, hence the simplification used here. For example, if a user searches for 'frogs', and then clicks 'Science' under the 'GEM Subject' tree field facet, the following search will be constructed: Searched for: frogs and (GEM Subject is Science OR GEM Subject begins with Science – ) but the Display parameters will be: Searched for: frogs and GEM Subject is Science
SearchParameterSet | $SearchParams | Parameters to format. |
Definition at line 943 of file SPTSearchEngine.php.
References SearchEngine\$DB, MetadataSchema\FieldExistsInAnySchema(), MetadataSchema\MDFTYPE_TREE, 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 621 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 696 of file SPTSearchEngine.php.
References SearchEngine\$DB, and MetadataSchema\MDFSTAT_OK.
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 889 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 634 of file SPTSearchEngine.php.
|
static |
Update search index for an item.
int | $ItemId | Item to update. |
Definition at line 672 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 863 of file SPTSearchEngine.php.
|
static |
Set the default priority for background tasks.
mixed | $NewPriority | New task priority (one of ApplicationFramework::PRIORITY_*) |
Definition at line 854 of file SPTSearchEngine.php.