Package DE_EPAGES::RemoteSearch::API::RemoteSearchImpl
High level API used by scripts from the RemoteSearch cartridge
Base |
Exporter |
@EXPORT_OK |
Functions
- DropAllSearchIndexes
- GetDestinctSelections
- GetOrCreateSearchIndex
- GetPageSizeForSearch
- IsRemoteSearchActive
- MarkShopDirty
- RunIfRemoteSearchInitialized
- SearchProducts
- SearchProductsSqlFallback
- UpdateSearchStatistics
- UseSearchInCategoryContext
DropAllSearchIndexes
Resets search info on shop and tries to delete the index from the remote search, if needed.
Syntax |
DropAllSearchIndexes( $Shop ); DropAllSearchIndexes( $Shop, $DropRemote ); |
Input |
|
GetDestinctSelections
This function filters facet part of search result from function SearchProducts, and return only unique selections or an empty string. For example: Customer is looking for shirt with color black or white, in size XL and should have one pocket. This would result in {"size":"XL", "NumberPockets":"one"}. Color is omitted because more then one value is selected for this facet.
Syntax |
GetDestinctSelections( $aFacets ); |
Example |
my $JSONDestinct = GetDestinctSelections( $hResponse->{facets} ); |
Input |
|
Return |
|
GetOrCreateSearchIndex
Creates (if necessary) and returns SearchIndex object. Does not set the remote call to index the shop. Use DE_EPAGES::RemoteSearch::API::Object::IndexManager for that.
Syntax |
my $SearchIndex = GetOrCreateSearchIndex( $Shop ); |
Input |
|
Return |
|
GetPageSizeForSearch
Return PagerSettings for product search
Syntax |
$PageSize = GetPageSizeForSearch( $Shop ); |
Input |
|
Return |
|
IsRemoteSearchActive
Check if remote search can be used for the shop
Syntax |
my $IsUseable = IsRemoteSearchActive( $Shop ); |
Input |
|
Return |
|
MarkShopDirty
Mark (existing) search index of $Shop as dirty.
Syntax |
MarkShopDirty( $Shop ); |
Input |
|
RunIfRemoteSearchInitialized
Runs code if remote search is active and RemoteSearchIndex object has been created. Passes RemoteProductSearchIndex object into the sub. Non-fatal Errors get turned into Warnings.
Syntax |
RunIfRemoteSearchInitialized( $Shop, $cSub ); |
Example |
RunIfRemoteSearchActive($Shop, sub { my ($Search) = @_; $Search->updateItems([ $Product ]); }); |
Input |
|
SearchProducts
Execute product search in $Shop. See DE_EPAGES::RemoteSearch::API::Object::SearchParamBuilder for configuration options.
Syntax |
SearchProducts( $Shop, $ParamBuilder ); |
Input |
|
Return |
|
SearchProductsSqlFallback
This method is deprecated and may be removed in near future!
Construct an PagerSearch, which can execute a product search with SQL.
Use of this method should limited to fallback solution if SearchProducts
is failing. Keep in mind the SQL fallback execute strict *PATTERN* search, which
will lead to heavy load on database and may take long time to yield a result.
Syntax |
$Pager = SearchProductsSqlFallback( $Shop, $ParamBuilder ); |
Input |
|
Return |
|
UpdateSearchStatistics
Registers the user's search query at our search statistics.
Search services automatically provides a fallback if a query
yields to no results.
If fallback search kicks in, the results are registered against
fallback term.
Syntax |
UpdateSearchStatistics( $Shop, $Query, $Results, $Fallback); |
Input |
|
UseSearchInCategoryContext
The display of search setting tab in MBO is controlled with shop feature 'DetailedSearch'. It is desireable to execute advanced searches only if Merchant can configure them.
Syntax |
UseSearchInCategoryContext( $Shop ); |
Input |
|
Return |
|