CWIS Developer Documentation

- Home
- Main Page
- Namespaces
- 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)
| 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.
| RemoveSynonyms ($Word, $Synonyms=NULL)
| RemoveAllSynonyms ()
| GetSynonyms ($Word)
| GetAllSynonyms ()
| SetAllSynonyms ($SynonymList)
| LoadSynonymsFromFile ($FileName)
| Load synonyms from a file.
| 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
| $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 45 of file SearchEngine.php.

Referenced by SPTSearchEngine\SPTSearchEngine().

Here is the caller graph for this function:

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

Definition at line 269 of file SearchEngine.php.

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

Add synonyms.

Parameters

  Word | Word for which synonyms should apply.
  Synonyms | Array of synonyms.

Returns
  Count of new synonyms added.

Definition at line 452 of file SearchEngine.php.

Referenced by LoadSynonymsFromFile(), and SetAllSynonyms().

Here is the caller graph for this function:

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

Definition at line 58 of file SearchEngine.php.

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

Definition at line 68 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 276 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 1936 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 419 of file SearchEngine.php.

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

Definition at line 412 of file SearchEngine.php.

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

Definition at line 138 of file SearchEngine.php.

References DMsg().

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

Definition at line 313 of file SearchEngine.php.

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

Definition at line 64 of file SearchEngine.php.

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

Definition at line 60 of file SearchEngine.php.

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

Definition at line 62 of file SearchEngine.php.

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

Definition at line 1608 of file SearchEngine.php.

SearchEngine::GetAllSynonyms | ( |  | ) |

Definition at line 568 of file SearchEngine.php.

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

Definition at line 1893 of file SearchEngine.php.

Referenced by UpdateForItem().

Here is the caller graph for this function:

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

Definition at line 863 of file SearchEngine.php.

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

Definition at line 533 of file SearchEngine.php.

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

Definition at line 165 of file SearchEngine.php.

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

SearchEngine::ItemCount | ( |  | ) |

Definition at line 440 of file SearchEngine.php.

SearchEngine::ItemIdFieldName | ( |  | ) |

Definition at line 57 of file SearchEngine.php.

References $ItemIdFieldName.

Referenced by SearchEngine(), and UpdateForItems().

Here is the caller graph for this function:

SearchEngine::ItemTableName | ( |  | ) |

Definition at line 56 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

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

Returns
  Number of new synonyms added.

Definition at line 679 of file SearchEngine.php.

References AddSynonyms().

SearchEngine::NumberOfResults | ( |  | ) |

Definition at line 297 of file SearchEngine.php.

References $NumberOfResultsAvailable.

SearchEngine::RemoveAllSynonyms | ( |  | ) |

Definition at line 527 of file SearchEngine.php.

Referenced by SetAllSynonyms().

Here is the caller graph for this function:

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

Definition at line 487 of file SearchEngine.php.

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

Definition at line 77 of file SearchEngine.php.

References DMsg().

SearchEngine::SearchEngine | ( | & | $DB,
|  |  | $ItemTableName,
|  |  | $ItemIdFieldName
| ) |  |

Definition at line 26 of file SearchEngine.php.

References $DB, $ItemIdFieldName, $ItemTableName, DebugLevel(), ItemIdFieldName(), and ItemTableName().

Referenced by SPTSearchEngine\SPTSearchEngine().

Here is the caller graph for this function:

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

Definition at line 1381 of file SearchEngine.php.

SearchEngine::SearchTermCount | ( |  | ) |

Definition at line 433 of file SearchEngine.php.

SearchEngine::SearchTerms | ( |  | ) |

Definition at line 302 of file SearchEngine.php.

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

Definition at line 285 of file SearchEngine.php.

References DefaultSearchLogic().

SearchEngine::SearchTime | ( |  | ) |

Definition at line 307 of file SearchEngine.php.

References $LastSearchTime.

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

Definition at line 658 of file SearchEngine.php.

References AddSynonyms(), and RemoveAllSynonyms().

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

Definition at line 717 of file SearchEngine.php.

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

Definition at line 348 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 392 of file SearchEngine.php.

References ItemIdFieldName(), and UpdateForItem().

## Member Data Documentation

SearchEngine::$DB
| protected

Definition at line 725 of file SearchEngine.php.

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

SearchEngine::$DebugLevel
| protected

Definition at line 726 of file SearchEngine.php.

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

Definition at line 732 of file SearchEngine.php.

Referenced by DefaultSearchLogic(), and GroupedSearch().

SearchEngine::$FilterFuncs
| protected

Definition at line 731 of file SearchEngine.php.

SearchEngine::$ItemIdFieldName
| protected

Definition at line 728 of file SearchEngine.php.

Referenced by ItemIdFieldName(), and SearchEngine().

SearchEngine::$ItemTableName
| protected

Definition at line 727 of file SearchEngine.php.

Referenced by ItemTableName(), and SearchEngine().

SearchEngine::$LastSearchTime
| protected

Definition at line 730 of file SearchEngine.php.

Referenced by SearchTime().

SearchEngine::$NumberOfResultsAvailable
| protected

Definition at line 729 of file SearchEngine.php.

Referenced by NumberOfResults().

SearchEngine::$StemmingEnabled = TRUE
| protected

Definition at line 733 of file SearchEngine.php.

SearchEngine::$SynonymsEnabled = TRUE
| protected

Definition at line 734 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(), 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 1947 of file SearchEngine.php.

const SearchEngine::SEARCHLOGIC_OR = 2

Definition at line 1948 of file SearchEngine.php.

const SearchEngine::STEM_ID_OFFSET = 1000000

Definition at line 745 of file SearchEngine.php.

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

- lib/ScoutLib/SearchEngine.php