son Posted December 14, 2009 Share Posted December 14, 2009 I created a fulltext across three columns with the query ALTER TABLE products ADD FULLTEXT (product, description, detail) which resulted in the table info as: product FULLTEXT No No product 0 description 0 YESdetail 0 YES I try to run a query on word or phrase passed from search input field as: SELECT product_id, product FROM products WHERE MATCH (product, description, detail) AGAINST ('$st') But it does not return anything (also the term exists in description column for several products).Where am I going wrong?Son Link to comment Share on other sites More sharing options...
justsomeguy Posted December 14, 2009 Share Posted December 14, 2009 Does this apply to you: A natural language search interprets the search string as a phrase in natural human language (a phrase in free text). There are no special operators. The stopword list applies. In addition, words that are present in 50% or more of the rows are considered common and do not match. Full-text searches are natural language searches if the IN NATURAL LANGUAGE MODE modifier is given or if no modifier is given.The stopword list are things like "an" or "some", common words that aren't counted in searching. Link to comment Share on other sites More sharing options...
son Posted December 14, 2009 Author Share Posted December 14, 2009 Does this apply to you:The stopword list are things like "an" or "some", common words that aren't counted in searching.I had the term in more than 50% of the rows. Cheers, that was it. Just one more question. I pass the search string via Get from form to search page as:search.php?st=golden+gate&submit=GOfor example.Sometimes I saw that the words are separated by % (on other website). When would that be useful?Son Link to comment Share on other sites More sharing options...
justsomeguy Posted December 15, 2009 Share Posted December 15, 2009 It's just different encoding. Most servers will recognize a plus sign as a space, but if everything is hex encoded a space is %20. This would also work:search.php?st=golden%20gate&submit=GO Link to comment Share on other sites More sharing options...
son Posted December 15, 2009 Author Share Posted December 15, 2009 It's just different encoding. Most servers will recognize a plus sign as a space, but if everything is hex encoded a space is %20. This would also work:search.php?st=golden%20gate&submit=GOBut this is not something I need to set, isn it? I simply retrieve whatever is submitted from input field with:if (isset($_GET['st'])) {$st = $_GET['st'];} I have not made any conventions about putting words togehter with a plus sign or similar...Son Link to comment Share on other sites More sharing options...
justsomeguy Posted December 15, 2009 Share Posted December 15, 2009 No, the server will decode that as a space when it gets the value. The encoding is just for passing it in the URL. Link to comment Share on other sites More sharing options...
son Posted December 15, 2009 Author Share Posted December 15, 2009 No, the server will decode that as a space when it gets the value. The encoding is just for passing it in the URL.Thanks. Good to know I have not left anything out by mistake...Son Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.