SproutCMS

This is the code documentation for the SproutCMS project

function query()

Does a query for a term, against a set of search handlers

Usage

array Search::query ( string $query , array $search_handlers [, int $page [, int $num_per_page ]] );

Arguments

  1. string $query
    $q The keyword(s) to search for.
  2. array $search_handlers
    Search handlers to use. Expects an array of SearchHandler objects.
  3. int $page = 0
    The page number to show. Should be 0-based (first page is num 0)
  4. int $num_per_page = NULL
    The number of records to show per page. Defaults to a the sprout config option

Return value

  • array
    The array contains 4 keys:
            [0] PDOStatement, with three columns: record_id; controller_class; relevancy.
            [1] array The list of keywords used for the search
            [2] int The total number of results available; results are
                paginated, so this is likely to be more than the number of
                results returned.
            [3] int The total number of pages of results