Function __global->get_search_rows

Definitions

sources/database_search.php

  • Get some rows, queried from the database according to the search parameters.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$meta_type ?ID_TEXT No No required parameter N/A N/A The META type used by our content (null: Cannot support META search)
$id_field string No No required parameter N/A N/A The ID field that can be used to de-duplicate results / connect to the meta table; if there are multiple fields then delimit them with ':'
$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 The WHERE clause
$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 to only 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
&$order ID_TEXT Yes No required parameter N/A N/A What to order by
$direction ID_TEXT No No required parameter N/A N/A Order direction
$table ID_TEXT No No required parameter N/A N/A The table name
$select string No No * N/A N/A What to select
$trans_fields array No No [] N/A N/A The translatable fields to search over (or an !=>! which is skipped, or an <blank>=><blank> which is skipped). The first of these will be the title field unless it is !=>! (in which case the title fields will be the first raw-field) or <blank>=><blank> (in which case there is no title field)
$raw_fields array No No [] N/A N/A The non-translatable fields to search over
$permissions_module ?string No No Null N/A N/A The permission module to check category access for (null: none)
$permissions_field ?string No No Null N/A N/A The field that specifies the permissions ID to check category access for (null: none)
$permissions_field_is_string boolean No No False N/A N/A Whether the permissions field is a string

Returns

  • The rows found
  • Type: array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Get some rows, queried from the database according to the search parameters.
 *
 * @param  ?ID_TEXT $meta_type The META type used by our content (null: Cannot support META search)
 * @param  string $id_field The ID field that can be used to de-duplicate results / connect to the meta table; if there are multiple fields then delimit them with ':'
 * @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 The WHERE clause
 * @param  boolean $only_search_meta Whether to only do a META (tags) search
 * @param  boolean $only_titles Whether to only 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  ID_TEXT $order What to order by
 * @param  ID_TEXT $direction Order direction
 * @param  ID_TEXT $table The table name
 * @param  string $select What to select
 * @param  array $trans_fields The translatable fields to search over (or an !=>! which is skipped, or an <blank>=><blank> which is skipped). The first of these will be the title field unless it is !=>! (in which case the title fields will be the first raw-field) or <blank>=><blank> (in which case there is no title field)
 * @param  array $raw_fields The non-translatable fields to search over
 * @param  ?string $permissions_module The permission module to check category access for (null: none)
 * @param  ?string $permissions_field The field that specifies the permissions ID to check category access for (null: none)
 * @param  boolean $permissions_field_is_string Whether the permissions field is a string
 * @return array The rows found
 */

function get_search_rows(?string $meta_type, string $id_field, string $search_query, string $content_where, string $where_clause, bool $only_search_meta, bool $only_titles, int $max, int $start, string &$order, string $direction, string $table, string $select = '*', array $trans_fields = [], array $raw_fields = [], ?string $permissions_module = null, ?string $permissions_field = null, bool $permissions_field_is_string = false) : array