Ferret query

Hi there,

I’ve been spending hours trying to figure out how to do this ferret
query correctly, but it just won’t work…

The final ferret query should simply look like this:

country: “United Kingdom”
(it needs the “” because it’s a “PhraseQuery”)

I thought the controller should look like this…

a)
query = @query = “country:”+’"‘[email protected]}+’"’ if
@search.country
@results = User.find_by_contents(query)

…or…

b)
query = @query = “country:”+""“[email protected]}+”"" if
@search.country
@results = User.find_by_contents(query)

…or…

c)
query = @query = “country:”#{@search.country}"" if @search.country
@results = User.find_by_contents(query)

…but the search doesn’t get the correct result. (In fact, it doesn’t
even get a result with only “United” in the “country” column - I
tried…)

When I look at the “@query.inspect”, it reads for all 3 cases:

“country:“United Kingdom””

What am I doing wrong??? What is the correct controller syntax?

Thank you very much for your help!
Tom

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