mysql - Mariadb fulltext match two columns -


i have problem, query syntax:

select `users`.`name`, `posts`.* `posts`  left join `users` on `posts`.`user_id` = `users`.`id` match (title,body) against('search') 

the match working 1 only, no both ... please take me advice how fix ...

to check "search" being in both title , body, recommend un-obvious combination. (i leave out users being irrelevant question.)

select  p1.*      posts p1      match(p1.title) against("search" in boolean mode)       ,  exists (         select  *              posts p2              match(p2.body) against("search" in boolean mode)                    )  

when using fulltext, don't think optimizer knows how efficiently apply fulltext twice, sneaky way so.

i picked title first on assumption has fewer words, hence has less need proceed other test.

it may "index merge intersect" kick in this:

select  *      posts      match(title) against("search" in boolean mode)       ,  match(body)  against("search" in boolean mode)  

in both cases, need both:

fulltext(title), fulltext(body) 

a single ft index both columns not useful.

please provide show create table , explain select ... if need discuss further.

it possibly matters whether have engine=myisam or engine=innodb; 2 implementations totally different.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -