middleman-search 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -0
- data/lib/middleman-search/extension.rb +2 -0
- data/lib/middleman-search/search-index-resource.rb +25 -1
- data/lib/middleman-search/version.rb +1 -1
- data/vendor/assets/javascripts/lunr.da.js +273 -0
- data/vendor/assets/javascripts/lunr.de.js +373 -0
- data/vendor/assets/javascripts/lunr.du.js +437 -0
- data/vendor/assets/javascripts/lunr.es.js +588 -0
- data/vendor/assets/javascripts/lunr.fi.js +529 -0
- data/vendor/assets/javascripts/lunr.fr.js +691 -0
- data/vendor/assets/javascripts/lunr.hu.js +554 -0
- data/vendor/assets/javascripts/lunr.it.js +605 -0
- data/vendor/assets/javascripts/lunr.jp.js +118 -0
- data/vendor/assets/javascripts/lunr.no.js +246 -0
- data/vendor/assets/javascripts/lunr.pt.js +559 -0
- data/vendor/assets/javascripts/lunr.ro.js +547 -0
- data/vendor/assets/javascripts/lunr.ru.js +380 -0
- data/vendor/assets/javascripts/lunr.stemmer.support.js +282 -0
- data/vendor/assets/javascripts/lunr.sv.js +245 -0
- data/vendor/assets/javascripts/lunr.tr.js +1063 -0
- metadata +19 -3
@@ -0,0 +1,437 @@
|
|
1
|
+
/*!
|
2
|
+
* Lunr languages, `Dutch` language
|
3
|
+
* https://github.com/MihaiValentin/lunr-languages
|
4
|
+
*
|
5
|
+
* Copyright 2014, Mihai Valentin
|
6
|
+
* http://www.mozilla.org/MPL/
|
7
|
+
*/
|
8
|
+
/*!
|
9
|
+
* based on
|
10
|
+
* Snowball JavaScript Library v0.3
|
11
|
+
* http://code.google.com/p/urim/
|
12
|
+
* http://snowball.tartarus.org/
|
13
|
+
*
|
14
|
+
* Copyright 2010, Oleg Mazko
|
15
|
+
* http://www.mozilla.org/MPL/
|
16
|
+
*/
|
17
|
+
|
18
|
+
/**
|
19
|
+
* export the module via AMD, CommonJS or as a browser global
|
20
|
+
* Export code from https://github.com/umdjs/umd/blob/master/returnExports.js
|
21
|
+
*/
|
22
|
+
;
|
23
|
+
(function(root, factory) {
|
24
|
+
if (typeof define === 'function' && define.amd) {
|
25
|
+
// AMD. Register as an anonymous module.
|
26
|
+
define(factory)
|
27
|
+
} else if (typeof exports === 'object') {
|
28
|
+
/**
|
29
|
+
* Node. Does not work with strict CommonJS, but
|
30
|
+
* only CommonJS-like environments that support module.exports,
|
31
|
+
* like Node.
|
32
|
+
*/
|
33
|
+
module.exports = factory()
|
34
|
+
} else {
|
35
|
+
// Browser globals (root is window)
|
36
|
+
factory()(root.lunr);
|
37
|
+
}
|
38
|
+
}(this, function() {
|
39
|
+
/**
|
40
|
+
* Just return a value to define the module export.
|
41
|
+
* This example returns an object, but the module
|
42
|
+
* can return a function as the exported value.
|
43
|
+
*/
|
44
|
+
return function(lunr) {
|
45
|
+
/* throw error if lunr is not yet included */
|
46
|
+
if ('undefined' === typeof lunr) {
|
47
|
+
throw new Error('Lunr is not present. Please include / require Lunr before this script.');
|
48
|
+
}
|
49
|
+
|
50
|
+
/* throw error if lunr stemmer support is not yet included */
|
51
|
+
if ('undefined' === typeof lunr.stemmerSupport) {
|
52
|
+
throw new Error('Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.');
|
53
|
+
}
|
54
|
+
|
55
|
+
/* register specific locale function */
|
56
|
+
lunr.du = function() {
|
57
|
+
this.pipeline.reset();
|
58
|
+
this.pipeline.add(
|
59
|
+
lunr.du.stopWordFilter,
|
60
|
+
lunr.du.stemmer
|
61
|
+
);
|
62
|
+
};
|
63
|
+
|
64
|
+
/* lunr stemmer function */
|
65
|
+
lunr.du.stemmer = (function() {
|
66
|
+
/* create the wrapped stemmer object */
|
67
|
+
var Among = lunr.stemmerSupport.Among,
|
68
|
+
SnowballProgram = lunr.stemmerSupport.SnowballProgram,
|
69
|
+
st = new function DutchStemmer() {
|
70
|
+
var a_0 = [new Among("", -1, 6), new Among("\u00E1", 0, 1),
|
71
|
+
new Among("\u00E4", 0, 1), new Among("\u00E9", 0, 2),
|
72
|
+
new Among("\u00EB", 0, 2), new Among("\u00ED", 0, 3),
|
73
|
+
new Among("\u00EF", 0, 3), new Among("\u00F3", 0, 4),
|
74
|
+
new Among("\u00F6", 0, 4), new Among("\u00FA", 0, 5),
|
75
|
+
new Among("\u00FC", 0, 5)
|
76
|
+
],
|
77
|
+
a_1 = [new Among("", -1, 3),
|
78
|
+
new Among("I", 0, 2), new Among("Y", 0, 1)
|
79
|
+
],
|
80
|
+
a_2 = [
|
81
|
+
new Among("dd", -1, -1), new Among("kk", -1, -1),
|
82
|
+
new Among("tt", -1, -1)
|
83
|
+
],
|
84
|
+
a_3 = [new Among("ene", -1, 2),
|
85
|
+
new Among("se", -1, 3), new Among("en", -1, 2),
|
86
|
+
new Among("heden", 2, 1), new Among("s", -1, 3)
|
87
|
+
],
|
88
|
+
a_4 = [
|
89
|
+
new Among("end", -1, 1), new Among("ig", -1, 2),
|
90
|
+
new Among("ing", -1, 1), new Among("lijk", -1, 3),
|
91
|
+
new Among("baar", -1, 4), new Among("bar", -1, 5)
|
92
|
+
],
|
93
|
+
a_5 = [
|
94
|
+
new Among("aa", -1, -1), new Among("ee", -1, -1),
|
95
|
+
new Among("oo", -1, -1), new Among("uu", -1, -1)
|
96
|
+
],
|
97
|
+
g_v = [17, 65,
|
98
|
+
16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128
|
99
|
+
],
|
100
|
+
g_v_I = [1, 0, 0,
|
101
|
+
17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128
|
102
|
+
],
|
103
|
+
g_v_j = [
|
104
|
+
17, 67, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128
|
105
|
+
],
|
106
|
+
I_p2, I_p1, B_e_found, sbp = new SnowballProgram();
|
107
|
+
this.setCurrent = function(word) {
|
108
|
+
sbp.setCurrent(word);
|
109
|
+
};
|
110
|
+
this.getCurrent = function() {
|
111
|
+
return sbp.getCurrent();
|
112
|
+
};
|
113
|
+
|
114
|
+
function r_prelude() {
|
115
|
+
var among_var, v_1 = sbp.cursor,
|
116
|
+
v_2, v_3;
|
117
|
+
while (true) {
|
118
|
+
sbp.bra = sbp.cursor;
|
119
|
+
among_var = sbp.find_among(a_0, 11);
|
120
|
+
if (among_var) {
|
121
|
+
sbp.ket = sbp.cursor;
|
122
|
+
switch (among_var) {
|
123
|
+
case 1:
|
124
|
+
sbp.slice_from("a");
|
125
|
+
continue;
|
126
|
+
case 2:
|
127
|
+
sbp.slice_from("e");
|
128
|
+
continue;
|
129
|
+
case 3:
|
130
|
+
sbp.slice_from("i");
|
131
|
+
continue;
|
132
|
+
case 4:
|
133
|
+
sbp.slice_from("o");
|
134
|
+
continue;
|
135
|
+
case 5:
|
136
|
+
sbp.slice_from("u");
|
137
|
+
continue;
|
138
|
+
case 6:
|
139
|
+
if (sbp.cursor >= sbp.limit)
|
140
|
+
break;
|
141
|
+
sbp.cursor++;
|
142
|
+
continue;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
break;
|
146
|
+
}
|
147
|
+
sbp.cursor = v_1;
|
148
|
+
sbp.bra = v_1;
|
149
|
+
if (sbp.eq_s(1, "y")) {
|
150
|
+
sbp.ket = sbp.cursor;
|
151
|
+
sbp.slice_from("Y");
|
152
|
+
} else
|
153
|
+
sbp.cursor = v_1;
|
154
|
+
while (true) {
|
155
|
+
v_2 = sbp.cursor;
|
156
|
+
if (sbp.in_grouping(g_v, 97, 232)) {
|
157
|
+
v_3 = sbp.cursor;
|
158
|
+
sbp.bra = v_3;
|
159
|
+
if (sbp.eq_s(1, "i")) {
|
160
|
+
sbp.ket = sbp.cursor;
|
161
|
+
if (sbp.in_grouping(g_v, 97, 232)) {
|
162
|
+
sbp.slice_from("I");
|
163
|
+
sbp.cursor = v_2;
|
164
|
+
}
|
165
|
+
} else {
|
166
|
+
sbp.cursor = v_3;
|
167
|
+
if (sbp.eq_s(1, "y")) {
|
168
|
+
sbp.ket = sbp.cursor;
|
169
|
+
sbp.slice_from("Y");
|
170
|
+
sbp.cursor = v_2;
|
171
|
+
} else if (habr1(v_2))
|
172
|
+
break;
|
173
|
+
}
|
174
|
+
} else if (habr1(v_2))
|
175
|
+
break;
|
176
|
+
}
|
177
|
+
}
|
178
|
+
|
179
|
+
function habr1(v_1) {
|
180
|
+
sbp.cursor = v_1;
|
181
|
+
if (v_1 >= sbp.limit)
|
182
|
+
return true;
|
183
|
+
sbp.cursor++;
|
184
|
+
return false;
|
185
|
+
}
|
186
|
+
|
187
|
+
function r_mark_regions() {
|
188
|
+
I_p1 = sbp.limit;
|
189
|
+
I_p2 = I_p1;
|
190
|
+
if (!habr2()) {
|
191
|
+
I_p1 = sbp.cursor;
|
192
|
+
if (I_p1 < 3)
|
193
|
+
I_p1 = 3;
|
194
|
+
if (!habr2())
|
195
|
+
I_p2 = sbp.cursor;
|
196
|
+
}
|
197
|
+
}
|
198
|
+
|
199
|
+
function habr2() {
|
200
|
+
while (!sbp.in_grouping(g_v, 97, 232)) {
|
201
|
+
if (sbp.cursor >= sbp.limit)
|
202
|
+
return true;
|
203
|
+
sbp.cursor++;
|
204
|
+
}
|
205
|
+
while (!sbp.out_grouping(g_v, 97, 232)) {
|
206
|
+
if (sbp.cursor >= sbp.limit)
|
207
|
+
return true;
|
208
|
+
sbp.cursor++;
|
209
|
+
}
|
210
|
+
return false;
|
211
|
+
}
|
212
|
+
|
213
|
+
function r_postlude() {
|
214
|
+
var among_var;
|
215
|
+
while (true) {
|
216
|
+
sbp.bra = sbp.cursor;
|
217
|
+
among_var = sbp.find_among(a_1, 3);
|
218
|
+
if (among_var) {
|
219
|
+
sbp.ket = sbp.cursor;
|
220
|
+
switch (among_var) {
|
221
|
+
case 1:
|
222
|
+
sbp.slice_from("y");
|
223
|
+
break;
|
224
|
+
case 2:
|
225
|
+
sbp.slice_from("i");
|
226
|
+
break;
|
227
|
+
case 3:
|
228
|
+
if (sbp.cursor >= sbp.limit)
|
229
|
+
return;
|
230
|
+
sbp.cursor++;
|
231
|
+
break;
|
232
|
+
}
|
233
|
+
}
|
234
|
+
}
|
235
|
+
}
|
236
|
+
|
237
|
+
function r_R1() {
|
238
|
+
return I_p1 <= sbp.cursor;
|
239
|
+
}
|
240
|
+
|
241
|
+
function r_R2() {
|
242
|
+
return I_p2 <= sbp.cursor;
|
243
|
+
}
|
244
|
+
|
245
|
+
function r_undouble() {
|
246
|
+
var v_1 = sbp.limit - sbp.cursor;
|
247
|
+
if (sbp.find_among_b(a_2, 3)) {
|
248
|
+
sbp.cursor = sbp.limit - v_1;
|
249
|
+
sbp.ket = sbp.cursor;
|
250
|
+
if (sbp.cursor > sbp.limit_backward) {
|
251
|
+
sbp.cursor--;
|
252
|
+
sbp.bra = sbp.cursor;
|
253
|
+
sbp.slice_del();
|
254
|
+
}
|
255
|
+
}
|
256
|
+
}
|
257
|
+
|
258
|
+
function r_e_ending() {
|
259
|
+
var v_1;
|
260
|
+
B_e_found = false;
|
261
|
+
sbp.ket = sbp.cursor;
|
262
|
+
if (sbp.eq_s_b(1, "e")) {
|
263
|
+
sbp.bra = sbp.cursor;
|
264
|
+
if (r_R1()) {
|
265
|
+
v_1 = sbp.limit - sbp.cursor;
|
266
|
+
if (sbp.out_grouping_b(g_v, 97, 232)) {
|
267
|
+
sbp.cursor = sbp.limit - v_1;
|
268
|
+
sbp.slice_del();
|
269
|
+
B_e_found = true;
|
270
|
+
r_undouble();
|
271
|
+
}
|
272
|
+
}
|
273
|
+
}
|
274
|
+
}
|
275
|
+
|
276
|
+
function r_en_ending() {
|
277
|
+
var v_1;
|
278
|
+
if (r_R1()) {
|
279
|
+
v_1 = sbp.limit - sbp.cursor;
|
280
|
+
if (sbp.out_grouping_b(g_v, 97, 232)) {
|
281
|
+
sbp.cursor = sbp.limit - v_1;
|
282
|
+
if (!sbp.eq_s_b(3, "gem")) {
|
283
|
+
sbp.cursor = sbp.limit - v_1;
|
284
|
+
sbp.slice_del();
|
285
|
+
r_undouble();
|
286
|
+
}
|
287
|
+
}
|
288
|
+
}
|
289
|
+
}
|
290
|
+
|
291
|
+
function r_standard_suffix() {
|
292
|
+
var among_var, v_1 = sbp.limit - sbp.cursor,
|
293
|
+
v_2, v_3, v_4, v_5, v_6;
|
294
|
+
sbp.ket = sbp.cursor;
|
295
|
+
among_var = sbp.find_among_b(a_3, 5);
|
296
|
+
if (among_var) {
|
297
|
+
sbp.bra = sbp.cursor;
|
298
|
+
switch (among_var) {
|
299
|
+
case 1:
|
300
|
+
if (r_R1())
|
301
|
+
sbp.slice_from("heid");
|
302
|
+
break;
|
303
|
+
case 2:
|
304
|
+
r_en_ending();
|
305
|
+
break;
|
306
|
+
case 3:
|
307
|
+
if (r_R1() && sbp.out_grouping_b(g_v_j, 97, 232))
|
308
|
+
sbp.slice_del();
|
309
|
+
break;
|
310
|
+
}
|
311
|
+
}
|
312
|
+
sbp.cursor = sbp.limit - v_1;
|
313
|
+
r_e_ending();
|
314
|
+
sbp.cursor = sbp.limit - v_1;
|
315
|
+
sbp.ket = sbp.cursor;
|
316
|
+
if (sbp.eq_s_b(4, "heid")) {
|
317
|
+
sbp.bra = sbp.cursor;
|
318
|
+
if (r_R2()) {
|
319
|
+
v_2 = sbp.limit - sbp.cursor;
|
320
|
+
if (!sbp.eq_s_b(1, "c")) {
|
321
|
+
sbp.cursor = sbp.limit - v_2;
|
322
|
+
sbp.slice_del();
|
323
|
+
sbp.ket = sbp.cursor;
|
324
|
+
if (sbp.eq_s_b(2, "en")) {
|
325
|
+
sbp.bra = sbp.cursor;
|
326
|
+
r_en_ending();
|
327
|
+
}
|
328
|
+
}
|
329
|
+
}
|
330
|
+
}
|
331
|
+
sbp.cursor = sbp.limit - v_1;
|
332
|
+
sbp.ket = sbp.cursor;
|
333
|
+
among_var = sbp.find_among_b(a_4, 6);
|
334
|
+
if (among_var) {
|
335
|
+
sbp.bra = sbp.cursor;
|
336
|
+
switch (among_var) {
|
337
|
+
case 1:
|
338
|
+
if (r_R2()) {
|
339
|
+
sbp.slice_del();
|
340
|
+
v_3 = sbp.limit - sbp.cursor;
|
341
|
+
sbp.ket = sbp.cursor;
|
342
|
+
if (sbp.eq_s_b(2, "ig")) {
|
343
|
+
sbp.bra = sbp.cursor;
|
344
|
+
if (r_R2()) {
|
345
|
+
v_4 = sbp.limit - sbp.cursor;
|
346
|
+
if (!sbp.eq_s_b(1, "e")) {
|
347
|
+
sbp.cursor = sbp.limit - v_4;
|
348
|
+
sbp.slice_del();
|
349
|
+
break;
|
350
|
+
}
|
351
|
+
}
|
352
|
+
}
|
353
|
+
sbp.cursor = sbp.limit - v_3;
|
354
|
+
r_undouble();
|
355
|
+
}
|
356
|
+
break;
|
357
|
+
case 2:
|
358
|
+
if (r_R2()) {
|
359
|
+
v_5 = sbp.limit - sbp.cursor;
|
360
|
+
if (!sbp.eq_s_b(1, "e")) {
|
361
|
+
sbp.cursor = sbp.limit - v_5;
|
362
|
+
sbp.slice_del();
|
363
|
+
}
|
364
|
+
}
|
365
|
+
break;
|
366
|
+
case 3:
|
367
|
+
if (r_R2()) {
|
368
|
+
sbp.slice_del();
|
369
|
+
r_e_ending();
|
370
|
+
}
|
371
|
+
break;
|
372
|
+
case 4:
|
373
|
+
if (r_R2())
|
374
|
+
sbp.slice_del();
|
375
|
+
break;
|
376
|
+
case 5:
|
377
|
+
if (r_R2() && B_e_found)
|
378
|
+
sbp.slice_del();
|
379
|
+
break;
|
380
|
+
}
|
381
|
+
}
|
382
|
+
sbp.cursor = sbp.limit - v_1;
|
383
|
+
if (sbp.out_grouping_b(g_v_I, 73, 232)) {
|
384
|
+
v_6 = sbp.limit - sbp.cursor;
|
385
|
+
if (sbp.find_among_b(a_5, 4) && sbp.out_grouping_b(g_v, 97, 232)) {
|
386
|
+
sbp.cursor = sbp.limit - v_6;
|
387
|
+
sbp.ket = sbp.cursor;
|
388
|
+
if (sbp.cursor > sbp.limit_backward) {
|
389
|
+
sbp.cursor--;
|
390
|
+
sbp.bra = sbp.cursor;
|
391
|
+
sbp.slice_del();
|
392
|
+
}
|
393
|
+
}
|
394
|
+
}
|
395
|
+
}
|
396
|
+
this.stem = function() {
|
397
|
+
var v_1 = sbp.cursor;
|
398
|
+
r_prelude();
|
399
|
+
sbp.cursor = v_1;
|
400
|
+
r_mark_regions();
|
401
|
+
sbp.limit_backward = v_1;
|
402
|
+
sbp.cursor = sbp.limit;
|
403
|
+
r_standard_suffix();
|
404
|
+
sbp.cursor = sbp.limit_backward;
|
405
|
+
r_postlude();
|
406
|
+
return true;
|
407
|
+
}
|
408
|
+
};
|
409
|
+
|
410
|
+
/* and return a function that stems a word for the current locale */
|
411
|
+
return function(word) {
|
412
|
+
st.setCurrent(word);
|
413
|
+
st.stem();
|
414
|
+
return st.getCurrent();
|
415
|
+
}
|
416
|
+
})();
|
417
|
+
|
418
|
+
lunr.Pipeline.registerFunction(lunr.du.stemmer, 'stemmer-du');
|
419
|
+
|
420
|
+
/* stop word filter function */
|
421
|
+
lunr.du.stopWordFilter = function(token) {
|
422
|
+
if (lunr.du.stopWordFilter.stopWords.indexOf(token) === -1) {
|
423
|
+
return token;
|
424
|
+
}
|
425
|
+
};
|
426
|
+
|
427
|
+
lunr.du.stopWordFilter.stopWords = new lunr.SortedSet();
|
428
|
+
lunr.du.stopWordFilter.stopWords.length = 103;
|
429
|
+
|
430
|
+
// The space at the beginning is crucial: It marks the empty string
|
431
|
+
// as a stop word. lunr.js crashes during search when documents
|
432
|
+
// processed by the pipeline still contain the empty string.
|
433
|
+
lunr.du.stopWordFilter.stopWords.elements = ' aan al alles als altijd andere ben bij daar dan dat de der deze die dit doch doen door dus een eens en er ge geen geweest haar had heb hebben heeft hem het hier hij hoe hun iemand iets ik in is ja je kan kon kunnen maar me meer men met mij mijn moet na naar niet niets nog nu of om omdat onder ons ook op over reeds te tegen toch toen tot u uit uw van veel voor want waren was wat werd wezen wie wil worden wordt zal ze zelf zich zij zijn zo zonder zou'.split(' ');
|
434
|
+
|
435
|
+
lunr.Pipeline.registerFunction(lunr.du.stopWordFilter, 'stopWordFilter-du');
|
436
|
+
};
|
437
|
+
}))
|