Description of the bug
Visiting
http://localhost:3000/myprofile/my-enterprise/profile_members/add_members we can add persons to enterprise but if you serach by the person login (the identifier) you will not to find it when the name is not exatily equal to it's login.
--
AurelioAHeckert -- 09 Jul 2010
I took a look at this problem and discovered that it's happening because that search uses the ferret method "find_by_contents" and ferret tokenizes the query. This tokenizer removes the hyphens. So if you are looking for "maria-santos" you will find it only as "mariasantos". I've looked for a way to disable the tokenizer for a specific fields but couldn't find. There is a hard-coded solution:
--- a/app/controllers/my_profile/profile_members_controller.rb
+++ b/app/controllers/my_profile/profile_members_controller.rb
@@ -79,7 +79,7 @@ class ProfileMembersController < MyProfileController
if !params[:query] || params[:query].length <= 2
@users_found = []
else
- @users_found = Person.find_by_contents(params[:query] + '*')
+ @users_found = Person.find_by_contents(params[:query].delete('-') + '*')
end
render :layout => false
end
Remove the hyphens in every query on the controller. But this is attained specifically to ferret.
Any ideas?
--
RodrigoSouto - 12 Jul 2010
Today I found a way to specify the fields that should not be tokenized. It is something like this:
acts_as_ferret :fields => {:my_field => {:index => :untokenized}}
I tried it, rebuilt the index and checked through the ferret browser that the fields were really untokenized.
But when I try to search "maria-s*" it does not work.
I am starting to believe that the star wildcard doesn't work correctly with hyphenated words...
--
RodrigoSouto - 13 Jul 2010
It's working now in the stable version...
--
RodrigoSouto - 04 Aug 2010