php - MySQL - Full Text Search - Losing index -
so here scenario:
- mysql
- have 1 myisam table
- colum named v.value has full text index
basic query works fine, uses index expected:
select p.online_identifier (...) r.area_id = 3 , s.state_id= 4 , (snap.area_has_catalogues_attributes_id = 7028 , match (v.value) against('+somebrand' in boolean mode))
now when add or, full text search index (on v.value) not used. run explain verify it.
the query this:
(...) r.area_id = 3 , s.state_id= 4 , (snap.area_has_catalogues_attributes_id = 7028 , match (v.value) against('+somebrand' in boolean mode)) or (snap.area_has_catalogues_attributes_id = 7045 , match (v.value) against('+otherbrand' in boolean mode))
i dont understand why. ideas?
here interesting: query have causing fulltext indexing ignored. don't worry, not fault. wrote before : is there way hint query optimizer mysql constraints should done first?
after looking on answer , subsequent links, let's @ original query:
select p.online_identifier (...) r.area_id = 3 , s.state_id= 4 , (snap.area_has_catalogues_attributes_id = 7028 , match (v.value) against('+somebrand' in boolean mode))
you have execute fulltext search alone , retrieve ids only.
use ids join other table aliases.
let me take query 1 of my other links demonstrate query
instead of query
select * seeds match(text) against ("mount cameroon" in boolean mode) = 4;
you must refactor this:
select b.* ( select id,match(text) against ("mount cameroon" in boolean mode) score seeds match(text) against ("mount cameroon" in boolean mode) ) inner join seeds b using (id) a.score = 4;
give try !!!
Comments
Post a Comment