Search

Extends Object. The base search Object is a generic search algorithm returning basic page, category and product results. For more specific or more detailed search algorithms you may wish to look at PageSearch, CategorySearch or ProductSearch.

Methods
find(String:phrase) Search

Sets a search phrase for the algorithm to find.

Returns the original Search object allowing for method chaining.

hasNextPage() Boolean

Returns true if the search has more results to show, or false if not.

hasPreviousPage() Boolean

Returns true if the current page number is greater than one, or false there are no prior results.

hasResults() Boolean

Returns true if the search has one or more results.

hasSortString(String:value) Boolean

Returns true if the search algorithm supports the supplied value as method of sorting results.

isFirstPage() Boolean

Returns true if this is the first page of results.

isLastPage() Boolean

Returns true if this is the last page of results.

length() Number

The number of items within the current result set. This will be less than or equal to the page size.

limit(Number:length) Search

Sets the result set limit to return in the search.

nextPage() Number | null

Returns the Number of the next page in the results sequence.

Returns Null if there are no further pages.

nextPageUrl() Url | null

Returns the Url of the next page in the results sequence.

Returns Null if there are no further pages.

offset(Number:displacement) Search

Sets the index from which to search from. Offset is zero indexed.

orderBy(String:order) Search

Sets the order and direction of the search. The available order strings for this algorithm are:

  • age:asc
  • age:desc
  • price:asc
  • price:desc
  • title:asc
  • title:desc
page([Number:num]) Search

Gets or sets the current page number of the search results.

paginate() Search

Deprecated.

This method no longer has any effect, but remains for backwards compatibility and now returns the original search object.

perPage([Number:limit]) Search

Gets or sets the result set size per page.

phrase() String

The key phrase to find in the search.

previousPage() Number | null

Returns the Number of the previous page in the results sequence.

Returns Null if was no previous page.

previousPageUrl() Url | null

Returns the Url of the previous page in the results sequence.

Returns Null if there was no previous page.

requestPagination()

Automate limit(), sort(), and page() using default query parameters from the Request object.

results() SearchCollection

The appropriate collection for the result set.

sort(String:sortstring)

Alias of orderBy() (above)

total() Number

The total number of results available for the search.

totalPages() Number

The total number of pages available for the search.