entityspaces

Count and Order By Where clause Matches

亡梦爱人 提交于 2019-12-22 11:29:05
问题 I'm writing some very simple search functionality for a list of FAQ's. I'm splitting the search string on a variety of characters, including spaces. Then performing a select along the lines of SELECT * FROM "faq" WHERE ((LOWER("Question") LIKE '%what%' OR LOWER("Question") LIKE '%is%' OR LOWER("Question") LIKE '%a%' OR LOWER("Question") LIKE '%duck%')) I've had to edit this slightly as its generated by our data access layer but it should give you an idea of whats going on. The problem is

Count and Order By Where clause Matches

寵の児 提交于 2019-12-06 10:24:10
I'm writing some very simple search functionality for a list of FAQ's. I'm splitting the search string on a variety of characters, including spaces. Then performing a select along the lines of SELECT * FROM "faq" WHERE ((LOWER("Question") LIKE '%what%' OR LOWER("Question") LIKE '%is%' OR LOWER("Question") LIKE '%a%' OR LOWER("Question") LIKE '%duck%')) I've had to edit this slightly as its generated by our data access layer but it should give you an idea of whats going on. The problem is demonstrated well with the above query in that most questions are likely to have the words a or is in them,