0

I saw so many similar question with this same error and the solution is altering the table by adding FULLTEXT to the columns.

But now the problem is I'm writing the query to a VIEW instead of an table. So I can't alter the columns as mentioned in the solution the I gone through.

So how can I solve this issue when it queries to a VIEW.

VIEW:

CREATE OR REPLACE VIEW result AS  select p.f_name AS fullname, 
p.experience AS experience,
group_concat(distinct s.name
order by s.name ASC separator ', ') AS skills, 
p.location AS location from (personal p left join 
reg r on((p.reg_id = r.id))) 
left join prof_skill ps on((r.id = ps.reg_id)) left join skills s 
on((ps.skill_id = s.id)) group by r.id ;

FULL-TEXT Query:

SELECT `registration_no`, `location`, `skills`, `fullname`, `experience`, `active` 
FROM `result` 
LEFT JOIN `review` ON `result`.`registration_no` = `review`.`reg_id` AND 
`review`.`active` = 0 
WHERE ( MATCH (fullname,experience,skills,location) 
AGAINST ('+henna' IN BOOLEAN MODE) ) 
AND (`result`.`active` =0 ) GROUP BY `registration_no`  

Structure:

enter image description here

INDEXES:

enter image description here

Shihas
  • 814
  • 15
  • 44
  • Make sure the underlying columns in the table have full text indexes? – Gordon Linoff Feb 25 '18 at 13:46
  • I added fulltext indexes in their base table. But still the same error is there. – Shihas Feb 25 '18 at 13:54
  • @GordonLinoff This problem comes to my server db. In local it was fine. – Shihas Feb 25 '18 at 13:56
  • Please add the view definition and the table definition (at least the fulltext indexes) so we can do more than just guessing or listing all 1266 possibilities that may lead to that error message. My best guess though: the view is modifying at least one of the indexes columns, which prevents you from using it in a fulltext search. – Solarflare Feb 25 '18 at 15:27
  • @Solarflare Updated with the VIEW and FULL-TEXT query. – Shihas Feb 26 '18 at 07:18
  • Thanks for the update. You created the column "skills". While there might be a fulltext index on their parts (`s.name`, but you didn't show the indexes), this cannot be used to search in the derived column. Also, you cannot use a fulltext index that spans two tables (`s` and `p`). You could maybe use `match (3 columns) against ... or skills like '%henna%')` or something like `match (3 columns) against ... or exists (select 1 from skills s where name = 'henna' and ps.skill_id = s.id)`, although you should use the table directly for that query, not the view. – Solarflare Feb 26 '18 at 09:58
  • @Solarflare Okay. I removed skills from MATCH clause and still the same error. And I updated the indexes for location, f_name and experience. – Shihas Feb 26 '18 at 12:14
  • Ah, I missed another problem: you are grouping by `r.id`. This invalidates the fulltext index (e.g. "p.f_name" is not the original value, but a value after grouping. Actually a random value out of all possible values, see [here](https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html), but that is a different topic). Not sure why you get this error message, the error message should be something like "table type does not support fulltext indexes". What version are you using? Anyway, the solution is to query the tables directly without the view or try to write it without a `group by`. – Solarflare Feb 26 '18 at 13:09
  • Okay. I did the same like create table and query into it. But now the problem is I not getting results for some keywords. [Please check this link](https://stackoverflow.com/questions/49029656/mysql-fulltext-query-issue) . Thank you :) – Shihas Feb 28 '18 at 12:31

0 Answers0