CWIS Developer Documentation

- Home
- Main Page
- Classes
- Files

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

Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
SearchEngine Class Reference
Inheritance diagram for SearchEngine:
[legend]

## Public Member Functions
| SearchEngine (&$DB, $ItemTableName, $ItemIdFieldName, $ReferenceTableName, $ReferenceSourceIdFieldName, $ReferenceDestinationIdFieldName)
| AddField ($FieldName, $DBFieldName, $FieldType, $Weight, $UsedInKeywordSearch)
| ItemTableName ()
| ItemIdFieldName ()
| DBFieldName ($FieldName)
| FieldType ($FieldName)
| FieldWeight ($FieldName)
| FieldInKeywordSearch ($FieldName)
| DebugLevel ($Setting)
| Search ($SearchString, $StartingResult=0, $NumberOfResults=10, $SortByField=NULL, $SortDescending=TRUE)
| FieldedSearch ($SearchStrings, $StartingResult=0, $NumberOfResults=10, $SortByField=NULL, $SortDescending=TRUE)
| GroupedSearch ($SearchGroups, $StartingResult=0, $NumberOfResults=10, $SortByField=NULL, $SortDescending=TRUE)
| AddResultFilterFunction ($FunctionName)
| DefaultSearchLogic ($NewSetting=NULL)
| SearchTermsRequiredByDefault ($NewSetting=TRUE)
| NumberOfResults ()
| SearchTerms ()
| SearchTime ()
| FieldedSearchWeightScale ($SearchStrings)
| UpdateForItem ($ItemId)
| UpdateForItems ($StartingItemId, $NumberOfItems)
| DropItem ($ItemId)
| DropField ($FieldName)
| SearchTermCount ()
| ItemCount ()
| AddSynonyms ($Word, $Synonyms)
| Add synonyms. More...
| RemoveSynonyms ($Word, $Synonyms=NULL)
| RemoveAllSynonyms ()
| GetSynonyms ($Word)
| GetAllSynonyms ()
| SetAllSynonyms ($SynonymList)
| LoadSynonymsFromFile ($FileName)
| Load synonyms from a file. More...
| SuggestAlternateSearches ($SearchString)

## Public Attributes
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 | STEM_ID_OFFSET = 1000000
const | SEARCHLOGIC_AND = 1
const | SEARCHLOGIC_OR = 2

## Protected Member Functions
| GetFieldId ($FieldName)
| SearchFieldForPhrases ($FieldName, $Phrase)
| FilterOnSuppliedFunctions ($Scores)
| GetFieldContent ($ItemId, $FieldName)
| DMsg ($Level, $Msg)

## Protected Attributes
| $DB
| $DebugLevel
| $ItemTableName
| $ItemIdFieldName
| $ReferenceTableName
| $ReferenceSourceIdFieldName
| $ReferenceDestinationIdFieldName
| $NumberOfResultsAvailable
| $LastSearchTime
| $FilterFuncs
| $DefaultSearchLogic = self::LOGIC_AND
| $StemmingEnabled = TRUE
| $SynonymsEnabled = TRUE

## Detailed Description

Definition at line 11 of file SearchEngine.php.

## Member Function Documentation

SearchEngine::AddField | ( |  | $FieldName,
|  |  | $DBFieldName,
|  |  | $FieldType,
|  |  | $Weight,
|  |  | $UsedInKeywordSearch
| ) |  |

Definition at line 54 of file SearchEngine.php.

Referenced by SPTSearchEngine\SPTSearchEngine().

Here is the caller graph for this function:

SearchEngine::AddResultFilterFunction | ( |  | $FunctionName | ) |

Definition at line 278 of file SearchEngine.php.

SearchEngine::AddSynonyms | ( |  | $Word,
|  |  | $Synonyms
| ) |  |

Add synonyms.

Parameters

  string | $Word | Word for which synonyms should apply.
  array | $Synonyms | Array of synonyms.

Returns
  Count of new synonyms added.

Definition at line 461 of file SearchEngine.php.

Referenced by LoadSynonymsFromFile(), and SetAllSynonyms().

Here is the caller graph for this function:

SearchEngine::DBFieldName | ( |  | $FieldName | ) |

Definition at line 67 of file SearchEngine.php.

SearchEngine::DebugLevel | ( |  | $Setting | ) |

Definition at line 77 of file SearchEngine.php.

Referenced by SearchEngine(), and SPTSearchEngine\SearchFieldForPhrases().

Here is the caller graph for this function:

SearchEngine::DefaultSearchLogic | ( |  | $NewSetting = `NULL` | ) |

Definition at line 285 of file SearchEngine.php.

References $DefaultSearchLogic.

Referenced by GroupedSearch(), SPTSearchEngine\SearchFieldsForComparisonMatches(), and SearchTermsRequiredByDefault().

Here is the caller graph for this function:

SearchEngine::DMsg | ( |  | $Level,
|  |  | $Msg
| ) |  |
| protected

Definition at line 2001 of file SearchEngine.php.

Referenced by FieldedSearch(), GroupedSearch(), Search(), SPTSearchEngine\SearchFieldForPhrases(), and SPTSearchEngine\SearchFieldsForComparisonMatches().

Here is the caller graph for this function:

SearchEngine::DropField | ( |  | $FieldName | ) |

Definition at line 428 of file SearchEngine.php.

SearchEngine::DropItem | ( |  | $ItemId | ) |

Definition at line 421 of file SearchEngine.php.

SearchEngine::FieldedSearch | ( |  | $SearchStrings,
|  |  | $StartingResult = `0`,
|  |  | $NumberOfResults = `10`,
|  |  | $SortByField = `NULL`,
|  |  | $SortDescending = `TRUE`
| ) |  |

Definition at line 147 of file SearchEngine.php.

References DMsg().

SearchEngine::FieldedSearchWeightScale | ( |  | $SearchStrings | ) |

Definition at line 322 of file SearchEngine.php.

SearchEngine::FieldInKeywordSearch | ( |  | $FieldName | ) |

Definition at line 73 of file SearchEngine.php.

SearchEngine::FieldType | ( |  | $FieldName | ) |

Definition at line 69 of file SearchEngine.php.

SearchEngine::FieldWeight | ( |  | $FieldName | ) |

Definition at line 71 of file SearchEngine.php.

SearchEngine::FilterOnSuppliedFunctions | ( |  | $Scores | ) |
| protected

Definition at line 1673 of file SearchEngine.php.

SearchEngine::GetAllSynonyms | ( |  | ) |

Definition at line 577 of file SearchEngine.php.

SearchEngine::GetFieldContent | ( |  | $ItemId,
|  |  | $FieldName
| ) |  |
| protected

Definition at line 1958 of file SearchEngine.php.

Referenced by UpdateForItem().

Here is the caller graph for this function:

SearchEngine::GetFieldId | ( |  | $FieldName | ) |
| protected

Definition at line 875 of file SearchEngine.php.

SearchEngine::GetSynonyms | ( |  | $Word | ) |

Definition at line 542 of file SearchEngine.php.

SearchEngine::GroupedSearch | ( |  | $SearchGroups,
|  |  | $StartingResult = `0`,
|  |  | $NumberOfResults = `10`,
|  |  | $SortByField = `NULL`,
|  |  | $SortDescending = `TRUE`
| ) |  |

Definition at line 174 of file SearchEngine.php.

References $DefaultSearchLogic, DefaultSearchLogic(), and DMsg().

SearchEngine::ItemCount | ( |  | ) |

Definition at line 449 of file SearchEngine.php.

SearchEngine::ItemIdFieldName | ( |  | ) |

Definition at line 66 of file SearchEngine.php.

References $ItemIdFieldName.

Referenced by SearchEngine(), and UpdateForItems().

Here is the caller graph for this function:

SearchEngine::ItemTableName | ( |  | ) |

Definition at line 65 of file SearchEngine.php.

References $ItemTableName.

Referenced by SearchEngine().

Here is the caller graph for this function:

SearchEngine::LoadSynonymsFromFile | ( |  | $FileName | ) |

Load synonyms from a file.

Each line of file should contain one word at the beginning of the line, followed by one or more synonyms separated by spaces or commas. Blank lines or lines beginning with "#" (i.e. comments) will be ignored.

Parameters

  string | $FileName | Name of file containing synonyms (with path if needed).

Returns
  Number of new synonyms added.

Definition at line 688 of file SearchEngine.php.

References AddSynonyms().

SearchEngine::NumberOfResults | ( |  | ) |

Definition at line 306 of file SearchEngine.php.

References $NumberOfResultsAvailable.

SearchEngine::RemoveAllSynonyms | ( |  | ) |

Definition at line 536 of file SearchEngine.php.

Referenced by SetAllSynonyms().

Here is the caller graph for this function:

SearchEngine::RemoveSynonyms | ( |  | $Word,
|  |  | $Synonyms = `NULL`
| ) |  |

Definition at line 496 of file SearchEngine.php.

SearchEngine::Search | ( |  | $SearchString,
|  |  | $StartingResult = `0`,
|  |  | $NumberOfResults = `10`,
|  |  | $SortByField = `NULL`,
|  |  | $SortDescending = `TRUE`
| ) |  |

Definition at line 86 of file SearchEngine.php.

References DMsg().

SearchEngine::SearchEngine | ( | & | $DB,
|  |  | $ItemTableName,
|  |  | $ItemIdFieldName,
|  |  | $ReferenceTableName,
|  |  | $ReferenceSourceIdFieldName,
|  |  | $ReferenceDestinationIdFieldName
| ) |  |

Definition at line 26 of file SearchEngine.php.

References $DB, $ItemIdFieldName, $ItemTableName, $ReferenceDestinationIdFieldName, $ReferenceSourceIdFieldName, $ReferenceTableName, DebugLevel(), ItemIdFieldName(), and ItemTableName().

Referenced by SPTSearchEngine\SPTSearchEngine().

Here is the caller graph for this function:

SearchEngine::SearchFieldForPhrases | ( |  | $FieldName,
|  |  | $Phrase
| ) |  |
| protected

Definition at line 1446 of file SearchEngine.php.

SearchEngine::SearchTermCount | ( |  | ) |

Definition at line 442 of file SearchEngine.php.

SearchEngine::SearchTerms | ( |  | ) |

Definition at line 311 of file SearchEngine.php.

SearchEngine::SearchTermsRequiredByDefault | ( |  | $NewSetting = `TRUE` | ) |

Definition at line 294 of file SearchEngine.php.

References DefaultSearchLogic().

SearchEngine::SearchTime | ( |  | ) |

Definition at line 316 of file SearchEngine.php.

References $LastSearchTime.

SearchEngine::SetAllSynonyms | ( |  | $SynonymList | ) |

Definition at line 667 of file SearchEngine.php.

References AddSynonyms(), and RemoveAllSynonyms().

SearchEngine::SuggestAlternateSearches | ( |  | $SearchString | ) |

Definition at line 726 of file SearchEngine.php.

SearchEngine::UpdateForItem | ( |  | $ItemId | ) |

Definition at line 357 of file SearchEngine.php.

References GetFieldContent().

Referenced by UpdateForItems(), and SPTSearchEngine\UpdateForResource().

Here is the caller graph for this function:

SearchEngine::UpdateForItems | ( |  | $StartingItemId,
|  |  | $NumberOfItems
| ) |  |

Definition at line 401 of file SearchEngine.php.

References ItemIdFieldName(), and UpdateForItem().

## Member Data Documentation

SearchEngine::$DB
| protected

Definition at line 734 of file SearchEngine.php.

Referenced by SPTSearchEngine\GetResultFacets(), SPTSearchEngine\RunUpdateForItem(), SearchEngine(), and SPTSearchEngine\SPTSearchEngine().

SearchEngine::$DebugLevel
| protected

Definition at line 735 of file SearchEngine.php.

SearchEngine::$DefaultSearchLogic = self::LOGIC_AND
| protected

Definition at line 744 of file SearchEngine.php.

Referenced by DefaultSearchLogic(), and GroupedSearch().

SearchEngine::$FilterFuncs
| protected

Definition at line 743 of file SearchEngine.php.

SearchEngine::$ItemIdFieldName
| protected

Definition at line 737 of file SearchEngine.php.

Referenced by ItemIdFieldName(), and SearchEngine().

SearchEngine::$ItemTableName
| protected

Definition at line 736 of file SearchEngine.php.

Referenced by ItemTableName(), and SearchEngine().

SearchEngine::$LastSearchTime
| protected

Definition at line 742 of file SearchEngine.php.

Referenced by SearchTime().

SearchEngine::$NumberOfResultsAvailable
| protected

Definition at line 741 of file SearchEngine.php.

Referenced by NumberOfResults().

SearchEngine::$ReferenceDestinationIdFieldName
| protected

Definition at line 740 of file SearchEngine.php.

Referenced by SearchEngine().

SearchEngine::$ReferenceSourceIdFieldName
| protected

Definition at line 739 of file SearchEngine.php.

Referenced by SearchEngine().

SearchEngine::$ReferenceTableName
| protected

Definition at line 738 of file SearchEngine.php.

Referenced by SearchEngine().

SearchEngine::$StemmingEnabled = TRUE
| protected

Definition at line 745 of file SearchEngine.php.

SearchEngine::$SynonymsEnabled = TRUE
| protected

Definition at line 746 of file SearchEngine.php.

const SearchEngine::FIELDTYPE_DATE = 3

Definition at line 22 of file SearchEngine.php.

const SearchEngine::FIELDTYPE_DATERANGE = 4

Definition at line 23 of file SearchEngine.php.

const SearchEngine::FIELDTYPE_NUMERIC = 2

Definition at line 21 of file SearchEngine.php.

const SearchEngine::FIELDTYPE_TEXT = 1

Definition at line 20 of file SearchEngine.php.

const SearchEngine::LOGIC_AND = 1

Definition at line 16 of file SearchEngine.php.

Referenced by SavedSearch\SearchGroups(), SavedSearch\TranslateSearchGroupsToTextDescription(), SavedSearch\TranslateSearchGroupsToUrlParameterArray(), and SavedSearch\TranslateUrlParametersToSearchGroups().

const SearchEngine::LOGIC_OR = 2

Definition at line 17 of file SearchEngine.php.

Referenced by SavedSearch\SearchGroups(), and SavedSearch\TranslateUrlParametersToSearchGroups().

const SearchEngine::SEARCHLOGIC_AND = 1

Definition at line 2012 of file SearchEngine.php.

const SearchEngine::SEARCHLOGIC_OR = 2

Definition at line 2013 of file SearchEngine.php.

const SearchEngine::STEM_ID_OFFSET = 1000000

Definition at line 757 of file SearchEngine.php.

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

- lib/ScoutLib/SearchEngine.php