Hello guys,
i really hope that someone can help me with my problem. I would like to realize a match against query with multiple searchstrings.
In the moment it looks like this:
SELECT result.* FROM
(
SELECT A.TITLE AS title
MATCH(A.TITLE) AGAINST('$searchstring1' IN BOOLEAN MODE) AS REL, MATCH(A.TITLE) AGAINST('$searchstring2' IN BOOLEAN MODE) AS REL2,
FROM Data AS A) AS result
WHERE result.REL >=
(
(SELECT Max(rel_max.RELA) FROM
(SELECT A.TITLE AS title
MATCH(A.TITLE) AGAINST('$searchstring1' IN BOOLEAN MODE) AS RELA
FROM Data AS A) AS rel_max)-1)
OR
result.REL2 >=
(
(SELECT Max(rel_max2.RELA2) FROM
(SELECT A.TITLE AS title
MATCH(A.TITLE) AGAINST('$searchstring2' IN BOOLEAN MODE) AS RELA2
FROM Data AS A) AS rel_max2)-1)
As response I get all results with the tow highest relevances (max - 1). It works, but maybe there is another, much shorter and better way to realize the same, because in the example i only have two searchstrings but i search a solution with multiple n - searchstrings and i think that several OR combinations in the query for each searchstring are maybe not a good way to handle this.
So please help me, because in the moment i have no idea how i can solve this.
Thank you