Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with pagination in MultiModel Search #382

Closed
miguelespada opened this issue Apr 29, 2015 · 18 comments
Closed

Problems with pagination in MultiModel Search #382

miguelespada opened this issue Apr 29, 2015 · 18 comments
Labels

Comments

@miguelespada
Copy link

I try to use pagination with Kaminari in a MultiModel Search.

This is my call:
Elasticsearch::Model.search(query, [AAA, BBB]).page(1).results

This is the error:
Failure/Error: response = MultiModelSearch.search('xxx')
NoMethodError:
undefined method `default_per_page' for #Elasticsearch::Model::Multimodel:0x007ff9dbe4f520

Is pagination supported for multimodel?

@xpepermint
Copy link

+1

@miguelespada
Copy link
Author

It works with will_paginate

Elasticsearch::Model.search(query, [AAA, BBB]).per_page(25).page(1).results

@karmi
Copy link
Contributor

karmi commented May 12, 2015

@miguelespada Don't know from top of my head, we'll look into that.

@miguelff, would you spare some time to look at the issue, please?

@miguelff
Copy link
Contributor

Sure, I will look into as soon as I got some time.

@miguelff
Copy link
Contributor

One question @miguelespada, does the Gemfile of your application declare gem 'kaminari' before gem 'elasticsearch-rails'?

@xpepermint
Copy link

Btw... I have kaminari before elasticsearch-rails.

@miguelespada
Copy link
Author

Hi @miguelff,
I do have kaminari before ES

gem "kaminari"
gem 'elasticsearch-model', git: 'git://github.com/elasticsearch/elasticsearch-rails.git'
gem 'elasticsearch-rails', git: 'git://github.com/elasticsearch/elasticsearch-rails.git'

@karmi karmi added the feature label May 13, 2015
@kikyous
Copy link

kikyous commented May 18, 2015

+1

@kikyous
Copy link

kikyous commented May 18, 2015

@miguelespada , @miguelff
add default_per_page method simply works for me

module Elasticsearch
  module Model
    class Multimodel
      def default_per_page
        10
      end
    end
  end
end

@miguelff
Copy link
Contributor

Thanks for the feedback, I will tackle the issue as soon as I got some time. Before the end of the week.

@miguelff
Copy link
Contributor

Working on this.

@xpepermint
Copy link

thx!

@miguelff
Copy link
Contributor

Waiting for @karmi's review

@karmi karmi closed this as completed in f6ebf4f May 26, 2015
@karmi
Copy link
Contributor

karmi commented May 26, 2015

Should be solved by @miguelff patch in #408 now!

@miguelespada
Copy link
Author

Thanks! @miguelff and @karmi

@rkrdo
Copy link

rkrdo commented Oct 2, 2015

Are you guys planning on releasing a version on rubygems with this patch?
Also, what would be safer to use in the meantime, reference the gem to master or to the specific commit?

@karmi
Copy link
Contributor

karmi commented Oct 8, 2015

@rkrdo Absolutely, I'm processing issues on the elasticsearch-ruby repository this week, I hope I'll get to the Rails one first. If it would be a blocker for you, there's no trouble in releasing a version, but I'd like to accumulate more patches in that first.

In the Gemfile, I'd rather go with a specific commit -- master should be always safe in terms of not suddenly breaking compatibility or having bugs, but of course it might happen...

@rkrdo
Copy link

rkrdo commented Oct 8, 2015

@karmi Makes sense, I'll reference a specific commit until you guys have enough patches to release a new version for now, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants