ePages 7.25.0 - DE_EPAGES/Search/API/Object/PagerSearch.pm

Package DE_EPAGES::Search::API::Object::PagerSearch

object interface for Search.

Base
DE_EPAGES::Presentation::API::Object::Pager
Example
# without Servlet
my $ProductClass = LoadClassByAlias('Product');
my $SearchDefinition = GetSearchDefinition($ProductClass, 'MBO-AllStrings');
my $Search = DE_EPAGES::Search::API::Object::PagerSearch->new({
    'SearchDefinition' => $SearchDefinition,
    'ObjectID' => $Shop->id,
    'OrderBy' => 'Alias',
    'Parameters' => {
        'Shop.ID' => $Shop->id,
        'SearchLanguageID' => $LanguageID,
        'NameAttributeID' => $ProductClass->attribute('Name')->id,
        'SearchString' => $SearchString,
    },
});
my $aProducts = $Search->allItems;
# with Servlet
my $ProductClass = LoadClassByAlias('Product');
my $SearchDefinition = GetSearchDefinition($ProductClass, 'MBO-AllStrings');
my $Search = DE_EPAGES::Search::API::Object::PagerSearch->new({
    'SearchDefinition' => $SearchDefinition,
    'Servlet' => $Servlet,
    'OrderBy' => 'Alias',
    'Parameters' => {
        'Shop.ID' => $Shop->id,
        'SearchLanguageID' => $LanguageID,
        'NameAttributeID' => $ProductClass->attribute('Name')->id,
        'SearchString' => $SearchString,
    },
    'UriParameters'  => {
        'Search' => 'MBO-AllStrings',
    },
});
$Servlet->vars('Pager', $Search->page->{'Pager'});
@EXPORT_OK
ReplaceWildcards
ReplaceWildcardsWithoutPosOne

Functions

ReplaceWildcards
ReplaceWildcardsWithoutPosOne
allItemIDs
allItems
countItems
execute
itemIDs
items
new
sqlFrom
sqlLimit
sqlSelect
sqlSort
sqlWhere
statistic

ReplaceWildcards

replaces * with % and adds on begin and end a %.

Syntax
my $SQLString = ReplaceWildcards($SearchString);
Input
$SearchString (string)
search string can include *
Return
$SQLString (string)
string for sql statement

ReplaceWildcardsWithoutPosOne

replaces * with % and adds on end a %.

Syntax
my $SQLString = ReplaceWildcardsWithoutPosOne($SearchString);
Input
$SearchString (string)
search string can include *
Return
$SQLString (string)
string for sql statement

allItemIDs

Returns the object id of all found objects of all pages.

Syntax
$aItemIDs = $Pager->allItemIDs;
Return
$allItemIDs (ref.array.integer)
list of object ids

allItems

Returns all objects of all pages.

Syntax
$aItems = $Pager->allItems;
Return
$aItems (ref.array.object)
list of objects

countItems

returns how many items should be paged.

Syntax
$Object->countItems;
Return
$cItems (integer)
count items

execute

executes the search.

Syntax
$Object = $Package->execute($PageNumber);
Input
$PageNumber (integer)
1-based page number.
Use 0 to query all rows, not only one page

itemIDs

Returns the ObjectIDs of all objects of a specified page. Returns all ObjectIDs if $PageNumber is 0.

Syntax
my $aItems = $Object->items($PageNumber);
Input
$PageNumber (integer)
current page number
Return
$aItemIDs (ref.array.int)
list of object ids

items

Returns all objects of a specified page. Returns all items if $PageNumber is 0.

Syntax
my $aItems = $Object->items($PageNumber);
Input
$PageNumber (integer)
current page number
Return
$aItems (ref.array.object)
array of objects

new

Creates a new search pager object.

Syntax
$Pager = $Package->new($hInfo);
Input
$hInfo (ref.hash)
parameters with used keys
  • SearchDefinition - search definition - object
  • Servlet - (optional) servlet - object
  • Page - (optional) page number. Set this value to 0 to
    query all results, not only one page.
    If $hInfo->{Servlet} is defined, the default value is 1,
    otherwise the default value is 0. - integer

See DE_EPAGES::Presentation::API::Object::Pager::new
for additional parameters
Return
$Pager (object)
pager

sqlFrom

returns the from part of sql statement

Syntax
my $From = $Object->sqlFrom;
Return
$From (string)
part of sql statement

sqlLimit

returns the limit part of the sql statement for result columns. Returns '' if $PageNumber is 0.

Syntax
my $Limit = $Object->sqlLimit($PageNumber);
Input
$PageNumber (string)
page number
Return
$Limit (string)
sql limit statement

sqlSelect

returns the select part of the sql statement for result columns

Syntax
my $Select = $Object->sqlSelect;
Return
$Select (string)
sql select statement

sqlSort

returns the OrderBy part of sql statement

Syntax
my $OrderBy = $Object->sqlSort;
Return
$OrderBy (string)
part of sql statement

sqlWhere

returns the where part of sql statement

Syntax
my $Where = $Object->sqlWhere;
Return
$Where (string)
part of sql statement

statistic

Calls countPages and countItems to collect required information for all pages.

Syntax
$Pager->statistic;