print

Fast Search

You are here: C97net5.11 Misc Functions

A faster method to search for any items in database

Fast Search (FS) is a search alternative for traditional SQL search (SELECT * FROM table WHERE body LIKE '%keywords%'). FS offers much faster search result, up to 20x faster (or more, on large database).

To use this function please follow the steps:

1. Determine an identifier, eg. 'product'.

2. Get word list. Word list is an array listing all uniquely used words in an article.

$wl = filter_word ($input_text);

3. Then use update_wordmatch() function to enter the word list to database.

$fs = update_wordmatch ($article_id, $identifier, $word_list)

$article_id is the unique ID of the article, it can be page ID, news ID, or any ID. It must be integer.

$identifier = the identifier, eg 'product'

$word_list = the word list result from filter_word () function.

4. Be aware that, both filter_word & update_wordmatch functions only available in ACP (or by including includes/admin_func.php).

5. After that, you can use fast_search to search:

$foo = function fast_search ($query, $identifier, $mode = 'or')

$query = the query, eg. "My Book".

$identifier = the pre-defined identifier.

$mode = either 'AND' or 'OR'.

EG:

$foo = function fast_search ('My Book', 'product')

It will return array of $article_id relating with the search result.

Example 1

(coming soon)

Posted on: Aug-27-2010 at 07:00am
Last Updated: Jan-01-1970 at 07:00am

There is no comment. Why not be the first?

read more More Comments/Post Your Own

Account

Search

Tags

acp add all also any create default display don download easy echo etc features field file files folder form function includes information init kemana link list may module name need number own page php please qengine read require script set site skin time tpl url use user using version welcome