jk11uk Posted February 14, 2008 Share Posted February 14, 2008 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! Quote Link to comment Share on other sites More sharing options...
jk11uk Posted February 14, 2008 Author Share Posted February 14, 2008 ??? any ideas? Quote Link to comment Share on other sites More sharing options...
Isityou Posted February 14, 2008 Share Posted February 14, 2008 EDIT: Sorry misread your question. Regular Expressions could come in handy here. Quote Link to comment Share on other sites More sharing options...
jk11uk Posted February 15, 2008 Author Share Posted February 15, 2008 i got excited then and though someone had worked it out. Anyone else ? Quote Link to comment Share on other sites More sharing options...
redarrow Posted February 15, 2008 Share Posted February 15, 2008 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> Quote Link to comment Share on other sites More sharing options...
jk11uk Posted February 17, 2008 Author Share Posted February 17, 2008 sorry, i dont think you understood the question. I know how to do an input form but i don't know how to make a decent search system so people can search for questions Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.