[ Index ]

PHP Cross Reference of phpBB 3.0 Beta 3

title

Body

[close]

/includes/search/ -> fulltext_native.php (summary)

(no description)

Copyright: (c) 2005 phpBB Group
License: http://opensource.org/licenses/gpl-license.php GNU Public License
Version: $Id: fulltext_native.php,v 1.35 2006/11/10 14:55:49 acydburn Exp $
File Size: 1564 lines (43 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

fulltext_native:: (14 methods):
  fulltext_native()
  split_keywords()
  keyword_search()
  author_search()
  split_message()
  index()
  index_remove()
  tidy()
  delete_index()
  index_created()
  index_stats()
  get_stats()
  cleanup()
  acp()


Class: fulltext_native  - X-Ref

fulltext_native
phpBB's own db driven fulltext search, version 2

fulltext_native(&$error)   X-Ref
Initialises the fulltext_native search backend with min/max word length and makes sure the UTF-8 normalizer is loaded.

param: boolean|string    $error    is passed by reference and should either be set to false on success or an error message on failure.

split_keywords($keywords, $terms)   X-Ref
This function fills $this->search_query with the cleaned user search query.

If $terms is 'any' then the words will be extracted from the search query
and combined with | inside brackets. They will afterwards be treated like
an standard search query.

Then it analyses the query and fills the internal arrays $must_not_contain_ids,
$must_contain_ids and $must_exclude_one_ids which are later used by keyword_search().

param: string    $keywords    contains the search query string as entered by the user
param: string    $terms        is either 'all' (use search query as entered, default words to 'must be contained in post')
return: boolean                false if no valid keywords were found and otherwise true

keyword_search($type, &$fields, &$terms, &$sort_by_sql, &$sort_key, &$sort_dir, &$sort_days, &$ex_fid_ary, &$m_approve_fid_ary, &$topic_id, &$author_ary, &$id_ary, $start, $per_page)   X-Ref
Performs a search on keywords depending on display specific params. You have to run split_keywords() first.

param: string        $type                contains either posts or topics depending on what should be searched for
param: string        $fields                contains either titleonly (topic titles should be searched), msgonly (only message bodies should be searched), firstpost (only subject and body of the first post should be searched) or all (all post bodies and subjects should be searched)
param: string        $terms                is either 'all' (use query as entered, words without prefix should default to "have to be in field") or 'any' (ignore search query parts and just return all posts that contain any of the specified words)
param: array        $sort_by_sql        contains SQL code for the ORDER BY part of a query
param: string        $sort_key            is the key of $sort_by_sql for the selected sorting
param: string        $sort_dir            is either a or d representing ASC and DESC
param: string        $sort_days            specifies the maximum amount of days a post may be old
param: array        $ex_fid_ary            specifies an array of forum ids which should not be searched
param: array        $m_approve_fid_ary    specifies an array of forum ids in which the searcher is allowed to view unapproved posts
param: int            $topic_id            is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
param: array        $author_ary            an array of author ids if the author should be ignored during the search the array is empty
param: array        $id_ary                passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered
param: int            $start                indicates the first index of the page
param: int            $per_page            number of ids each page is supposed to contain
return: boolean|int                        total number of results

author_search($type, &$sort_by_sql, &$sort_key, &$sort_dir, &$sort_days, &$ex_fid_ary, &$m_approve_fid_ary, &$topic_id, &$author_ary, &$id_ary, $start, $per_page)   X-Ref
Performs a search on an author's posts without caring about message contents. Depends on display specific params

param: string        $type                contains either posts or topics depending on what should be searched for
param: array        $sort_by_sql        contains SQL code for the ORDER BY part of a query
param: string        $sort_key            is the key of $sort_by_sql for the selected sorting
param: string        $sort_dir            is either a or d representing ASC and DESC
param: string        $sort_days            specifies the maximum amount of days a post may be old
param: array        $ex_fid_ary            specifies an array of forum ids which should not be searched
param: array        $m_approve_fid_ary    specifies an array of forum ids in which the searcher is allowed to view unapproved posts
param: int            $topic_id            is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
param: array        $author_ary            an array of author ids
param: array        $id_ary                passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered
param: int            $start                indicates the first index of the page
param: int            $per_page            number of ids each page is supposed to contain
return: boolean|int                        total number of results

split_message($text)   X-Ref
Split a text into words of a given length

The text is converted to UTF-8, cleaned up, and split. Then, words that
conform to the defined length range are returned in an array.

NOTE: duplicates are NOT removed from the return array

param: string    $text    Text to split, encoded in UTF-8
return: array            Array of UTF-8 words

index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id)   X-Ref
Updates wordlist and wordmatch tables when a message is posted or changed

param: string    $mode        Contains the post mode: edit, post, reply, quote
param: int        $post_id    The id of the post which is modified/created
param: string    $message    New or updated post content
param: string    $subject    New or updated post subject
param: int        $poster_id    Post author's user id
param: int        $forum_id    The id of the forum in which the post is located

index_remove($post_ids, $author_ids, $forum_ids)   X-Ref
Removes entries from the wordmatch table for the specified post_ids


tidy()   X-Ref
Tidy up indexes: Tag 'common words' and remove
words no longer referenced in the match table


delete_index($acp_module, $u_action)   X-Ref
Deletes all words from the index


index_created()   X-Ref
Returns true if both FULLTEXT indexes exist


index_stats()   X-Ref
Returns an associative array containing information about the indexes


get_stats()   X-Ref
No description

cleanup($text, $allowed_chars = null, $encoding = 'utf-8')   X-Ref
Clean up a text to remove non-alphanumeric characters

This method receives a UTF-8 string, normalizes and validates it, replaces all
non-alphanumeric characters with strings then returns the result.

Any number of "allowed chars" can be passed as a UTF-8 string in NFC.

param: string    $text            Text to split, in UTF-8 (not normalized or sanitized)
param: string    $allowed_chars    String of special chars to allow
param: string    $encoding        Text encoding
return: string                    Cleaned up text, only alphanumeric chars are left

acp()   X-Ref
Returns a list of options for the ACP to display




Generated: Wed Nov 22 00:35:05 2006 Cross-referenced by PHPXref 0.6