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
https://forums.phpfreaks.com/topic/91058-search-system/
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
https://forums.phpfreaks.com/topic/91058-search-system/#findComment-467547
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.