How do I use columns from a joined table in a match against clause in MySQL? -


i writing business directory , use mysql store data. have 3 tables use in scenario: listings, regions, , categories. listings have titles , descriptions. regions , categories both have titles. create search feature allow users combine keywords of listing titles , descriptions category , region titles. example, if searches string "cheesecake in pennsylvania" result cheesecake factory in philly. can match(columns) against(keywords)?

the mysql query below returning error incorrect arguments match

select     l.listing_id id, l.category_id, l.title listing_title, l.description, l.address, l.city, l.zip, unix_timestamp(l.date_submitted) date_submitted, l.latitude, l.longitude,     ( 6371 * acos( cos( radians(40.293861) ) * cos( radians( l.latitude) ) * cos( radians( l.longitude ) - radians(-76.600252) ) + sin( radians(40.293861) ) * sin( radians( l.latitude ) ) ) ) distance,     c.category_id cat_id, c.title cat_title, c.slug cat_slug,      r.region_id region_id, r.title region_title, r.slug region_slug  listings l left join categories c on l.category_id = c.category_id  left join regions r on l.region_id = r.region_id  match (l.title,l.description,l.city,r.title,c.title) against ('cheesecake in pennsylvania') 

if remove r.title , c.title match columns works fine. here sqlfiddleto further demonstrate. open other ideas doing better way other using match.

i don't think so. columns named in match() must part of single fulltext index, can't define single fulltext index across multiple tables.

you may need combine 3 match() clauses or (like did in example here: http://sqlfiddle.com/#!9/89719/11).


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

post - imageshack API cURL -

dataset - MPAndroidchart returning no chart Data available -