Ultrasphinx: adding field_name in search query

Hi all,

I want to search for a keyword in a particular field, for example say I
want to search for the keyword “rails” in the field title so how can I
include the field_name in query string.

s=Ultrasphinx::Search.new(:query => “@title rails”)

or

s=Ultrasphinx::Search.new(:query => “title: rails”)

or

s=Ultrasphinx::Search.new(:query => “@title: rails”)

Thanks in advance,
T.Veeraa.

Veera S. wrote:

Hi all,

I want to search for a keyword in a particular field, for example say I
want to search for the keyword “rails” in the field title so how can I
include the field_name in query string.

s=Ultrasphinx::Search.new(:query => “@title rails”)

or

s=Ultrasphinx::Search.new(:query => “title: rails”)

or

s=Ultrasphinx::Search.new(:query => “@title: rails”)

Thanks in advance,
T.Veeraa.

finally I found

s=Ultrasphinx::Search.new(:query => “title: rails”)

above is the write syntax to include the field_name inside search query
as per the documentation.

But when you are using this for exact phrase match, it not working.

s=Ultrasphinx::Search.new(:query => ‘title: “ruby on rails”’)

am searching for the exact phrase “ruby on rails” in title field it
matches exact phrase, thats good, but when am trying the same phrase
with another field also returning the same result. Hence not its not
looking into the field what I specified.