Translations: English
Search on Docs:
ActionItem Search:

#1584: Search for persons in enterprise add_members missed to see the identifier

Type: BugItem Feature:   Tags:  
ScheduledFor: 0.25.2 Assigned to: RodrigoSouto Sites:  
Priority: 0 Status: Rejected  

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 = []
-      @users_found = Person.find_by_contents(params[:query] + '*')
+      @users_found = Person.find_by_contents(params[:query].delete('-') + '*')
     render :layout => false

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
Add comment
You need to login to be able to comment.

ActionItemForm edit

Title Search for persons in enterprise add_members missed to see the identifier
ActionItemType BugItem
Priority Low
ResponsibleDevelopers RodrigoSouto
ScheduledFor 0.25.2
Status Rejected
Ticket SAC:
Topic revision: r1 - 22 May 2015, UnknownUser

irc Talk with Devs Now!

Copyright © 2007-2019 by the Noosfero contributors
Colivre - Cooperativa de Tecnologias Livres