algoliasearch-rails 2.3.1 → 2.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.MD +4 -0
- data/Gemfile +1 -0
- data/algoliasearch-rails.gemspec +2 -0
- data/lib/algoliasearch/pagination/pagy.rb +22 -0
- data/lib/algoliasearch/pagination.rb +1 -0
- data/lib/algoliasearch/version.rb +1 -1
- data/lib/algoliasearch-rails.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f1f301750d7affc346eea8252c11e98722a8ac4c82be59fb8a248a69fa459ce
|
4
|
+
data.tar.gz: ce9e1536025efd0f881b6e45be3db203d7dc0eafc6f4b0d07cf8f9b8aea95761
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9de7d8769fc9c19adbfbe70cef64e643c5d25d55774962d041962f570826566dd518a550fd23f73f4293bcdf5e1d048af354d2c9dc1c41ebe574dac64b5d996
|
7
|
+
data.tar.gz: '05787dce080a885c00ae4efdff6a9b4f26e2109979845ec8405d78f27f5c9757c30e77b814cb0f6957b49f8787cd468df15c8c8369091d80f39adc83e33f1adf'
|
data/CHANGELOG.MD
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## [Unreleased](https://github.com/algolia/algoliasearch-rails/compare/2.2.1...master)
|
4
4
|
|
5
|
+
## [2.3.2](https://github.com/algolia/algoliasearch-rails/compare/2.3.1...2.3.2)
|
6
|
+
### Added
|
7
|
+
* Support for Pagy pagination provider [`#443`](https://github.com/algolia/algoliasearch-rails/pull/443)
|
8
|
+
|
5
9
|
## [2.3.1](https://github.com/algolia/algoliasearch-rails/compare/2.3.0...2.3.1)
|
6
10
|
### Added
|
7
11
|
* Allow ActiveJob queue configuration [`#439`](https://github.com/algolia/algoliasearch-rails/pull/439)
|
data/Gemfile
CHANGED
data/algoliasearch-rails.gemspec
CHANGED
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
"lib/algoliasearch/configuration.rb",
|
34
34
|
"lib/algoliasearch/pagination.rb",
|
35
35
|
"lib/algoliasearch/pagination/kaminari.rb",
|
36
|
+
"lib/algoliasearch/pagination/pagy.rb",
|
36
37
|
"lib/algoliasearch/pagination/will_paginate.rb",
|
37
38
|
"lib/algoliasearch/railtie.rb",
|
38
39
|
"lib/algoliasearch/tasks/algoliasearch.rake",
|
@@ -81,6 +82,7 @@ Gem::Specification.new do |s|
|
|
81
82
|
s.add_runtime_dependency(%q<algolia>, ["< 3.0.0"])
|
82
83
|
s.add_development_dependency(%q<will_paginate>, [">= 2.3.15"])
|
83
84
|
s.add_development_dependency(%q<kaminari>, [">= 0"])
|
85
|
+
s.add_development_dependency(%q<pagy>, [">= 0"])
|
84
86
|
s.add_development_dependency "rake"
|
85
87
|
s.add_development_dependency "rdoc"
|
86
88
|
else
|
@@ -0,0 +1,22 @@
|
|
1
|
+
unless defined? Pagy
|
2
|
+
raise(AlgoliaSearch::BadConfiguration, "AlgoliaSearch: Please add 'pagy' to your Gemfile to use Pagy pagination backend")
|
3
|
+
end
|
4
|
+
|
5
|
+
module AlgoliaSearch
|
6
|
+
module Pagination
|
7
|
+
class Pagy
|
8
|
+
def self.create(results, total_hits, options = {})
|
9
|
+
vars = {
|
10
|
+
count: total_hits,
|
11
|
+
page: options[:page],
|
12
|
+
items: options[:per_page]
|
13
|
+
}
|
14
|
+
|
15
|
+
pagy = ::Pagy.new(vars)
|
16
|
+
[pagy, results]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -3,6 +3,7 @@ module AlgoliaSearch
|
|
3
3
|
|
4
4
|
autoload :WillPaginate, 'algoliasearch/pagination/will_paginate'
|
5
5
|
autoload :Kaminari, 'algoliasearch/pagination/kaminari'
|
6
|
+
autoload :Pagy, 'algoliasearch/pagination/pagy'
|
6
7
|
|
7
8
|
def self.create(results, total_hits, options = {})
|
8
9
|
return results if AlgoliaSearch.configuration[:pagination_backend].nil?
|
data/lib/algoliasearch-rails.rb
CHANGED
@@ -683,7 +683,7 @@ module AlgoliaSearch
|
|
683
683
|
|
684
684
|
def algolia_search(q, params = {})
|
685
685
|
if AlgoliaSearch.configuration[:pagination_backend]
|
686
|
-
# kaminari and
|
686
|
+
# kaminari, will_paginate, and pagy start pagination at 1, Algolia starts at 0
|
687
687
|
params[:page] = (params.delete('page') || params.delete(:page)).to_i
|
688
688
|
params[:page] -= 1 if params[:page].to_i > 0
|
689
689
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: algoliasearch-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Algolia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pagy
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rake
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,6 +131,7 @@ files:
|
|
117
131
|
- lib/algoliasearch/configuration.rb
|
118
132
|
- lib/algoliasearch/pagination.rb
|
119
133
|
- lib/algoliasearch/pagination/kaminari.rb
|
134
|
+
- lib/algoliasearch/pagination/pagy.rb
|
120
135
|
- lib/algoliasearch/pagination/will_paginate.rb
|
121
136
|
- lib/algoliasearch/railtie.rb
|
122
137
|
- lib/algoliasearch/tasks/algoliasearch.rake
|