File/program/modules/althing/althing_search.php

Description

/program/modules/althing/althing_search.php - interface to the search-part of this module

This file defines the interface with this module for searching content. The interface consists of a (temporary) table and this function:

    bool althing_search(&$hits,&$results,$qwords, $limit, $offset)

The function is called whenever module content is to be searched. At that point the helper table, which is called 'search_nodes', exists and is populated.

Includes
 require_once (dirname(__FILE__)."/althing_common.php") (line 37)
Functions
althing_search (line 64)

search this module's content in selected nodes for keywords in $qwords

This interface is documented in htmlpage_search() in htmlpage_search.php.

We have to search the following fields in two tables:

a. althings: 1 record/althing: header/introduction/question/conclusion/footer

b. althing_posts: 0,1,...N records/althing: subject/author/content

Althings always qualify (the 5 fields are always visible) Posts only qualify when althing status is 0 (open) or 1 (frozen) AND the post is published and visible

Hits in althings link to the main page (node=$node_id) Hits in the posts link to node=$node_id,post=$post_id

The content in posts is converted from BBCode to HTML before starting the search,

  • return: FALSE on failure, TRUE on success and $hits, $results updated (maybe)
bool|array althing_search (array &$hits, int &$results, array $qwords, int $limit, [int $offset = 0])
  • array &$hits: receives search results (at most $limit)
  • int &$results: receives number of hits (negative value on entry means (re-)calculate total)
  • array $qwords: holds 1 or more keywords to search for (original, utf8lower, quoted)
  • int $limit: maximum number of hits to return (could be 0)
  • int $offset: starting point within this module for returning results
althing_search_results (line 190)

count the number of hits in $table

  • return: FALSE on error, # of hits otherwise (could be 0)
bool|int althing_search_results (string $table, string $where)
  • string $table: name of table to search
  • string $where: where clause to select hits in $table

Documentation generated on Tue, 28 Jun 2016 19:08:18 +0200 by phpDocumentor 1.4.0