Problem passing "WITH QUERY EXPANSION" to mysql search

Currently my search is doing this, and works fine -

@results = item.paginate(:all, :conditions => [ “match(tags.name,
#{conditions}) against (? in boolean mode)”, @search_term ], :include =>
:tags, :order => “#{order} ASC”, :page => params[:page])

However, i want to use WITH QUERY EXPANSION, which returns an expanded
search, ie returning any items which have words matching the original
search. I thought that this should work

@results = item.paginate(:all, :conditions => [ “match(tags.name,
#{conditions}) against (? in boolean mode WITH QUERY EXPANSION)”,
@search_term ], :include => :tags, :order => “#{order} ASC”, :page =>
params[:page])

but it’s crashing with this error -

Mysql::Error: You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to
use near ‘WITH QUERY EXPANSION))’ at line 1: SELECT count(DISTINCT
learningpaths.id) AS count_all FROM learningpaths LEFT OUTER JOIN
taggings ON (learningpaths.id = taggings.taggable_id AND
taggings.taggable_type = ‘Learningpath’) LEFT OUTER JOIN tags ON
(tags.id = taggings.tag_id) WHERE (match(tags.name,
learningpaths.name, learningpaths.description) against (’+trumpet
+beginners’ in boolean mode WITH QUERY EXPANSION))

Looking at the mysql search it tried to do, it looks fine to me - can
anyone see a problem with how “with query expansion” is being used?

thanks
max

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs