Repeat two complete queries across two fields

I need to do something like the following, which is designed to issue two different queries in two fields.

Video.search do
   fulltext weighting_factors, {:fields => :categories_as_string}
   fulltext prefs, {:fields => :similar_as_string}
end 

I am currently forcing two fields to include tokens with separate namespaces and combine the query to apply to both fields. I think this is equivalent, since prefs will never match something in category_as_string, but it is a pain to maintain. Is there any way to make the request above?

query = prefs + weighting_factors
search = Video.search do
  fulltext query do
    fields :similar_as_string, :categories_as_string
  end
end
+1
source share

All Articles