The SearchManager class provides a simple API for searching across all Searchable records in the application database.
More...
The SearchManager class provides a simple API for searching across all Searchable records in the application database.
- Author
- andy
Definition at line 47 of file search_manager.inc.
◆ buildSearchMap()
static SearchManager::buildSearchMap |
( |
| ) |
|
|
static |
Definition at line 80 of file search_manager.inc.
91 Cache::put(
"fakoli_search_map",
$map);
static fireEvent($event, $parameter=null, $mustBeConsumed=false)
Fire an event to all subscribers as detailed in their manifests.
◆ compareDate()
static SearchManager::compareDate |
( |
|
$item1, |
|
|
|
$item2 |
|
) |
| |
|
static |
Definition at line 261 of file search_manager.inc.
263 return strtotime($item2->date()) - strtotime($item1->date());
◆ compareRelevance()
static SearchManager::compareRelevance |
( |
|
$item1, |
|
|
|
$item2 |
|
) |
| |
|
static |
Definition at line 237 of file search_manager.inc.
239 return ($item1->relevance() > $item2->relevance())?-1:1;
◆ compareTitle()
static SearchManager::compareTitle |
( |
|
$item1, |
|
|
|
$item2 |
|
) |
| |
|
static |
◆ doSearch()
SearchManager::doSearch |
( |
|
$params | ) |
|
Definition at line 152 of file search_manager.inc.
156 if (is_object($params))
158 $class_array = $_REQUEST[
"searchable_classes:"];
162 $params = trim($params);
168 $this->searchResults = array();
178 foreach($searchables as $searchable)
180 if ($class_array && !array_key_exists($searchable, $class_array))
continue;
182 $obj =
new $searchable;
183 $results =
$obj->search($params);
static using()
Import the datamodels, views and manifest for the specified component(s).
◆ drawFacets()
SearchManager::drawFacets |
( |
|
$id = null | ) |
|
Definition at line 271 of file search_manager.inc.
273 trace(
"Drawing Facets", 3);
274 trace(getBacktrace(0), 3);
277 if ($this->drawnFacets || !$this->facetManager)
return;
281 $this->facetManager->id =
$id;
284 $script .= $this->facetManager->writeScript();
285 echo $this->facetManager->drawForm();
287 $this->drawnFacets =
true;
◆ extractDataItems()
SearchManager::extractDataItems |
( |
| ) |
|
◆ formatResults()
SearchManager::formatResults |
( |
| ) |
|
Definition at line 116 of file search_manager.inc.
118 switch($this->displayMode)
121 $this->list =
new DataListView($this->
extractDataItems(),
"search_results");
122 $this->list->emptyMessage =
"Your search did not match any items.";
123 $this->list->writeIdTag =
true;
124 $this->list->sortable =
true;
125 $this->list->filter =
false;
131 $this->list->emptyList =
"Your search did not match any items.";
132 $this->list->writeIdTag =
true;
135 if ($this->enableFacetFilter)
137 $this->facetManager =
new FacetManager(
'facet_manager', $this->list);
139 trace(
"Facet Classes: ".implode(
", ",
$classes), 3);
141 if ($this->searchResultTypeFacet)
The SearchManager class provides a simple API for searching across all Searchable records in the appl...
static formatSearchResult($item)
static addFacets($manager, $classes, $dropdown=true, $max_width="200px", $width="200px", $height="120px")
◆ formatSearchResult()
static SearchManager::formatSearchResult |
( |
|
$item | ) |
|
|
static |
◆ getSearchableClasses()
SearchManager::getSearchableClasses |
( |
| ) |
|
Definition at line 196 of file search_manager.inc.
199 if (isset($_REQUEST[
"searchable_classes:"]))
201 $class_array = $_REQUEST[
"searchable_classes:"];
208 foreach($searchables as $searchable)
210 if ($class_array && !array_key_exists($searchable, $class_array))
continue;
◆ search()
SearchManager::search |
( |
|
$params | ) |
|
Definition at line 96 of file search_manager.inc.
104 trace(
"Search Handler: ".get_class($searchHandler), 3);
105 $this->searchResults = $searchHandler->search($params, $this);
109 trace(
"Search Handler: Using built-in SearchManager", 3);
◆ SearchManager()
SearchManager::SearchManager |
( |
|
$results = null | ) |
|
◆ setDefaults()
static SearchManager::setDefaults |
( |
| ) |
|
|
static |
Definition at line 71 of file search_manager.inc.
73 Settings::setDefaultValue(
"search",
"search_result_format",
"Combined List",
"String",
"Specifies the display format to use when displaying results",
"",
"Combined List\nGrouped by Type");
74 Settings::setDefaultValue(
"search",
"results_per_page",
"20",
"Number",
"Specifies the number of results to show per page. Set to zero for no pagination.");
75 Settings::setDefaultValue(
"search",
"show_text_fragment",
false,
"Boolean",
"Specifies whether to show with the search results. Note that not all search types will return a text fragment");
static setDefaultValue($component, $name, $value, $field_type="String", $annotation="", $category="", $options="", $weight=0)
Sets the default value of the given component setting.
◆ showResults()
SearchManager::showResults |
( |
|
$pageSize = 0 | ) |
|
Definition at line 290 of file search_manager.inc.
303 $script .= $this->list->writeScript();
305 $num = count($this->searchResults);
309 echo
"<p><em>$num ".pluralize(
"match", $num).
" found.</em></p>";
314 switch($this->displayMode)
317 $this->list->drawView();
322 $this->list->drawList();
static getValue($component, $name)
Retrieve the value of the specified Setting.
◆ sortByDate()
SearchManager::sortByDate |
( |
| ) |
|
Definition at line 254 of file search_manager.inc.
256 trace(
"Sorting ".count($this->searchResults).
" items by date", 3);
static compareDate($item1, $item2)
◆ sortByRelevance()
SearchManager::sortByRelevance |
( |
| ) |
|
Definition at line 230 of file search_manager.inc.
232 trace(
"Sorting ".count($this->searchResults).
" items by relevance", 3);
static compareRelevance($item1, $item2)
◆ sortByTitle()
SearchManager::sortByTitle |
( |
| ) |
|
Definition at line 242 of file search_manager.inc.
244 trace(
"Sorting ".count($this->searchResults).
" items by title", 3);
static compareTitle($item1, $item2)
◆ upgradeComponent()
static SearchManager::upgradeComponent |
( |
|
$version | ) |
|
|
static |
◆ wrap()
static SearchManager::wrap |
( |
|
$items, |
|
|
|
$resultClass |
|
) |
| |
|
static |
◆ $displayMode
SearchManager::$displayMode = "list" |
◆ $facetDropdown
SearchManager::$facetDropdown = true |
◆ $facetHeight
SearchManager::$facetHeight = "120px" |
◆ $facetMaxWidth
SearchManager::$facetMaxWidth = "200px" |
◆ $facetWidth
SearchManager::$facetWidth = "200px" |
◆ $map
◆ $searchResults
SearchManager::$searchResults |
◆ $useFacetFilter
SearchManager::$useFacetFilter = false |
The documentation for this class was generated from the following file: