Beasts Posted September 20, 2010 Share Posted September 20, 2010 hey, i'm working on an online dictionary for my native language. i noticed when searching, the results are sometimes inaccurate. this is my query. SELECT * FROM words WHERE word LIKE '%$q%'" for example, if i search for "tive" (supposing this is a real word) it doesnt return the word tive and will return "native" because it occurs first in the database. so i suppose basically i'm looking for a way to sort them by relevancy? Quote Link to comment https://forums.phpfreaks.com/topic/213855-accurate-search/ Share on other sites More sharing options...
mikosiko Posted September 20, 2010 Share Posted September 20, 2010 if you are trying to search looking for exact match you should not be using LIKE .... i noticed when searching, the results are sometimes inaccurate. this is my query. SELECT * FROM words WHERE word LIKE '%$q%'" your results are not inaccurate... they are exactly what are you asking for using the LIKE clause with the % pattern at the beginning/end... Quote Link to comment https://forums.phpfreaks.com/topic/213855-accurate-search/#findComment-1113041 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.