jekyll-meilisearch 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/jekyll/meilisearch_indexer.rb +32 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a78331aec40a47a12affbac7468c195a205870ffa62cd316581d7790ab44dbac
|
4
|
+
data.tar.gz: eabce695650a46c597c6ae204c09696d69e65d9219f28322d51b2377d93166d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '018ca823bae5a04332b8978ee97ed81681a18eb09f6a1e9494ab1af4cf71444cc786de1b2036520acc9ebf86198b041843861631b557276db548760229e86843'
|
7
|
+
data.tar.gz: ddd8d2710d09b369616a1d5ae1f1fadc157643047e464340737df3f8822bfda5569cf3bc16c7d7e4827f3376c26f06397b41fcdbc70626dfbbcfcce34bf15384
|
@@ -47,7 +47,6 @@ module Jekyll
|
|
47
47
|
|
48
48
|
def build_documents(site, config)
|
49
49
|
documents = []
|
50
|
-
index_name = config['index_name'] || 'jekyll_documents'
|
51
50
|
collections_config = config['collections'] || { 'posts' => { 'fields' => ['title', 'content', 'url', 'date'] } }
|
52
51
|
|
53
52
|
collections_config.each do |collection_name, collection_settings|
|
@@ -85,13 +84,25 @@ module Jekyll
|
|
85
84
|
|
86
85
|
def generate_id(doc, collection_name, id_format)
|
87
86
|
case id_format
|
88
|
-
when :default
|
89
|
-
doc.
|
90
|
-
|
91
|
-
|
92
|
-
|
87
|
+
when :default | :id
|
88
|
+
doc.id.gsub('/', '-')
|
89
|
+
.gsub(/[^a-zA-Z0-9_-]/, '-')
|
90
|
+
.gsub(/-+/, '-')
|
91
|
+
.downcase
|
92
|
+
.slice(0, 100)
|
93
|
+
when :url
|
94
|
+
doc.url
|
95
|
+
.gsub('/', '-')
|
96
|
+
.gsub(/[^a-zA-Z0-9_-]/, '-')
|
97
|
+
.gsub(/-+/, '-')
|
98
|
+
.downcase
|
99
|
+
.slice(0, 100)
|
93
100
|
else
|
94
|
-
doc.id.gsub('/', '-')
|
101
|
+
doc.data['number'] ? "#{collection_name}-#{doc.data['number']}" : doc.id.gsub('/', '-')
|
102
|
+
.gsub(/[^a-zA-Z0-9_-]/, '-')
|
103
|
+
.gsub(/-+/, '-')
|
104
|
+
.downcase
|
105
|
+
.slice(0, 100)
|
95
106
|
end
|
96
107
|
end
|
97
108
|
|
@@ -155,9 +166,15 @@ module Jekyll
|
|
155
166
|
"indexing documents"
|
156
167
|
)
|
157
168
|
if response&.code == 202
|
158
|
-
|
159
|
-
|
160
|
-
|
169
|
+
if response.body
|
170
|
+
task = JSON.parse(response.body)
|
171
|
+
log_info("Task queued: UID #{task['taskUid']}. Check status at #{url}/tasks/#{task['taskUid']}")
|
172
|
+
else
|
173
|
+
log_info("Task queued (202), but no response body received.")
|
174
|
+
end
|
175
|
+
elsif response.nil?
|
176
|
+
log_info("Failed to queue indexing task: No response received from Meilisearch.")
|
177
|
+
else
|
161
178
|
log_info("Failed to queue indexing task: #{response.code} - #{response.body}")
|
162
179
|
end
|
163
180
|
end
|
@@ -191,7 +208,11 @@ module Jekyll
|
|
191
208
|
"resetting index"
|
192
209
|
)
|
193
210
|
unless response&.success? || response&.code == 404
|
194
|
-
|
211
|
+
if response.nil?
|
212
|
+
log_info("Failed to reset index: No response received from Meilisearch.")
|
213
|
+
else
|
214
|
+
log_info("Failed to reset index: #{response.code} - #{response.body}")
|
215
|
+
end
|
195
216
|
return
|
196
217
|
end
|
197
218
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-meilisearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- unicolored
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03-
|
11
|
+
date: 2025-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|