# Undefined method 'new\_search' after upgrading SearchLogic

**URL:** <https://www.ruby-forum.com/t/undefined-method-new-search-after-upgrading-searchlogic/171252>\
**Category:** Rails\
**Created:** [June 29, 2009, 4:55pm UTC](https://www.ruby-forum.com/t/undefined-method-new-search-after-upgrading-searchlogic/171252 "2009-06-29T16:55:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![joep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/87869e/32.png) [@joep](https://www.ruby-forum.com/u/joep)\
**Post date:** [June 29, 2009, 4:55pm UTC](https://www.ruby-forum.com/t/undefined-method-new-search-after-upgrading-searchlogic/171252/1 "2009-06-29T16:55:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![joep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/87869e/32.png) [@joep](https://www.ruby-forum.com/u/joep)\
**Post date:** [June 29, 2009, 8:14pm UTC](https://www.ruby-forum.com/t/undefined-method-new-search-after-upgrading-searchlogic/171252/2 "2009-06-29T20:14:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![joep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/87869e/32.png) [@joep](https://www.ruby-forum.com/u/joep)\
**Post date:** [June 29, 2009, 8:17pm UTC](https://www.ruby-forum.com/t/undefined-method-new-search-after-upgrading-searchlogic/171252/3 "2009-06-29T20:17:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![joep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/87869e/32.png) [@joep](https://www.ruby-forum.com/u/joep)\
**Post date:** [September 5, 2009, 8:55pm UTC](https://www.ruby-forum.com/t/undefined-method-new-search-after-upgrading-searchlogic/171252/4 "2009-09-05T20:55:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![joep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/87869e/32.png) [@joep](https://www.ruby-forum.com/u/joep)\
**Post date:** [September 6, 2009, 5:15pm UTC](https://www.ruby-forum.com/t/undefined-method-new-search-after-upgrading-searchlogic/171252/5 "2009-09-06T17:15:38Z")

</div>

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://www.binarylogic.com/2009/06/09/searchlogic-v2-beta-released/)  
[http://github.com/binarylogic/searchlogic/tree/v2](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.
