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)

Sets a search phrase for the algorithm to find

Returns the original Search object allowing for method chaining.

highlight(String:phrase)

Returns a new String containing a mutated copy of the original with highlights around matching key words. This method is used when iterating through searh results to highlight search matches within the results.

limit(Number:length)

Sets the result set limit to return in the search.

Returns the original Search object allowing for method chaining.

offset(Number:displacement)

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

Returns the original Search object allowing for method chaining.

orderBy(String:order)

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

Returns the original Search object allowing for method chaining.

paginate()

Returns a Pagination Object

Allows you to paginate results from the search using the Pagination object.

phrase()

Returns a String

The key phrase to find in the search.

results()

Returns a SearchCollection

The appropriate collection for the result set.

total()

Returns a Number

The total number of results available for the search.