#native_company# #native_desc#
#native_cta#

Dynamic Document Search Engine – Part 1 Page 3

By M.Murali Dharan
on February 17, 2004

The code snippet given below explains every step of the program.
Searching keyword table for every word is a long process. This also reduces the efficiency of the program. To implement this
all the keywords in the keyword table is stored in an associative array $allWords. An associative array is one, which works
on B-Tree algorithm and very useful to perform searches. Here is the function.

<?php

Function LoadCurrentWords(){

global 
$allWords;

    $result mysql_query"select keyid, keyword from keytable" ) or die( "Error in executing mysql query" );

    while ( $row mysql_fetch_array($result) ) {

        
$allWords[$row[??keyword??] = $row[??keyid??];

    }

}

?>



Common Words:

$COMMON_WORDS is an associative array that stores an array of words, which are commonly used
in English Language. These words have to be removed while parsing the file.
$COMMON_WORDS=array(??a??=>1, ??as??=>1);
You can add as many common words as you like. See source code for full list of common words.

1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
|
|
|