Hi I have one big problem with one MYSQL search.
My database TABLE looks like this :
+------+----------+------+
| id | keywords | file |
+------+----------+------+
At keywords there are many keywords for each entry seperated with comas. (keyword1,keyword2…).
At PHP array there are listed some keywords (5-10).
And my search must get all DB entries which got atleast 3 from those keywords.
Its not required to got all of those words! But it can’t work and with just one.
Can somebody help me with that query? I don’t got good idea how to make it.
That’s a challenge. The brute force method would be to use a UNION in a subquery with a count.
For example,
More efficiently, you could have a separate table with keywords and ID, one keyword/ID combo per row. This would eliminate the wildcard search and make the query more efficient.
The next step would be to go to something like ElasticSearch and filter on the score of the result.