floere/picky — Issue #68: Generic search does not give all the ids
Author: rogerbraun
Created: 2012-01-23 22:16:47+00:00
State: open

I am trying to retrieve all ids from a search, as in my case they don't travel over the net and I can still use Kaminari for pagination if I pack the results in a .where("id in (?)", ids).

For this, I just do searches like this:

```ruby
BookSearch.search("keyword", 1000000)
```

I only have around 30.000 entries so this should always return all resulting ids.

Model and Search are defined like this:

```ruby
BookIndex = Picky::Index.new :books do
Book.attribute_names[1..-1].each do |cname|
category cname.to_sym
end
end

BookSearch = Picky::Search.new BookIndex
```

The problem arises when I do a search without restrictions, for example:

```ruby
res = BookSearch.search("japan", 1000000)
res.total # => 5928
res.ids.count # => 20
```

When I restrict the search to certain categories, the problem goes away:

```ruby
res = BookSearch.search("titel:japan", 1000000)
res.total #=> 2017
res.ids.count #=> 2017
```

This seems like a bug. I am using Picky 4.0.9.