phpBB API Documentation
Class

fulltext_native

class fulltext_native extends search_backend

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

Properties

$ignore_words
$match_synonym
$replace_synonym
$stats
$word_length
$search_query
$common_words
$must_contain_ids
$must_not_contain_ids
$must_exclude_one_ids

Methods

search_backend($error)

from search_backend
get_ignore_words()

Retrieves a language dependend list of words that should be ignored by the search

from search_backend
get_synonyms()

Stores a list of synonyms that should be replaced in $this->matchsynonym and $this->replacesynonym and caches them

from search_backend
int obtain_ids($search_key, $result_count, $id_ary, $start, $per_page, $sort_dir)

Retrieves cached search results

from search_backend
save_ids($search_key, $keywords, $author_ary, $result_count, $id_ary, $start, $sort_dir)

Caches post/topic ids

from search_backend
destroy_cache($words, $authors = false)

Removes old entries from the search results table and removes searches with keywords that contain a word in $words.

from search_backend
fulltext_native($error)

Initialises the fulltext_native search backend with min/max word length and makes sure the UTF-8 normalizer is loaded.

split_keywords($keywords, $terms)

This function fills $this->search_query with the cleaned user search query.

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, $author_name, $id_ary, $start, $per_page)

Performs a search on keywords depending on display specific params.

author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_ary, $author_name, $id_ary, $start, $per_page)

Performs a search on an author's posts without caring about message contents.

split_message($text)

Split a text into words of a given length

index($mode, $post_id, $message, $subject, $poster_id, $forum_id)

Updates wordlist and wordmatch tables when a message is posted or changed

index_remove($post_ids, $author_ids, $forum_ids)

Removes entries from the wordmatch table for the specified post_ids

tidy()

Tidy up indexes: Tag 'common words' and remove words no longer referenced in the match table

delete_index($acp_module, $u_action)

Deletes all words from the index

index_created()

Returns true if both FULLTEXT indexes exist

index_stats()

Returns an associative array containing information about the indexes

get_stats()

cleanup($text, $allowed_chars = null, $encoding = 'utf-8')

Clean up a text to remove non-alphanumeric characters

acp()

Returns a list of options for the ACP to display

Details

in search_backend at line 38
public search_backend($error)

Parameters

$error

in search_backend at line 47
public get_ignore_words()

Retrieves a language dependend list of words that should be ignored by the search

in search_backend at line 69
public get_synonyms()

Stores a list of synonyms that should be replaced in $this->matchsynonym and $this->replacesynonym and caches them

in search_backend at line 98
public int obtain_ids($search_key, $result_count, $id_ary, $start, $per_page, $sort_dir)

Retrieves cached search results

Parameters

$search_key
$result_count
$id_ary
$start
$per_page
$sort_dir

Return Value

int SEARCHRESULTNOTINCACHE or SEARCHRESULTINCACHE or SEARCHRESULT_INCOMPLETE

in search_backend at line 158
public save_ids($search_key, $keywords, $author_ary, $result_count, $id_ary, $start, $sort_dir)

Caches post/topic ids

Parameters

$search_key
$keywords
$author_ary
$result_count
$id_ary
$start
$sort_dir

in search_backend at line 267
public destroy_cache($words, $authors = false)

Removes old entries from the search results table and removes searches with keywords that contain a word in $words.

Parameters

$words
$authors

at line 47
public fulltext_native($error)

Initialises the fulltext_native search backend with min/max word length and makes sure the UTF-8 normalizer is loaded.

Parameters

$error

at line 82
public split_keywords($keywords, $terms)

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 $mustnotcontainids, $mustcontainids and $mustexcludeoneids which are later used by keyword_search().

Parameters

$keywords
$terms

Performs a search on keywords depending on display specific params.

You have to run split_keywords() first.

Parameters

$type
$fields
$terms
$sort_by_sql
$sort_key
$sort_dir
$sort_days
$ex_fid_ary
$m_approve_fid_ary
$topic_id
$author_ary
$author_name
$id_ary
$start
$per_page

Performs a search on an author's posts without caring about message contents.

Depends on display specific params

Parameters

$type
$firstpost_only
$sort_by_sql
$sort_key
$sort_dir
$sort_days
$ex_fid_ary
$m_approve_fid_ary
$topic_id
$author_ary
$author_name
$id_ary
$start
$per_page

at line 1039
public split_message($text)

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

Parameters

$text

at line 1118
public index($mode, $post_id, $message, $subject, $poster_id, $forum_id)

Updates wordlist and wordmatch tables when a message is posted or changed

Parameters

$mode
$post_id
$message
$subject
$poster_id
$forum_id

at line 1277
public index_remove($post_ids, $author_ids, $forum_ids)

Removes entries from the wordmatch table for the specified post_ids

Parameters

$post_ids
$author_ids
$forum_ids

at line 1337
public tidy()

Tidy up indexes: Tag 'common words' and remove words no longer referenced in the match table

at line 1402
public delete_index($acp_module, $u_action)

Deletes all words from the index

Parameters

$acp_module
$u_action

at line 1426
public index_created()

Returns true if both FULLTEXT indexes exist

at line 1439
public index_stats()

Returns an associative array containing information about the indexes

at line 1453
public get_stats()

at line 1476
public cleanup($text, $allowed_chars = null, $encoding = 'utf-8')

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.

Parameters

$text
$allowed_chars
$encoding

at line 1706
public acp()

Returns a list of options for the ACP to display