I have a user auto suggest that allows the user to choose OR not to choose the suggested items. In my query the condition with OR logic does not work. The ID based search can also be a list of up to 30 ids or so.
WHERE MATCH(‘@(name,location,summary), bike’) OR company_id IN (1)
If the AND operator is used, it works but this is not what I need.
WHERE MATCH(‘@(name,location,tags), bike’) AND company_id IN (1)
My current solution is doing 2 queries :
- MATCH()
- ID based query
Then I merge them together in PHP. I have this kind of user input logic in plenty of areas in my application and I think there might be a more efficient way of doing this.