Undefined method 'new_search' after upgrading SearchLogic

Hey,

I just upgraded from searchlogic-1.6.6 to searchlogic-2.1.1, and now I’m
getting some new errors.

Previously, in the model I could have something like this:

def self.search(criteria, options={})
criteria ||= {}

search = self.new_search

blah blah blah
end

and it would work. Now, I’m getting this error whenever it tries to
call that method:
undefined method `new_search’ for #Class:blahblah

Anyone run into this before, or have ideas on how to resolve this?
Thankee in advance.

Hi joe

I am facing pacing pagination problem with searchlogic logic gem. Do you
have some related problem???

On Mon, Jun 29, 2009 at 8:25 PM, Joe P.

senthil raja wrote:

Hi joe

I am facing pacing pagination problem with searchlogic logic gem. Do you
have some related problem???

On Mon, Jun 29, 2009 at 8:25 PM, Joe P.

The new SearchLogic gem doesn’t do pagination anymore. They recommend
using will_paginate, which works pretty well for me.

Hope that helps,
Joe

I got the same problem:

undefined method `new_search’

I am using this code

@busqueda1 = Establecimiento.new_search(
  :conditions =>{
     :titulo_or_descripcion_like_any => params[:busqueda].split
  },
  :per_page => per_page,
  :page => params[:page]
)
@establecimientos = @busqueda.all

I installed will_paginate and pagination does not cause error, but
new_search method still doesn’t work.

Has anyone figured out how to solve it?

Joe P. wrote:

Hey,

I just upgraded from searchlogic-1.6.6 to searchlogic-2.1.1, and now I’m
getting some new errors.

Previously, in the model I could have something like this:

def self.search(criteria, options={})
criteria ||= {}

search = self.new_search

blah blah blah
end

and it would work. Now, I’m getting this error whenever it tries to
call that method:
undefined method `new_search’ for #Class:blahblah

Anyone run into this before, or have ideas on how to resolve this?
Thankee in advance.

Well while investigating about this issue I found that searchlogic v2
does not include that method anymore. It works in a diferent way. More
info about this can be found at:

http://www.binarylogic.com/2009/06/09/searchlogic-v2-beta-released/
http://github.com/binarylogic/searchlogic/tree/v2

In other words, that usage is deprecated as I underestood. The thing is
I couldn’t find out how to use modificators of the previous version.
Maybe writing your own name_scopes thought.

Pablo G. wrote:

I got the same problem:

undefined method `new_search’

I am using this code

@busqueda1 = Establecimiento.new_search(
  :conditions =>{
     :titulo_or_descripcion_like_any => params[:busqueda].split
  },
  :per_page => per_page,
  :page => params[:page]
)
@establecimientos = @busqueda.all

I installed will_paginate and pagination does not cause error, but
new_search method still doesn’t work.

Has anyone figured out how to solve it?

Joe P. wrote:

Hey,

I just upgraded from searchlogic-1.6.6 to searchlogic-2.1.1, and now I’m
getting some new errors.

Previously, in the model I could have something like this:

def self.search(criteria, options={})
criteria ||= {}

search = self.new_search

blah blah blah
end

and it would work. Now, I’m getting this error whenever it tries to
call that method:
undefined method `new_search’ for #Class:blahblah

Anyone run into this before, or have ideas on how to resolve this?
Thankee in advance.