jekyll-algolia 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -6
- data/lib/jekyll/algolia/indexer.rb +7 -3
- data/lib/jekyll/algolia/utils.rb +6 -0
- data/lib/jekyll/algolia/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a91395a6d04dc0f9b9ef49da23e16bf1456969d
|
4
|
+
data.tar.gz: fbad45afa7727fc7029dc2806846f1cd4cb31cc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2330e69b46b065cff3c5c6398d1d7348bc076d2d3c79728f4be43212b009591eda19218f4f62f7b536a0ff9bf42692ec91bb63d3ccd2f671cf7a30b935d5e98
|
7
|
+
data.tar.gz: be599da416025ba2867b42817907b384f86be69ad4a951a4cecfd62e27ab5ac195b74fce69a8e3e736a0456f79b334fc6810d58e05b0711ddd392cd419f4af42
|
data/README.md
CHANGED
@@ -46,8 +46,8 @@ You need to provide certain Algolia credentials for this plugin to *index* your
|
|
46
46
|
site.
|
47
47
|
|
48
48
|
*If you don't yet have an Algolia account, you can open a free [Community plan
|
49
|
-
here][8]. Once signed in, you can get your
|
50
|
-
[your dashboard][9].*
|
49
|
+
here][8]. Once signed in, you can get your
|
50
|
+
credentials from [your dashboard][9].*
|
51
51
|
|
52
52
|
Once you have your credentials, you should define your `application_id` and
|
53
53
|
`index_name` inside your `_config.yml` file like this:
|
@@ -71,9 +71,20 @@ ALGOLIA_API_KEY='{your_admin_api_key}' bundle exec jekyll algolia
|
|
71
71
|
|
72
72
|
Note that `ALGOLIA_API_KEY` should be set to your admin API key.
|
73
73
|
|
74
|
+
## More about the Community plan
|
75
|
+
|
76
|
+
The Algolia [Community plan][10] lets you host up to 10k records and perform up to
|
77
|
+
100k add/edit/delete operations per month (search operations are free). The plan
|
78
|
+
is entirely free, with no time limit.
|
79
|
+
|
80
|
+
What we ask in exchange is that you display a "Search by Algolia" logo next to
|
81
|
+
your search results. Our [InstantSearch libraries][11] have a simple boolean
|
82
|
+
option to toggle that on an off. If you want more flexibility, you can find
|
83
|
+
all versions of our logo [here][12].
|
84
|
+
|
74
85
|
# Thanks
|
75
86
|
|
76
|
-
Thanks to [Anatoliy Yastreb][
|
87
|
+
Thanks to [Anatoliy Yastreb][13] for a [great tutorial][14] on creating Jekyll
|
77
88
|
plugins.
|
78
89
|
|
79
90
|
|
@@ -84,7 +95,10 @@ plugins.
|
|
84
95
|
[5]: https://img.shields.io/badge/dynamic/json.svg?label=coverage%3Amaster&colorB=&prefix=&suffix=%25&query=$.coverage_change&uri=https%3A%2F%2Fcoveralls.io%2Fgithub%2Falgolia%2Fjekyll-algolia.json%3Fbranch%3Dmaster
|
85
96
|
[6]: https://img.shields.io/badge/dynamic/json.svg?label=build%3Adevelop&query=value&uri=https%3A%2F%2Fimg.shields.io%2Ftravis%2Falgolia%2Fjekyll-algolia.json%3Fbranch%3Ddevelop
|
86
97
|
[7]: https://img.shields.io/badge/dynamic/json.svg?label=coverage%3Adevelop&colorB=&prefix=&suffix=%25&query=$.coverage_change&uri=https%3A%2F%2Fcoveralls.io%2Fgithub%2Falgolia%2Fjekyll-algolia.json%3Fbranch%3Ddevelop
|
87
|
-
[8]:
|
98
|
+
[8]: #more-about-the-community-plan
|
88
99
|
[9]: https://www.algolia.com/licensing
|
89
|
-
[10]: https://
|
90
|
-
[11]: https://
|
100
|
+
[10]: https://www.algolia.com/users/sign_up/hacker
|
101
|
+
[11]: https://community.algolia.com/instantsearch.js/
|
102
|
+
[12]: https://www.algolia.com/press#resources
|
103
|
+
[13]: https://github.com/ayastreb/
|
104
|
+
[14]: https://ayastreb.me/writing-a-jekyll-plugin/
|
@@ -135,15 +135,19 @@ module Jekyll
|
|
135
135
|
Logger.log("I:Records to add: #{new_records.length}")
|
136
136
|
return if Configurator.dry_run?
|
137
137
|
|
138
|
-
operations
|
139
|
-
|
140
|
-
|
138
|
+
# We group delete and add operations into the same batch. Delete
|
139
|
+
# operations should still come first, to avoid hitting an overquota too
|
140
|
+
# soon
|
141
|
+
operations = []
|
141
142
|
old_records_ids.each do |object_id|
|
142
143
|
operations << {
|
143
144
|
action: 'deleteObject', indexName: index_name,
|
144
145
|
body: { objectID: object_id }
|
145
146
|
}
|
146
147
|
end
|
148
|
+
operations += new_records.map do |new_record|
|
149
|
+
{ action: 'addObject', indexName: index_name, body: new_record }
|
150
|
+
end
|
147
151
|
|
148
152
|
# Run the batches in slices if they are too large
|
149
153
|
batch_size = Configurator.algolia('indexing_batch_size')
|
data/lib/jekyll/algolia/utils.rb
CHANGED
@@ -104,6 +104,12 @@ module Jekyll
|
|
104
104
|
Integer, Float,
|
105
105
|
String
|
106
106
|
]
|
107
|
+
# Integer arrived in Ruby 2.4. Before that it was Fixnum and Bignum
|
108
|
+
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.4.0')
|
109
|
+
# rubocop:disable Lint/UnifiedInteger
|
110
|
+
simple_types += [Fixnum, Bignum]
|
111
|
+
# rubocop:enable Lint/UnifiedInteger
|
112
|
+
end
|
107
113
|
return item if simple_types.member?(item.class)
|
108
114
|
|
109
115
|
# Recursive types
|