Search:

# CWIS Developers Documentation

- Main Page
- Classes
- Files

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# SearchEngine Class Reference

Inheritance diagram for SearchEngine:

[legend]
List of all members.

## 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)
| RemoveSynonyms ($Word, $Synonyms=NULL)
| RemoveAllSynonyms ()
| GetSynonyms ($Word)
| GetAllSynonyms ()
| SetAllSynonyms ($SynonymList)
| SuggestAlternateSearches ($SearchString)
| ParseSearchStringForWords ($SearchString, $IgnorePhrases=FALSE)
| GetFieldId ($FieldName)
| GetWordId ($Word, $AddIfNotFound=FALSE)
| GetWord ($WordId)
| SearchAcrossFields ($SearchStrings)
| SearchForWords ($Words, $FieldName="XXXKeywordXXX", $Scores=NULL)
| ParseSearchStringForPhrases ($SearchString)
| ParseSearchStringForGroups ($SearchString)
| SearchFieldForPhrases ($FieldName, $Phrase)
| SearchForPhrases ($Phrases, $Scores, $FieldName="XXXKeywordXXX", $ProcessNonExcluded=TRUE, $ProcessExcluded=TRUE)
| FilterOnExcludedWords ($Words, $Scores, $FieldName="XXXKeywordXXX")
| FilterOnRequiredWords ($Scores)
| CleanScores ($Scores, $StartingResult, $NumberOfResults, $SortByField, $SortDescending)
| FilterOnSuppliedFunctions ($Scores)
| SearchForComparisonMatches ($SearchStrings, $Scores)
| SetDebugLevel ($SearchStrings)
| ExtractDebugLevel ($SearchString)
| LoadScoresForAllRecords ()
| UpdateWordCount ($WordId, $ItemId, $FieldId, $Weight)
| GetFieldContent ($ItemId, $FieldName)
| RecordSearchInfoForText ($ItemId, $FieldName, $Weight, $Text, $IncludeInKeyword)
| GetMicrotime ()
## Public Attributes
const | SEARCHLOGIC_AND = 1
const | SEARCHLOGIC_OR = 2
const | SEARCHFIELD_TEXT = 1
const | SEARCHFIELD_NUMERIC = 2
const | SEARCHFIELD_DATE = 3
const | SEARCHFIELD_DATERANGE = 4
| $DB
| $DebugLevel
| $WordCountAdded
| $NumberOfResultsAvailable
| $LastSearchTime
| $FilterFuncs
| $FieldIds
| $DefaultSearchLogic
| $FieldInfo
| $RequiredTermCount
| $RequiredTermCounts
| $InclusiveTermCount
| $ExcludedTermCount
| $ItemTableName
| $ItemIdFieldName
| $SearchTermList

## Detailed Description

Definition at line 34 of file SearchEngine.php.

## Member Function Documentation

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

Definition at line 71 of file SearchEngine.php.

Referenced by SPTSearchEngine::SPTSearchEngine().

Here is the caller graph for this function:

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

Definition at line 294 of file SearchEngine.php.

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

Definition at line 469 of file SearchEngine.php.

References GetWordId().

Referenced by SetAllSynonyms().

Here is the caller graph for this function:

SearchEngine::CleanScores | ( | $ | Scores,
|  | $ | StartingResult,
|  | $ | NumberOfResults,
|  | $ | SortByField,
|  | $ | SortDescending |
| ) |  |  |

Definition at line 1406 of file SearchEngine.php.

Referenced by FieldedSearch(), GroupedSearch(), and Search().

Here is the caller graph for this function:

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

Definition at line 83 of file SearchEngine.php.

Referenced by SPTSearchEngine::SearchFieldsForComparisonMatches(), and SPTSearchEngine::SPTSearchEngine().

Here is the caller graph for this function:

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

Definition at line 89 of file SearchEngine.php.

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

Here is the caller graph for this function:

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

Definition at line 301 of file SearchEngine.php.

Referenced by GroupedSearch(), SearchEngine(), SPTSearchEngine::SearchFieldsForComparisonMatches(), and SearchTermsRequiredByDefault().

Here is the caller graph for this function:

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

Definition at line 441 of file SearchEngine.php.

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

Definition at line 434 of file SearchEngine.php.

SearchEngine::ExtractDebugLevel | ( | $ | SearchString | ) |

Definition at line 1649 of file SearchEngine.php.

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

Definition at line 159 of file SearchEngine.php.

References CleanScores(), DebugLevel(), GetMicrotime(), SearchAcrossFields(), and SetDebugLevel().

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

Definition at line 338 of file SearchEngine.php.

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

Definition at line 86 of file SearchEngine.php.

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

Definition at line 84 of file SearchEngine.php.

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

Definition at line 85 of file SearchEngine.php.

SearchEngine::FilterOnExcludedWords | ( | $ | Words,
|  | $ | Scores,
|  | $ | FieldName = `"XXXKeywordXXX"` |
| ) |  |  |

Definition at line 1339 of file SearchEngine.php.

Referenced by Search().

Here is the caller graph for this function:

SearchEngine::FilterOnRequiredWords | ( | $ | Scores | ) |

Definition at line 1382 of file SearchEngine.php.

Referenced by Search().

Here is the caller graph for this function:

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

Definition at line 1462 of file SearchEngine.php.

SearchEngine::GetAllSynonyms | ( |  | ) |

Definition at line 578 of file SearchEngine.php.

References GetWord().

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

Reimplemented in SPTSearchEngine.

Definition at line 1715 of file SearchEngine.php.

Referenced by UpdateForItem().

Here is the caller graph for this function:

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

Definition at line 823 of file SearchEngine.php.

SearchEngine::GetMicrotime | ( |  | ) |

Definition at line 1762 of file SearchEngine.php.

Referenced by FieldedSearch(), GroupedSearch(), and Search().

Here is the caller graph for this function:

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

Definition at line 543 of file SearchEngine.php.

References GetWord(), and GetWordId().

SearchEngine::GetWord | ( | $ | WordId | ) |

Definition at line 893 of file SearchEngine.php.

Referenced by GetAllSynonyms(), and GetSynonyms().

Here is the caller graph for this function:

SearchEngine::GetWordId | ( | $ | Word,
|  | $ | AddIfNotFound = `FALSE` |
| ) |  |  |

Definition at line 857 of file SearchEngine.php.

Referenced by AddSynonyms(), GetSynonyms(), and RemoveSynonyms().

Here is the caller graph for this function:

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

Definition at line 187 of file SearchEngine.php.

References CleanScores(), DebugLevel(), DefaultSearchLogic(), GetMicrotime(), SearchAcrossFields(), and SetDebugLevel().

SearchEngine::ItemCount | ( |  | ) |

Definition at line 462 of file SearchEngine.php.

SearchEngine::ItemIdFieldName | ( |  | ) |

Definition at line 82 of file SearchEngine.php.

Referenced by SearchEngine(), and UpdateForItems().

Here is the caller graph for this function:

SearchEngine::ItemTableName | ( |  | ) |

Definition at line 81 of file SearchEngine.php.

Referenced by SearchEngine().

Here is the caller graph for this function:

SearchEngine::LoadScoresForAllRecords | ( |  | ) |

Definition at line 1669 of file SearchEngine.php.

Referenced by Search().

Here is the caller graph for this function:

SearchEngine::NumberOfResults | ( |  | ) |

Definition at line 322 of file SearchEngine.php.

SearchEngine::ParseSearchStringForGroups | ( | $ | SearchString | ) |

Definition at line 1225 of file SearchEngine.php.

SearchEngine::ParseSearchStringForPhrases | ( | $ | SearchString | ) |

Definition at line 1170 of file SearchEngine.php.

Referenced by Search().

Here is the caller graph for this function:

SearchEngine::ParseSearchStringForWords | ( | $ | SearchString,
|  | $ | IgnorePhrases = `FALSE` |
| ) |  |  |

Definition at line 711 of file SearchEngine.php.

Referenced by Search().

Here is the caller graph for this function:

SearchEngine::RecordSearchInfoForText | ( | $ | ItemId,
|  | $ | FieldName,
|  | $ | Weight,
|  | $ | Text,
|  | $ | IncludeInKeyword |
| ) |  |  |

Definition at line 1721 of file SearchEngine.php.

Referenced by UpdateForItem().

Here is the caller graph for this function:

SearchEngine::RemoveAllSynonyms | ( |  | ) |

Definition at line 537 of file SearchEngine.php.

Referenced by SetAllSynonyms().

Here is the caller graph for this function:

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

Definition at line 497 of file SearchEngine.php.

References GetWordId().

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

Definition at line 98 of file SearchEngine.php.

References CleanScores(), DebugLevel(), FilterOnExcludedWords(), FilterOnRequiredWords(), GetMicrotime(), LoadScoresForAllRecords(), ParseSearchStringForPhrases(), ParseSearchStringForWords(), SearchForPhrases(), SearchForWords(), and SetDebugLevel().

SearchEngine::SearchAcrossFields | ( | $ | SearchStrings | ) |

Definition at line 921 of file SearchEngine.php.

Referenced by FieldedSearch(), and GroupedSearch().

Here is the caller graph for this function:

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

Definition at line 49 of file SearchEngine.php.

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

Referenced by SPTSearchEngine::SPTSearchEngine().

Here is the caller graph for this function:

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

Reimplemented in SPTSearchEngine.

Definition at line 1246 of file SearchEngine.php.

SearchEngine::SearchForComparisonMatches | ( | $ | SearchStrings,
|  | $ | Scores |
| ) |  |  |

Definition at line 1491 of file SearchEngine.php.

SearchEngine::SearchForPhrases | ( | $ | Phrases,
|  | $ | Scores,
|  | $ | FieldName = `"XXXKeywordXXX"`,
|  | $ | ProcessNonExcluded = `TRUE`,
|  | $ | ProcessExcluded = `TRUE` |
| ) |  |  |

Definition at line 1252 of file SearchEngine.php.

Referenced by Search().

Here is the caller graph for this function:

SearchEngine::SearchForWords | ( | $ | Words,
|  | $ | FieldName = `"XXXKeywordXXX"`,
|  | $ | Scores = `NULL` |
| ) |  |  |

Definition at line 1048 of file SearchEngine.php.

Referenced by Search().

Here is the caller graph for this function:

SearchEngine::SearchTermCount | ( |  | ) |

Definition at line 455 of file SearchEngine.php.

SearchEngine::SearchTerms | ( |  | ) |

Definition at line 327 of file SearchEngine.php.

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

Definition at line 310 of file SearchEngine.php.

References DefaultSearchLogic().

SearchEngine::SearchTime | ( |  | ) |

Definition at line 332 of file SearchEngine.php.

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

Definition at line 668 of file SearchEngine.php.

References AddSynonyms(), and RemoveAllSynonyms().

SearchEngine::SetDebugLevel | ( | $ | SearchStrings | ) |

Definition at line 1614 of file SearchEngine.php.

Referenced by FieldedSearch(), GroupedSearch(), and Search().

Here is the caller graph for this function:

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

Definition at line 682 of file SearchEngine.php.

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

Definition at line 370 of file SearchEngine.php.

References GetFieldContent(), and RecordSearchInfoForText().

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

Here is the caller graph for this function:

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

Definition at line 414 of file SearchEngine.php.

References ItemIdFieldName(), and UpdateForItem().

SearchEngine::UpdateWordCount | ( | $ | WordId,
|  | $ | ItemId,
|  | $ | FieldId,
|  | $ | Weight |
| ) |  |  |

Definition at line 1690 of file SearchEngine.php.

## Member Data Documentation

SearchEngine::$DB

Definition at line 690 of file SearchEngine.php.

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

SearchEngine::$DebugLevel

Definition at line 691 of file SearchEngine.php.

SearchEngine::$DefaultSearchLogic

Definition at line 697 of file SearchEngine.php.

SearchEngine::$ExcludedTermCount

Definition at line 702 of file SearchEngine.php.

SearchEngine::$FieldIds

Definition at line 696 of file SearchEngine.php.

SearchEngine::$FieldInfo

Definition at line 698 of file SearchEngine.php.

SearchEngine::$FilterFuncs

Definition at line 695 of file SearchEngine.php.

SearchEngine::$InclusiveTermCount

Definition at line 701 of file SearchEngine.php.

SearchEngine::$ItemIdFieldName

Definition at line 704 of file SearchEngine.php.

Referenced by SearchEngine().

SearchEngine::$ItemTableName

Definition at line 703 of file SearchEngine.php.

Referenced by SearchEngine().

SearchEngine::$LastSearchTime

Definition at line 694 of file SearchEngine.php.

SearchEngine::$NumberOfResultsAvailable

Definition at line 693 of file SearchEngine.php.

SearchEngine::$RequiredTermCount

Definition at line 699 of file SearchEngine.php.

SearchEngine::$RequiredTermCounts

Definition at line 700 of file SearchEngine.php.

SearchEngine::$SearchTermList

Definition at line 705 of file SearchEngine.php.

SearchEngine::$WordCountAdded

Definition at line 692 of file SearchEngine.php.

const SearchEngine::SEARCHFIELD_DATE = 3

Definition at line 45 of file SearchEngine.php.

const SearchEngine::SEARCHFIELD_DATERANGE = 4

Definition at line 46 of file SearchEngine.php.

const SearchEngine::SEARCHFIELD_NUMERIC = 2

Definition at line 44 of file SearchEngine.php.

const SearchEngine::SEARCHFIELD_TEXT = 1

Definition at line 43 of file SearchEngine.php.

const SearchEngine::SEARCHLOGIC_AND = 1

Definition at line 39 of file SearchEngine.php.

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

const SearchEngine::SEARCHLOGIC_OR = 2

Definition at line 40 of file SearchEngine.php.

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

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

- SearchEngine.php