Reputation: 181
I'm trying to make a FULLTEXT query and encountering an error.
Below is the query:
SELECT `o`.`fruits_id`
FROM `fruits` as `o` JOIN `fruits_categories` as `oc` ON `o`.`fruits_id` = `oc`.`fruits_id`
JOIN `categories` as `c` ON `c`.`cat_id` = `oc`.`cat_id`
JOIN `fruits_location` as `ol` ON `o`.`fruits_id` = `ol`.`fruits_id`
JOIN `location` as `l` ON `l`.`location_id` = `ol`.`location_id`
JOIN `fruits_price` as `op` ON `o`.`fruits_id` = `op`.`fruits_id`
JOIN `price` as `p` ON `p`.`price_id` = `op`.`price_id`
WHERE ( (MATCH (o.fruits_name, o.fruits_description, o.address, o.instagram_tag) AGAINST ('apple') OR MATCH (c.cat_name) AGAINST ('apple') OR MATCH (l.location_name) AGAINST ('apple') OR MATCH (p.price_name) AGAINST ('apple') )
AND (MATCH (o.fruits_name, o.fruits_description, o.address, o.instagram_tag) AGAINST ('orange') OR MATCH (c.cat_name) AGAINST ('orange') OR MATCH (l.location_name) AGAINST ('orange') OR MATCH (p.price_name) AGAINST ('orange') ) )
on the tables I have:
fruits
FULLTEXT KEY `fruits_name` (`fruits_name`),
FULLTEXT KEY `fruits_description` (`fruits_description`),
FULLTEXT KEY `address` (`address`),
FULLTEXT KEY `instagram_tag` (`instagram_tag`)
categories
FULLTEXT KEY `cat_name` (`cat_name`)
location
FULLTEXT KEY `location_name` (`location_name`)
price
FULLTEXT KEY `price_name` (`price_name`)
And I'm getting this error:
Can't find FULLTEXT index matching the column list
Upvotes: 1
Views: 49
Reputation: 34284
The problem is that you indexed your fields separately in the fruits table, but you try to search them in a combined way in your query! Drop the existing fulltext indexes in the fruit table and create a new composite index on those 4 fields.
Upvotes: 1