Function Hook_search_wiki_posts->run

Definitions

sources/hooks/modules/search/wiki_posts.php

  • Run function for search results.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$search_query string No No required parameter N/A N/A Search query
$content_where string No No required parameter N/A N/A WHERE clause that selects the content according to the search query; passed in addition to $search_query to avoid unnecessary reparsing. ? refers to the yet-unknown field name (blank: full-text search)
$where_clause string No No required parameter N/A N/A Initial WHERE clause that already takes $search_under into account (should be nothing else unless it is guaranteed hook will use the global get_search_rows function)
$search_under string No No required parameter N/A N/A Comma-separated list of categories to search under
$only_search_meta boolean No No required parameter N/A N/A Whether to only do a META (tags) search
$only_titles boolean No No required parameter N/A N/A Whether only to search titles (as opposed to both titles and content)
$max integer No No required parameter N/A N/A Start position in total results
$start integer No No required parameter N/A N/A Maximum results to return in total
$sort string No No required parameter N/A N/A The sort type (gets remapped to a field in this function)
$direction ID_TEXT No No required parameter N/A N/A Order direction
$author SHORT_TEXT No No required parameter N/A N/A Username/Author to match for
$author_id ?MEMBER No No required parameter N/A N/A Member-ID to match for (null: unknown)
$cutoff mixed No No required parameter N/A N/A Cutoff date (TIME or a pair representing the range or null)

Returns

  • List of maps (template, orderer)
  • Type: array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Run function for search results.
 *
 * @param  string $search_query Search query
 * @param  string $content_where WHERE clause that selects the content according to the search query; passed in addition to $search_query to avoid unnecessary reparsing. ? refers to the yet-unknown field name (blank: full-text search)
 * @param  string $where_clause Initial WHERE clause that already takes $search_under into account (should be nothing else unless it is guaranteed hook will use the global get_search_rows function)
 * @param  string $search_under Comma-separated list of categories to search under
 * @param  boolean $only_search_meta Whether to only do a META (tags) search
 * @param  boolean $only_titles Whether only to search titles (as opposed to both titles and content)
 * @param  integer $max Start position in total results
 * @param  integer $start Maximum results to return in total
 * @param  string $sort The sort type (gets remapped to a field in this function)
 * @param  ID_TEXT $direction Order direction
 * @param  SHORT_TEXT $author Username/Author to match for
 * @param  ?MEMBER $author_id Member-ID to match for (null: unknown)
 * @param  mixed $cutoff Cutoff date (TIME or a pair representing the range or null)
 * @return array List of maps (template, orderer)
 */

public function run(string $search_query, string $content_where, string $where_clause, string $search_under, bool $only_search_meta, bool $only_titles, int $max, int $start, string $sort, string $direction, string $author, ?int $author_id, $cutoff) : array