Create fulltext index on a VIEW
Posted
by
kylex
on Stack Overflow
See other posts from Stack Overflow
or by kylex
Published on 2011-03-15T03:12:02Z
Indexed on
2011/03/15
16:10 UTC
Read the original article
Hit count: 298
Is it possible to create a full text index on a VIEW?
If so, given two columns column1
and column2
on a VIEW, what is the SQL to get this done?
The reason I'd like to do this is I have two very large tables, where I need to do a FULLTEXT search of a single column on each table and combine the results. The results need to be ordered as a single unit.
Suggestions?
EDIT: This was my attempt at creating a UNION
and ordering by each statements scoring.
(SELECT a_name AS name, MATCH(a_name) AGAINST('$keyword') as ascore
FROM a WHERE MATCH a_name AGAINST('$keyword'))
UNION
(SELECT s_name AS name,MATCH(s_name) AGAINST('$keyword') as sscore
FROM s WHERE MATCH s_name AGAINST('$keyword'))
ORDER BY (ascore + sscore) ASC
sscore
was not recognized.
© Stack Overflow or respective owner