How to fasten up the %like search? I need help. Idea 1= limit, idea 2= split comma keywords to seperate columns
- It is a comma seperated keyword list.
- After 1000 results the search query could stop, to fasten the search query (how?).
- If i could use a limit, i need to let the search query start with the "best rated products" = "rating" and stop after around 1000 results (how?).
- my search query:
replace(b.keywords,',',' ') like '% ".$searchvalue."%')";
My idea (1) is to limit the results to 1000. But how can I control the select so that the products with the best rating are searched first and will not be missed. As soon as 1000 (max) are found, the query should stop. But the best-rated products should be searched first or will be missed. After 1000 results the search query should stop, to fasten the search query.
I have a table PRODUCTS. A RATING from 0 up to 10.000.
ID RATING PRODUCTS KEYWORDS
1 1000 p1 keyword1,keyword2,...,keyword100
... 4 ... ...
99000 200 p99000 keyword1,keyword99,...,keyword999
"Rating" and "keywords" (multilingual) are changing from time to time.
My idea (2) is to seperate each keyword in a single column. So i would not need the leading % $searchvalue%. But iam worried, there will be at least 200 additional columns for each product and this will result in the same slowly search query (?). What do you think?
ID RATING PRODUCTS KEYWORD1 KEYWORD2 KEYWORD3 ... KEYWORD**200**
1 1000 p1 red blue yellow ... yellow-orange
... 4 ... ...
99000 200 p99000 black blue orange ... yellow-orange