#native_company# #native_desc#
#native_cta#

Dynamic Document Search Engine – Part 1 Page 9

By M.Murali Dharan
on February 17, 2004

We can display results in two ways.

Type 1: Display the document if all the search words present in the document.
Type 2: Display the document if any one of the search words is present.
If you want to perform the Type 1 operation, include the following code snippet in to your program.

//count no of words in the search words and store in a variable
        $noofSearchWords=count($searchWords);
$noofSearchWords stores the number of search words. Later after searching search words in key
word table we get results. There we can perform logical AND operation that will display our desired results.
If $noofSearchWords is equal to number of records, the next part of the program gets
executed. Else ??NO SEARCH RESULT FOUND?? is displayed.
In the next step, we have to search for words in $searchWords array in the keyword table. The following code snippet
will return you a list of keyids that matched query.

<?php

        
//implode to an array

        
$arrWords implode("'  OR keyword='"$searchWords);

        //get the key ids from the key table

        
$query "select * from keytable where keyword='$arrWords'";

        $kResult mysql_query($query);

?>



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

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:

M.Murali Dharan

Comment:



Comment: