#80 ✓resolved
Slava

to_conditions(value) has wrong type

Reported by Slava | April 2nd, 2009 @ 03:59 PM

Hello.

I have problem with custom Condition.

i am missing the "IN"-SQl-Statement in Searchlogic, so i create a custom Condition.

class In < Searchlogic::Condition::Base
    def to_conditions(value)
         ["#{column_sql} IN (?)", value.join(',')]
    end
end

Searchlogic::Conditions::Base.register_condition(In)

In my controller i wrote this:

array = [1,2,3,4]
@search = Model.new_search(params[:search])
@search.conditions.id_in =  array
@result, @result_count = @search.all, @search.count

But i get a error:

NoMethodError (undefined method join' for 1:Fixnum):

The value of function to_conditions has a type: integer

I suppose because the collumn "id" is of type integer.

Is it possible to implement an "IN" function in Searchlogic or there is another way to make a search with given id's.

Background info:

I use Searchlogic for struct search and ferret (acts_as_ferret) to search in files contents.

Now i would to combine both solution.

Thanks

Slava.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Provides common named scopes and object based searching.

People watching this ticket

Pages