becu Posted September 12, 2008 Share Posted September 12, 2008 Hi, I'm trying to write a search function for my site. Let say a user input "my lovely dog", then if my site has an article let say: "my cute lovely but not very friendly doggy" -> then there's a match. but if my site has an article: "my friendly doggy lovely" -> then my search can't find this article. My question is how do you swap input text, so that it doesn't matter what order the users input, it can always find matched article. my above sample would be: my lovely dog, dog my lovely, lovely dog my...will be matched with an article entitled "my cute lovely but not very friendly doggy". Thanks. Quote Link to comment Share on other sites More sharing options...
fenway Posted September 12, 2008 Share Posted September 12, 2008 Intelligent full-text searches are very poorly supported by native mysql -- look at sphinx or lucene. Quote Link to comment Share on other sites More sharing options...
becu Posted September 12, 2008 Author Share Posted September 12, 2008 fenway, I don't own the server. I just need an okay search method for now. I guess this is more of a PHP question. let say I have an array of 3, 4 elements. Can you propose an algorithm to swap elements and get all possible arrays from this one array? $arr = array("a", "b", "c"); ==> I want (a, b, c) (a, c, b) (c, a, b) (c, b, a) (b, a, c) (b, c, a) thanks. Quote Link to comment Share on other sites More sharing options...
fenway Posted September 13, 2008 Share Posted September 13, 2008 You mean like this? Quote Link to comment Share on other sites More sharing options...
becu Posted September 13, 2008 Author Share Posted September 13, 2008 fenway, I can't access the page you gave. can you double-check the url? thanks for your help! Quote Link to comment Share on other sites More sharing options...
becu Posted September 15, 2008 Author Share Posted September 15, 2008 any ideas guys? thanks. Quote Link to comment Share on other sites More sharing options...
fenway Posted September 15, 2008 Share Posted September 15, 2008 fenway, I can't access the page you gave. can you double-check the url? thanks for your help! Sorry -- I found that here. Quote Link to comment Share on other sites More sharing options...
becu Posted September 17, 2008 Author Share Posted September 17, 2008 Thanks fenway, I will dig into it. 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.