snizkorod Posted July 17, 2010 Share Posted July 17, 2010 Hello, Hopefully I can get an answer here I am interested in making a search based on keywords. I am searching through a column that is TEXT; the entries are all long passages... I am interested in returning rows that contain the keywords that i'm looking for. Also, i'm extracting the stems from the keywords with the 2005 Richard Heyes (http://www.phpguru.org/) PorterStemmer algorithm. First, I need to know if using "field LIKE '%$keyword%'" search algorithm will suffice. I'm not sure if mysql will look for %$keyword% as a sub string of the text or merely treat $keyword as an absolute string? Example: query for "field LIKE '%walking%'" returns nothing from this mysql table: ID TEXT 1 "I am walking around" 2 "after a while i fall down and can't get up... Help me! So far, i have noticed that my query doesn't look for the appropriate parts... I unfortunately cannot use FULLTEXT as i'm running an InnoDB engine on this table. Any suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/207995-mysql-like-and-php-search/ Share on other sites More sharing options...
PFMaBiSmAd Posted July 17, 2010 Share Posted July 17, 2010 Since the following query does match your id 1 row (just tested), you must be doing something else wrong in your actual code or query - SELECT * FROM your_table where field LIKE '%walking%' It would take seeing some actual information about what you are doing to be able to help you. Quote Link to comment https://forums.phpfreaks.com/topic/207995-mysql-like-and-php-search/#findComment-1087307 Share on other sites More sharing options...
snizkorod Posted July 17, 2010 Author Share Posted July 17, 2010 funny how when you ask for help, you find the answer... Thanks! Seems like my LIMIT statement was using the wrong offsets. Quote Link to comment https://forums.phpfreaks.com/topic/207995-mysql-like-and-php-search/#findComment-1087310 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.