Search:

# CWIS Developers Documentation

- Main Page
- Classes
- Files

- 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)
| 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 449 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.

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

Here is the caller graph for this function:

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.

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

Here is the caller graph for this function:

SearchEngine::DMsg | ( | $ | Level,
|  | $ | Msg |
| ) |  |  | `[protected]`

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

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

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

SearchEngine::GetAllSynonyms | ( |  | ) |

Definition at line 565 of file SearchEngine.php.

SearchEngine::GetFieldContent | ( | $ | ItemId,
|  | $ | FieldName |
| ) |  |  | `[protected]`

Reimplemented in SPTSearchEngine.

Definition at line 1890 of file SearchEngine.php.

Referenced by UpdateForItem().

Here is the caller graph for this function:

SearchEngine::GetFieldId | ( | $ | FieldName | ) | `[protected]`

Definition at line 860 of file SearchEngine.php.

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

Definition at line 530 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(), and DMsg().

SearchEngine::ItemCount | ( |  | ) |

Definition at line 437 of file SearchEngine.php.

SearchEngine::ItemIdFieldName | ( |  | ) |

Definition at line 57 of file SearchEngine.php.

Referenced by SearchEngine(), and UpdateForItems().

Here is the caller graph for this function:

SearchEngine::ItemTableName | ( |  | ) |

Definition at line 56 of file SearchEngine.php.

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 676 of file SearchEngine.php.

References AddSynonyms().

SearchEngine::NumberOfResults | ( |  | ) |

Definition at line 297 of file SearchEngine.php.

SearchEngine::RemoveAllSynonyms | ( |  | ) |

Definition at line 524 of file SearchEngine.php.

Referenced by SetAllSynonyms().

Here is the caller graph for this function:

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

Definition at line 484 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]`

Reimplemented in SPTSearchEngine.

Definition at line 1378 of file SearchEngine.php.

SearchEngine::SearchTermCount | ( |  | ) |

Definition at line 430 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.

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

Definition at line 655 of file SearchEngine.php.

References AddSynonyms(), and RemoveAllSynonyms().

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

Definition at line 714 of file SearchEngine.php.

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

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

References ItemIdFieldName(), and UpdateForItem().

## Member Data Documentation

SearchEngine::$DB`[protected]`

Definition at line 722 of file SearchEngine.php.

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

SearchEngine::$DebugLevel`[protected]`

Definition at line 723 of file SearchEngine.php.

SearchEngine::$DefaultSearchLogic = self::LOGIC_AND`[protected]`

Definition at line 729 of file SearchEngine.php.

SearchEngine::$FilterFuncs`[protected]`

Definition at line 728 of file SearchEngine.php.

SearchEngine::$ItemIdFieldName`[protected]`

Definition at line 725 of file SearchEngine.php.

Referenced by SearchEngine().

SearchEngine::$ItemTableName`[protected]`

Definition at line 724 of file SearchEngine.php.

Referenced by SearchEngine().

SearchEngine::$LastSearchTime`[protected]`

Definition at line 727 of file SearchEngine.php.

SearchEngine::$NumberOfResultsAvailable`[protected]`

Definition at line 726 of file SearchEngine.php.

SearchEngine::$StemmingEnabled = TRUE`[protected]`

Definition at line 730 of file SearchEngine.php.

SearchEngine::$SynonymsEnabled = TRUE`[protected]`

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

const SearchEngine::SEARCHLOGIC_OR = 2

Definition at line 1945 of file SearchEngine.php.

const SearchEngine::STEM_ID_OFFSET = 1000000

Definition at line 742 of file SearchEngine.php.

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

- SearchEngine.php