Can't search fields with space

Hi,
I have a user model that has a city field which is searchable using
acts_as_ferret.

But I can’t get it to return any result whether I use
:city => {:store => :no, :index => :untokenized},
or
:city => {:store => :no} in my User model’s acts_as_ferret option

User.find_by_contents(“city:(cal poly)”)
=> #<ActsAsFerret::SearchResults:0x4e62608 @total_hits=0, @results=[]>

User.find_by_contents(“city:(‘cal poly’)”)
=> #<ActsAsFerret::SearchResults:0x4e5aae8 @total_hits=0, @results=[]>

User.find_by_contents(“city:(‘cal\ poly’)”)
=> #<ActsAsFerret::SearchResults:0x4e566a0 @total_hits=0, @results=[]>

User.find_by_contents(‘city:(“cal\ poly”)’)
=> #<ActsAsFerret::SearchResults:0x4e51a9c @total_hits=0, @results=[]>

User.find_by_contents(‘city:(“cal poly”)’)
=> #<ActsAsFerret::SearchResults:0x4e4f148 @total_hits=0, @results=[]>

Please advise.
Yaxm

On Mon, Apr 30, 2007 at 11:11:33AM +0200, Yaxm Y. wrote:

=> #<ActsAsFerret::SearchResults:0x4e62608 @total_hits=0, @results=[]>

User.find_by_contents(“city:(‘cal poly’)”)
=> #<ActsAsFerret::SearchResults:0x4e5aae8 @total_hits=0, @results=[]>

User.find_by_contents(“city:(‘cal\ poly’)”)
=> #<ActsAsFerret::SearchResults:0x4e566a0 @total_hits=0, @results=[]>

User.find_by_contents(‘city:(“cal\ poly”)’)
=> #<ActsAsFerret::SearchResults:0x4e51a9c @total_hits=0, @results=[]>

User.find_by_contents(‘city:(“cal poly”)’)
=> #<ActsAsFerret::SearchResults:0x4e4f148 @total_hits=0, @results=[]>

you can use

User.aaf_index.process_query ‘city:(“cal poly”)’

to see how your query strings get parsed. Most likely that will show you
quite easily why you don’t get the results you expect.

Please also note that after changing the actsasferret options you have
to rebuild the index to get correct results.

Jens


Jens Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66
[email protected] | www.webit.de

Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa

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