Jump to content

search system


jk11uk

Recommended Posts

Hi, im trying to create a search system for a question form i have. So i am trying to allow people to search for previuous questions. The questions people type in have a main question, then a bit of text going into more detail.

 

what is the best way to do this? i was thinking the following:

 

question is input >> remove stop words >> explode question string and store keywords into a database + associated with the question_id >> assign a strength to those keywords depending on their occurances within the main text

 

then when people search, search for matching keywords (after stop word removal) and rank depending on total score (keyword strengths added up)

 

 

Is there a better way to go about it? Is there some already available opensource code i could use?

 

any help would be greatly appreciated thanks! :)

Link to comment
Share on other sites

have a look at this then use a database ok....

 

this is the same consept but not using a database....

<?php 


$quistion=array("what is your name","how old are you","What your favrote color");


$b=array("redarrow","34","blue");

        $x=$quistion[0];
	$y=$quistion[1];
	$z=$quistion[2];


if($_POST['submit']){	


$c=$_POST['c'];


foreach($c as $c){


if($c==$b[0]){

     echo" <b>sorry the name ".$b[0]." is in our database</b>";

}
if($c==$b[1]){
	     echo"<b>sorry the age ".$b[1]." is our database</b>";
}

if($c==$b[2]){
	     echo"<b>sorry the color ".$b[2]." is in our database</b>";

}

}
}   

?>  
  <form method="POST" action="">
  
  <br>
  
  <?php echo "$x<br>"; ?>
  
  <input type="text" name="c[]">
  
  <br>

  <?php echo "$y<br>"; ?>

  <input type="text" name="c[]">

  <br>

  <?php echo "$z<br>"; ?>

  <input type="text" name="c[]">

  <br>

  <input type="submit" name="submit" value="send">

  </form>
  
  

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.