[katello-devel] Search auto-complete issues

Justin Sherrill jsherril at redhat.com
Tue Aug 9 12:40:48 UTC 2011


On 08/09/2011 02:16 AM, Amos Benari wrote:
>
> ----- Original Message -----
>> From: "Justin Sherrill"<jsherril at redhat.com>
>> To: "Amos Benari"<abenari at redhat.com>
>> Cc: katello-devel at redhat.com
>> Sent: Tuesday, August 9, 2011 1:13:56 AM
>> Subject: Re: Search auto-complete issues
>> On 08/08/2011 11:54 AM, Amos Benari wrote:
>>> ----- Original Message -----
>>>> From: "Justin Sherrill"<jsherril at redhat.com>
>>>> To: "Amos Benari"<abenari at redhat.com>
>>>> Cc: katello-devel at redhat.com
>>>> Sent: Monday, August 8, 2011 4:44:24 PM
>>>> Subject: Re: Search auto-complete issues
>>>> On 08/07/2011 03:39 AM, Amos Benari wrote:
>>>>> ----- Original Message -----
>>>>>> From: "Justin Sherrill"<jsherril at redhat.com>
>>>>>> To: katello-devel at redhat.com, "Amos Benari"<abenari at redhat.com>
>>>>>> Sent: Friday, August 5, 2011 10:36:23 PM
>>>>>> Subject: Search auto-complete issues
>>>>>> Hi,
>>>>>>
>>>>>> I've been implementing some role enforcement in the controllers
>>>>>> and
>>>>>> noticed a couple of issues:
>>>>>>
>>>>>>
>>>>>> 1. The auto-complete search query is mostly the same for every
>>>>>> controller. That is to say that for "Changesets", auto complete
>>>>>> looks
>>>>>> for all changesets across the entire application to try to
>>>>>> complete
>>>>>> the
>>>>>> search with. This is obviously not desired. Most all queries need
>>>>>> to
>>>>>> be scoped by organization, and some by environment. We should add
>>>>>> a
>>>>>> task for this, as this will involve changing a good number of
>>>>>> controllers.
>>>>>>
>>>>>>
>>>>>> 2. (Specifically for amos). Currently there is no way in
>>>>>> scoped_search
>>>>>> to pass other data with the auto_complete request. So in the
>>>>>> above
>>>>>> example we need to send the environment_id along with the search
>>>>>> term
>>>>>> (to auto complete). I traced this back to the scoped_search gem,
>>>>>> do
>>>>>> you
>>>>>> think it something you would be able to add?
>>>>>>
>>>>>>
>>>>>> -Justin
>>>>> I have noticed that the ability to scope the auto-completer was
>>>>> missing and fixed it upstream.
>>>>> For usage read here:
>>>>> http://scopedsearch.wordpress.com/2011/08/01/permission-model-for-the-search/
>>>>> Thanks,
>>>>>      Amos.
>>>>>
>>>> Awesome! So we need to pull in a newer version of that gem?
>>> Haven't released it in a new gem yet.
>>> If it can wait I prefer to add some more functionality soon, then
>>> release it.
>>> If we need it this week, tell me and I will release a new gem.
>>> Thanks,
>>>    Amos.
>>>
>> We dont' need it right away, but the roles&  permissions will have to
>> be
>> hacked around to get it to still function.
>>
>> In the above wiki i didn't see how you would on the client side
>> specify
>> which other fields you want passed in. For example in the
>> auto_complete_field_jquery helper method in RailsHelper, this would
>> need
>> to be modified to take in some other parameters. Is this included in
>> your change?
> The client side is not changing in my auto-completer fix.
> The optional extra parameters are passed as a hash on the controller,
> that can be {:user =>  User.current, :org =>  my_current_org}, etc.
> The change in the complete_for method signature is:
>
> - def complete_for query
> + def complete_for query, options ={}
>
> In order to do some good with the new options, one will need to write
> a new scope called completer_scope on the *model* that uses the new options, for example:
>
> +scope :completer_scope, lambda{ |options|
> +  where( "org_id = ? and user_id = ?", options[:org], options[:user] )
> +}
>
> The above example will limit the auto-completer results to a specific org and user.
>
> Amos.
>

Hey Amos,

How will the extra parameters get from the browser to the server then?  
We are currently using the auto_complete_field_jquery helper which does 
not support sending additional parameters. If that isn't updated then we 
have to write our own custom javascript for auto complete which isn't 
bad, it just kinda defeats the point of a helper existing ?

-Justin

>> Thanks,
>>
>> -Justin
>>
>>
>>>> -Justin




More information about the katello-devel mailing list