#native_company# #native_desc#
#native_cta#

Dynamic Document Search Engine – Part 1 Page 10

By M.Murali Dharan
on February 17, 2004

As discussed earlier, if you need to perform Type 1 operation, you have check whether the number of search words and
number of records in query. If they are equal, you can proceed to the next step else display search result not found.
Here is the code.

<?php

     
if(mysql_num_rows($kResult) == $noofSearchWords){

    //search for the keyids in the link table and get the content id

    //Fetch title, first 200 words of the abstract in to an array

    //Display the result

    
}else{

    echo 
??NO SEARCH RESULT FOUND??;

   }

?>



The following code searches the link table for occurrences key ids. This will return an array that contains the
content ids.

<?php

while($kRow=mysql_fetch_array($kResult))

{

     
//get the link ids for each key id

     
$kid$kRow['keyid'];

     
$query "SELECT * FROM link WHERE keyid=$kid";

     
$lResult mysql_query($query);

      
//echo mysql_num_rows($lResult);

      
while($lRow=mysql_fetch_array($lResult))

      {

          
$thisContentId=$lRow["contid"];

          if(!
$contArray[$thisContentId]){

              
$contArray[$thisContentId]=1;

          }else{

              
$contArray[$thisContentId]++;

          }

      }

 }
//end of while

?>



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