jekyll_pages_api_search 0.4.5 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE.md +13 -31
- data/README.md +21 -66
- data/assets/js/merge-options.js +22 -0
- data/assets/js/search-bundle.js +23 -16
- data/assets/js/search-bundle.js.gz +0 -0
- data/assets/js/search-engine.js +11 -11
- data/assets/js/search-ui.js +41 -34
- data/assets/js/search.js +3 -4
- data/bin/jekyll_pages_api_search +1 -3
- data/lib/jekyll_pages_api_search.rb +0 -2
- data/lib/jekyll_pages_api_search/assets.rb +0 -2
- data/lib/jekyll_pages_api_search/browserify.js +10 -2
- data/lib/jekyll_pages_api_search/bundler.rb +77 -0
- data/lib/jekyll_pages_api_search/generator.rb +0 -1
- data/lib/jekyll_pages_api_search/lunr.min.js +1 -7
- data/lib/jekyll_pages_api_search/sass.rb +0 -2
- data/lib/jekyll_pages_api_search/search.js +6 -7
- data/lib/jekyll_pages_api_search/search.rb +0 -2
- data/lib/jekyll_pages_api_search/search_hook.rb +6 -4
- data/lib/jekyll_pages_api_search/search_page_layouts.rb +1 -0
- data/lib/jekyll_pages_api_search/site.rb +18 -5
- data/lib/jekyll_pages_api_search/standalone.rb +19 -2
- data/lib/jekyll_pages_api_search/tags.rb +1 -3
- data/lib/jekyll_pages_api_search/version.rb +1 -3
- metadata +8 -8
- data/CONTRIBUTING.md +0 -88
- data/lib/jekyll_pages_api_search/browserify.rb +0 -29
data/assets/js/search.js
CHANGED
@@ -36,11 +36,10 @@ module.exports = function() {
|
|
36
36
|
return;
|
37
37
|
}
|
38
38
|
|
39
|
-
|
40
|
-
|
39
|
+
return searchEngine.executeSearch(
|
40
|
+
window.JEKYLL_PAGES_API_SEARCH_INDEX_URL, window.location.href)
|
41
41
|
.then(function(searchResults) {
|
42
|
-
searchUi.renderResults(searchResults.query,
|
43
|
-
searchResults.results || [],
|
42
|
+
searchUi.renderResults(searchResults.query, searchResults.results,
|
44
43
|
window.renderJekyllPagesApiSearchResults || writeResultsToList);
|
45
44
|
})
|
46
45
|
.catch(function(error) {
|
data/bin/jekyll_pages_api_search
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
-
# Author: Mike Bland <michael.bland@gsa.gov>
|
3
|
-
# Date: 2015-06-21
|
4
2
|
|
5
3
|
require_relative '../lib/jekyll_pages_api_search'
|
6
4
|
require 'fileutils'
|
7
5
|
require 'jekyll_pages_api'
|
8
6
|
require 'zlib'
|
9
7
|
|
10
|
-
ASSETS_DIR = ::JekyllPagesApiSearch::
|
8
|
+
ASSETS_DIR = ::JekyllPagesApiSearch::Assets::JAVASCRIPT_DIR
|
11
9
|
|
12
10
|
USAGE=<<END_USAGE
|
13
11
|
#{$0}: generate a lunr.js index from Jekyll Pages API output
|
@@ -9,6 +9,8 @@ var zlib = require('zlib');
|
|
9
9
|
|
10
10
|
var SOURCE = process.argv[2];
|
11
11
|
var TARGET = process.argv[3];
|
12
|
+
var OPTIONS = process.argv[4];
|
13
|
+
var options;
|
12
14
|
var errors = [];
|
13
15
|
|
14
16
|
if (!SOURCE) {
|
@@ -23,15 +25,21 @@ if (!TARGET) {
|
|
23
25
|
errors.push('parent directory of target file ' + TARGET + ' does not exist');
|
24
26
|
}
|
25
27
|
|
28
|
+
try {
|
29
|
+
options = JSON.parse(OPTIONS);
|
30
|
+
} catch (e) {
|
31
|
+
errors.push('failed to parse Browserify options object:' + e);
|
32
|
+
}
|
33
|
+
|
26
34
|
if (errors.length !== 0) {
|
27
35
|
process.stderr.write(errors.join('\n') + '\n');
|
28
36
|
process.exit(1);
|
29
37
|
}
|
30
38
|
|
31
|
-
var bundler = browserify({ standalone: 'renderJekyllPagesApiSearchResults' });
|
32
39
|
var outputStream = fs.createWriteStream(TARGET);
|
33
40
|
|
34
|
-
|
41
|
+
browserify(options)
|
42
|
+
.add(SOURCE)
|
35
43
|
.transform({ global: true }, 'uglifyify')
|
36
44
|
.bundle()
|
37
45
|
.pipe(outputStream);
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require_relative './assets'
|
2
|
+
require_relative './compressor'
|
3
|
+
require_relative './config'
|
4
|
+
|
5
|
+
require 'English'
|
6
|
+
require 'jekyll_pages_api'
|
7
|
+
require 'json'
|
8
|
+
|
9
|
+
module JekyllPagesApiSearch
|
10
|
+
class Bundler
|
11
|
+
DIRNAME = File.dirname(__FILE__).freeze
|
12
|
+
BROWSERIFY_SCRIPT = File.join(DIRNAME, 'browserify.js').freeze
|
13
|
+
CONSTANTS_MODULE = File.join(Assets::JAVASCRIPT_DIR, 'search-constants.js')
|
14
|
+
.freeze
|
15
|
+
|
16
|
+
def self.create_search_bundles(site)
|
17
|
+
create_custom_renderer_bundle(site)
|
18
|
+
create_search_constants_bundle(site)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.create_custom_renderer_bundle(site)
|
22
|
+
browserify_config = Config.get(site, 'browserify')
|
23
|
+
return if browserify_config.nil?
|
24
|
+
source = File.join(site.source, browserify_config['source'])
|
25
|
+
target = create_target_path(site, browserify_config['target'])
|
26
|
+
execute_browserify(source, target,
|
27
|
+
{ standalone: 'renderJekyllPagesApiSearchResults' })
|
28
|
+
end
|
29
|
+
|
30
|
+
# Generates a JavaScript module containing constants based on `site` values.
|
31
|
+
def self.create_search_constants_bundle(site)
|
32
|
+
target = create_target_path(site, CONSTANTS_MODULE)
|
33
|
+
constants = generate_constants(site)
|
34
|
+
File.open(target, 'w') do |target_file|
|
35
|
+
target_file.write(constants)
|
36
|
+
end
|
37
|
+
Compressor.gzip_in_memory_content({ target => constants })
|
38
|
+
end
|
39
|
+
|
40
|
+
# Creates an object of constants based on `site` values.
|
41
|
+
def self.generate_constants(site)
|
42
|
+
return "var JEKYLL_PAGES_API_SEARCH_INDEX_URL = '" +
|
43
|
+
baseurl_prefix(site) + SearchIndexBuilder::INDEX_FILE + "';\n"
|
44
|
+
end
|
45
|
+
|
46
|
+
# Generates the correct baseurl prefix.
|
47
|
+
def self.baseurl_prefix(site)
|
48
|
+
baseurl = site.baseurl
|
49
|
+
if baseurl.nil? || baseurl.empty? then
|
50
|
+
return '/'
|
51
|
+
elsif baseurl == '/' then
|
52
|
+
return baseurl
|
53
|
+
end
|
54
|
+
return baseurl + '/'
|
55
|
+
end
|
56
|
+
|
57
|
+
# Creates the target bundle path and its directory if it doesn't exist.
|
58
|
+
def self.create_target_path(site, target_file)
|
59
|
+
target = File.join(site.dest, target_file)
|
60
|
+
target_dir = File.dirname(target)
|
61
|
+
if !Dir.exists?(target_dir) then
|
62
|
+
FileUtils.mkdir_p(target_dir)
|
63
|
+
end
|
64
|
+
target
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.execute_browserify(source, target, options)
|
68
|
+
status = system('node', "#{BROWSERIFY_SCRIPT}", "#{source}", "#{target}",
|
69
|
+
JSON.generate(options))
|
70
|
+
if $CHILD_STATUS.exitstatus.nil?
|
71
|
+
$stderr.puts('Could not execute browserify script')
|
72
|
+
exit 1
|
73
|
+
end
|
74
|
+
exit $CHILD_STATUS.exitstatus if !status
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -1,7 +1 @@
|
|
1
|
-
/**
|
2
|
-
* lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.6.0
|
3
|
-
* Copyright (C) 2015 Oliver Nightingale
|
4
|
-
* MIT Licensed
|
5
|
-
* @license
|
6
|
-
*/
|
7
|
-
!function(){var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.6.0",t.utils={},t.utils.warn=function(t){return function(e){t.console&&console.warn&&console.warn(e)}}(this),t.utils.asString=function(t){return void 0===t||null===t?"":t.toString()},t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=t;if("function"!=typeof e)throw new TypeError("last argument must be a function");n.forEach(function(t){this.hasHandler(t)||(this.events[t]=[]),this.events[t].push(e)},this)},t.EventEmitter.prototype.removeListener=function(t,e){if(this.hasHandler(t)){var n=this.events[t].indexOf(e);this.events[t].splice(n,1),this.events[t].length||delete this.events[t]}},t.EventEmitter.prototype.emit=function(t){if(this.hasHandler(t)){var e=Array.prototype.slice.call(arguments,1);this.events[t].forEach(function(t){t.apply(void 0,e)})}},t.EventEmitter.prototype.hasHandler=function(t){return t in this.events},t.tokenizer=function(e){return arguments.length&&null!=e&&void 0!=e?Array.isArray(e)?e.map(function(e){return t.utils.asString(e).toLowerCase()}):e.toString().trim().toLowerCase().split(t.tokenizer.seperator):[]},t.tokenizer.seperator=/[\s\-]+/,t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.registeredFunctions[e];if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");this._stack.splice(i,0,n)},t.Pipeline.prototype.remove=function(t){var e=this._stack.indexOf(t);-1!=e&&this._stack.splice(e,1)},t.Pipeline.prototype.run=function(t){for(var e=[],n=t.length,i=this._stack.length,r=0;n>r;r++){for(var o=t[r],s=0;i>s&&(o=this._stack[s](o,r,t),void 0!==o&&""!==o);s++);void 0!==o&&""!==o&&e.push(o)}return e},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Vector=function(){this._magnitude=null,this.list=void 0,this.length=0},t.Vector.Node=function(t,e,n){this.idx=t,this.val=e,this.next=n},t.Vector.prototype.insert=function(e,n){this._magnitude=void 0;var i=this.list;if(!i)return this.list=new t.Vector.Node(e,n,i),this.length++;if(e<i.idx)return this.list=new t.Vector.Node(e,n,i),this.length++;for(var r=i,o=i.next;void 0!=o;){if(e<o.idx)return r.next=new t.Vector.Node(e,n,o),this.length++;r=o,o=o.next}return r.next=new t.Vector.Node(e,n,o),this.length++},t.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var t,e=this.list,n=0;e;)t=e.val,n+=t*t,e=e.next;return this._magnitude=Math.sqrt(n)},t.Vector.prototype.dot=function(t){for(var e=this.list,n=t.list,i=0;e&&n;)e.idx<n.idx?e=e.next:e.idx>n.idx?n=n.next:(i+=e.val*n.val,e=e.next,n=n.next);return i},t.Vector.prototype.similarity=function(t){return this.dot(t)/(this.magnitude()*t.magnitude())},t.SortedSet=function(){this.length=0,this.elements=[]},t.SortedSet.load=function(t){var e=new this;return e.elements=t,e.length=t.length,e},t.SortedSet.prototype.add=function(){var t,e;for(t=0;t<arguments.length;t++)e=arguments[t],~this.indexOf(e)||this.elements.splice(this.locationFor(e),0,e);this.length=this.elements.length},t.SortedSet.prototype.toArray=function(){return this.elements.slice()},t.SortedSet.prototype.map=function(t,e){return this.elements.map(t,e)},t.SortedSet.prototype.forEach=function(t,e){return this.elements.forEach(t,e)},t.SortedSet.prototype.indexOf=function(t){for(var e=0,n=this.elements.length,i=n-e,r=e+Math.floor(i/2),o=this.elements[r];i>1;){if(o===t)return r;t>o&&(e=r),o>t&&(n=r),i=n-e,r=e+Math.floor(i/2),o=this.elements[r]}return o===t?r:-1},t.SortedSet.prototype.locationFor=function(t){for(var e=0,n=this.elements.length,i=n-e,r=e+Math.floor(i/2),o=this.elements[r];i>1;)t>o&&(e=r),o>t&&(n=r),i=n-e,r=e+Math.floor(i/2),o=this.elements[r];return o>t?r:t>o?r+1:void 0},t.SortedSet.prototype.intersect=function(e){for(var n=new t.SortedSet,i=0,r=0,o=this.length,s=e.length,a=this.elements,h=e.elements;;){if(i>o-1||r>s-1)break;a[i]!==h[r]?a[i]<h[r]?i++:a[i]>h[r]&&r++:(n.add(a[i]),i++,r++)}return n},t.SortedSet.prototype.clone=function(){var e=new t.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},t.SortedSet.prototype.union=function(t){var e,n,i;return this.length>=t.length?(e=this,n=t):(e=t,n=this),i=e.clone(),i.add.apply(i,n.toArray()),i},t.SortedSet.prototype.toJSON=function(){return this.toArray()},t.Index=function(){this._fields=[],this._ref="id",this.pipeline=new t.Pipeline,this.documentStore=new t.Store,this.tokenStore=new t.TokenStore,this.corpusTokens=new t.SortedSet,this.eventEmitter=new t.EventEmitter,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},t.Index.prototype.on=function(){var t=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,t)},t.Index.prototype.off=function(t,e){return this.eventEmitter.removeListener(t,e)},t.Index.load=function(e){e.version!==t.version&&t.utils.warn("version mismatch: current "+t.version+" importing "+e.version);var n=new this;return n._fields=e.fields,n._ref=e.ref,n.documentStore=t.Store.load(e.documentStore),n.tokenStore=t.TokenStore.load(e.tokenStore),n.corpusTokens=t.SortedSet.load(e.corpusTokens),n.pipeline=t.Pipeline.load(e.pipeline),n},t.Index.prototype.field=function(t,e){var e=e||{},n={name:t,boost:e.boost||1};return this._fields.push(n),this},t.Index.prototype.ref=function(t){return this._ref=t,this},t.Index.prototype.add=function(e,n){var i={},r=new t.SortedSet,o=e[this._ref],n=void 0===n?!0:n;this._fields.forEach(function(n){var o=this.pipeline.run(t.tokenizer(e[n.name]));i[n.name]=o,t.SortedSet.prototype.add.apply(r,o)},this),this.documentStore.set(o,r),t.SortedSet.prototype.add.apply(this.corpusTokens,r.toArray());for(var s=0;s<r.length;s++){var a=r.elements[s],h=this._fields.reduce(function(t,e){var n=i[e.name].length;if(!n)return t;var r=i[e.name].filter(function(t){return t===a}).length;return t+r/n*e.boost},0);this.tokenStore.add(a,{ref:o,tf:h})}n&&this.eventEmitter.emit("add",e,this)},t.Index.prototype.remove=function(t,e){var n=t[this._ref],e=void 0===e?!0:e;if(this.documentStore.has(n)){var i=this.documentStore.get(n);this.documentStore.remove(n),i.forEach(function(t){this.tokenStore.remove(t,n)},this),e&&this.eventEmitter.emit("remove",t,this)}},t.Index.prototype.update=function(t,e){var e=void 0===e?!0:e;this.remove(t,!1),this.add(t,!1),e&&this.eventEmitter.emit("update",t,this)},t.Index.prototype.idf=function(t){var e="@"+t;if(Object.prototype.hasOwnProperty.call(this._idfCache,e))return this._idfCache[e];var n=this.tokenStore.count(t),i=1;return n>0&&(i=1+Math.log(this.documentStore.length/n)),this._idfCache[e]=i},t.Index.prototype.search=function(e){var n=this.pipeline.run(t.tokenizer(e)),i=new t.Vector,r=[],o=this._fields.reduce(function(t,e){return t+e.boost},0),s=n.some(function(t){return this.tokenStore.has(t)},this);if(!s)return[];n.forEach(function(e,n,s){var a=1/s.length*this._fields.length*o,h=this,u=this.tokenStore.expand(e).reduce(function(n,r){var o=h.corpusTokens.indexOf(r),s=h.idf(r),u=1,l=new t.SortedSet;if(r!==e){var c=Math.max(3,r.length-e.length);u=1/Math.log(c)}o>-1&&i.insert(o,a*s*u);for(var f=h.tokenStore.get(r),p=Object.keys(f),d=p.length,v=0;d>v;v++)l.add(f[p[v]].ref);return n.union(l)},new t.SortedSet);r.push(u)},this);var a=r.reduce(function(t,e){return t.intersect(e)});return a.map(function(t){return{ref:t,score:i.similarity(this.documentVector(t))}},this).sort(function(t,e){return e.score-t.score})},t.Index.prototype.documentVector=function(e){for(var n=this.documentStore.get(e),i=n.length,r=new t.Vector,o=0;i>o;o++){var s=n.elements[o],a=this.tokenStore.get(s)[e].tf,h=this.idf(s);r.insert(this.corpusTokens.indexOf(s),a*h)}return r},t.Index.prototype.toJSON=function(){return{version:t.version,fields:this._fields,ref:this._ref,documentStore:this.documentStore.toJSON(),tokenStore:this.tokenStore.toJSON(),corpusTokens:this.corpusTokens.toJSON(),pipeline:this.pipeline.toJSON()}},t.Index.prototype.use=function(t){var e=Array.prototype.slice.call(arguments,1);e.unshift(this),t.apply(this,e)},t.Store=function(){this.store={},this.length=0},t.Store.load=function(e){var n=new this;return n.length=e.length,n.store=Object.keys(e.store).reduce(function(n,i){return n[i]=t.SortedSet.load(e.store[i]),n},{}),n},t.Store.prototype.set=function(t,e){this.has(t)||this.length++,this.store[t]=e},t.Store.prototype.get=function(t){return this.store[t]},t.Store.prototype.has=function(t){return t in this.store},t.Store.prototype.remove=function(t){this.has(t)&&(delete this.store[t],this.length--)},t.Store.prototype.toJSON=function(){return{store:this.store,length:this.length}},t.stemmer=function(){var t={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},e={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},n="[^aeiou]",i="[aeiouy]",r=n+"[^aeiouy]*",o=i+"[aeiou]*",s="^("+r+")?"+o+r,a="^("+r+")?"+o+r+"("+o+")?$",h="^("+r+")?"+o+r+o+r,u="^("+r+")?"+i,l=new RegExp(s),c=new RegExp(h),f=new RegExp(a),p=new RegExp(u),d=/^(.+?)(ss|i)es$/,v=/^(.+?)([^s])s$/,m=/^(.+?)eed$/,g=/^(.+?)(ed|ing)$/,y=/.$/,S=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\1$"),x=new RegExp("^"+r+i+"[^aeiouwxy]$"),k=/^(.+?[^aeiou])y$/,b=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,E=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,_=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,F=/^(.+?)(s|t)(ion)$/,O=/^(.+?)e$/,P=/ll$/,N=new RegExp("^"+r+i+"[^aeiouwxy]$"),T=function(n){var i,r,o,s,a,h,u;if(n.length<3)return n;if(o=n.substr(0,1),"y"==o&&(n=o.toUpperCase()+n.substr(1)),s=d,a=v,s.test(n)?n=n.replace(s,"$1$2"):a.test(n)&&(n=n.replace(a,"$1$2")),s=m,a=g,s.test(n)){var T=s.exec(n);s=l,s.test(T[1])&&(s=y,n=n.replace(s,""))}else if(a.test(n)){var T=a.exec(n);i=T[1],a=p,a.test(i)&&(n=i,a=S,h=w,u=x,a.test(n)?n+="e":h.test(n)?(s=y,n=n.replace(s,"")):u.test(n)&&(n+="e"))}if(s=k,s.test(n)){var T=s.exec(n);i=T[1],n=i+"i"}if(s=b,s.test(n)){var T=s.exec(n);i=T[1],r=T[2],s=l,s.test(i)&&(n=i+t[r])}if(s=E,s.test(n)){var T=s.exec(n);i=T[1],r=T[2],s=l,s.test(i)&&(n=i+e[r])}if(s=_,a=F,s.test(n)){var T=s.exec(n);i=T[1],s=c,s.test(i)&&(n=i)}else if(a.test(n)){var T=a.exec(n);i=T[1]+T[2],a=c,a.test(i)&&(n=i)}if(s=O,s.test(n)){var T=s.exec(n);i=T[1],s=c,a=f,h=N,(s.test(i)||a.test(i)&&!h.test(i))&&(n=i)}return s=P,a=c,s.test(n)&&a.test(n)&&(s=y,n=n.replace(s,"")),"y"==o&&(n=o.toLowerCase()+n.substr(1)),n};return T}(),t.Pipeline.registerFunction(t.stemmer,"stemmer"),t.generateStopWordFilter=function(t){var e=t.reduce(function(t,e){return t[e]=e,t},{});return function(t){return t&&e[t]!==t?t:void 0}},t.stopWordFilter=t.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter"),t.trimmer=function(t){return t.replace(/^\W+/,"").replace(/\W+$/,"")},t.Pipeline.registerFunction(t.trimmer,"trimmer"),t.TokenStore=function(){this.root={docs:{}},this.length=0},t.TokenStore.load=function(t){var e=new this;return e.root=t.root,e.length=t.length,e},t.TokenStore.prototype.add=function(t,e,n){var n=n||this.root,i=t.charAt(0),r=t.slice(1);return i in n||(n[i]={docs:{}}),0===r.length?(n[i].docs[e.ref]=e,void(this.length+=1)):this.add(r,e,n[i])},t.TokenStore.prototype.has=function(t){if(!t)return!1;for(var e=this.root,n=0;n<t.length;n++){if(!e[t.charAt(n)])return!1;e=e[t.charAt(n)]}return!0},t.TokenStore.prototype.getNode=function(t){if(!t)return{};for(var e=this.root,n=0;n<t.length;n++){if(!e[t.charAt(n)])return{};e=e[t.charAt(n)]}return e},t.TokenStore.prototype.get=function(t,e){return this.getNode(t,e).docs||{}},t.TokenStore.prototype.count=function(t,e){return Object.keys(this.get(t,e)).length},t.TokenStore.prototype.remove=function(t,e){if(t){for(var n=this.root,i=0;i<t.length;i++){if(!(t.charAt(i)in n))return;n=n[t.charAt(i)]}delete n.docs[e]}},t.TokenStore.prototype.expand=function(t,e){var n=this.getNode(t),i=n.docs||{},e=e||[];return Object.keys(i).length&&e.push(t),Object.keys(n).forEach(function(n){"docs"!==n&&e.concat(this.expand(t+n,e))},this),e},t.TokenStore.prototype.toJSON=function(){return{root:this.root,length:this.length}},function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():t.lunr=e()}(this,function(){return t})}();
|
1
|
+
!function(){var e=function(t){var r=new e.Builder;return r.pipeline.add(e.trimmer,e.stopWordFilter,e.stemmer),r.searchPipeline.add(e.stemmer),t.call(r,r),r.build()};e.version="2.1.5",e.utils={},e.utils.warn=(t=this,function(e){t.console&&console.warn&&console.warn(e)});var t;e.utils.asString=function(e){return void 0===e||null===e?"":e.toString()},e.FieldRef=function(e,t,r){this.docRef=e,this.fieldName=t,this._stringValue=r},e.FieldRef.joiner="/",e.FieldRef.fromString=function(t){var r=t.indexOf(e.FieldRef.joiner);if(-1===r)throw"malformed field ref string";var i=t.slice(0,r),n=t.slice(r+1);return new e.FieldRef(n,i,t)},e.FieldRef.prototype.toString=function(){return void 0==this._stringValue&&(this._stringValue=this.fieldName+e.FieldRef.joiner+this.docRef),this._stringValue},e.idf=function(e,t){var r=0;for(var i in e)"_index"!=i&&(r+=Object.keys(e[i]).length);var n=(t-r+.5)/(r+.5);return Math.log(1+Math.abs(n))},e.Token=function(e,t){this.str=e||"",this.metadata=t||{}},e.Token.prototype.toString=function(){return this.str},e.Token.prototype.update=function(e){return this.str=e(this.str,this.metadata),this},e.Token.prototype.clone=function(t){return t=t||function(e){return e},new e.Token(t(this.str,this.metadata),this.metadata)},e.tokenizer=function(t){if(null==t||void 0==t)return[];if(Array.isArray(t))return t.map(function(t){return new e.Token(e.utils.asString(t).toLowerCase())});for(var r=t.toString().trim().toLowerCase(),i=r.length,n=[],s=0,o=0;s<=i;s++){var a=s-o;(r.charAt(s).match(e.tokenizer.separator)||s==i)&&(a>0&&n.push(new e.Token(r.slice(o,s),{position:[o,a],index:n.length})),o=s+1)}return n},e.tokenizer.separator=/[\s\-]+/,e.Pipeline=function(){this._stack=[]},e.Pipeline.registeredFunctions=Object.create(null),e.Pipeline.registerFunction=function(t,r){r in this.registeredFunctions&&e.utils.warn("Overwriting existing registered function: "+r),t.label=r,e.Pipeline.registeredFunctions[t.label]=t},e.Pipeline.warnIfFunctionNotRegistered=function(t){t.label&&t.label in this.registeredFunctions||e.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",t)},e.Pipeline.load=function(t){var r=new e.Pipeline;return t.forEach(function(t){var i=e.Pipeline.registeredFunctions[t];if(!i)throw new Error("Cannot load unregistered function: "+t);r.add(i)}),r},e.Pipeline.prototype.add=function(){Array.prototype.slice.call(arguments).forEach(function(t){e.Pipeline.warnIfFunctionNotRegistered(t),this._stack.push(t)},this)},e.Pipeline.prototype.after=function(t,r){e.Pipeline.warnIfFunctionNotRegistered(r);var i=this._stack.indexOf(t);if(-1==i)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,r)},e.Pipeline.prototype.before=function(t,r){e.Pipeline.warnIfFunctionNotRegistered(r);var i=this._stack.indexOf(t);if(-1==i)throw new Error("Cannot find existingFn");this._stack.splice(i,0,r)},e.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);-1!=t&&this._stack.splice(t,1)},e.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r<t;r++){var i=this._stack[r];e=e.reduce(function(t,r,n){var s=i(r,n,e);return void 0===s||""===s?t:t.concat(s)},[])}return e},e.Pipeline.prototype.runString=function(t){var r=new e.Token(t);return this.run([r]).map(function(e){return e.toString()})},e.Pipeline.prototype.reset=function(){this._stack=[]},e.Pipeline.prototype.toJSON=function(){return this._stack.map(function(t){return e.Pipeline.warnIfFunctionNotRegistered(t),t.label})},e.Vector=function(e){this._magnitude=0,this.elements=e||[]},e.Vector.prototype.positionForIndex=function(e){if(0==this.elements.length)return 0;for(var t=0,r=this.elements.length/2,i=r-t,n=Math.floor(i/2),s=this.elements[2*n];i>1&&(s<e&&(t=n),s>e&&(r=n),s!=e);)i=r-t,n=t+Math.floor(i/2),s=this.elements[2*n];return s==e?2*n:s>e?2*n:s<e?2*(n+1):void 0},e.Vector.prototype.insert=function(e,t){this.upsert(e,t,function(){throw"duplicate index"})},e.Vector.prototype.upsert=function(e,t,r){this._magnitude=0;var i=this.positionForIndex(e);this.elements[i]==e?this.elements[i+1]=r(this.elements[i+1],t):this.elements.splice(i,0,e,t)},e.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var e=0,t=this.elements.length,r=1;r<t;r+=2){var i=this.elements[r];e+=i*i}return this._magnitude=Math.sqrt(e)},e.Vector.prototype.dot=function(e){for(var t=0,r=this.elements,i=e.elements,n=r.length,s=i.length,o=0,a=0,u=0,l=0;u<n&&l<s;)(o=r[u])<(a=i[l])?u+=2:o>a?l+=2:o==a&&(t+=r[u+1]*i[l+1],u+=2,l+=2);return t},e.Vector.prototype.similarity=function(e){return this.dot(e)/(this.magnitude()*e.magnitude())},e.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),t=1,r=0;t<this.elements.length;t+=2,r++)e[r]=this.elements[t];return e},e.Vector.prototype.toJSON=function(){return this.elements},e.stemmer=function(){var e={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},t={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},r="[aeiouy]",i="[^aeiou][^aeiouy]*",n=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),s=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),o=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$"),a=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy]"),u=/^(.+?)(ss|i)es$/,l=/^(.+?)([^s])s$/,d=/^(.+?)eed$/,h=/^(.+?)(ed|ing)$/,c=/.$/,f=/(at|bl|iz)$/,p=new RegExp("([^aeiouylsz])\\1$"),y=new RegExp("^"+i+r+"[^aeiouwxy]$"),m=/^(.+?[^aeiou])y$/,g=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,v=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,x=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,w=/^(.+?)(s|t)(ion)$/,k=/^(.+?)e$/,Q=/ll$/,L=new RegExp("^"+i+r+"[^aeiouwxy]$"),T=function(r){var i,T,S,b,P,E,I;if(r.length<3)return r;if("y"==(S=r.substr(0,1))&&(r=S.toUpperCase()+r.substr(1)),P=l,(b=u).test(r)?r=r.replace(b,"$1$2"):P.test(r)&&(r=r.replace(P,"$1$2")),P=h,(b=d).test(r)){var O=b.exec(r);(b=n).test(O[1])&&(b=c,r=r.replace(b,""))}else if(P.test(r)){i=(O=P.exec(r))[1],(P=a).test(i)&&(E=p,I=y,(P=f).test(r=i)?r+="e":E.test(r)?(b=c,r=r.replace(b,"")):I.test(r)&&(r+="e"))}if((b=m).test(r)){r=(i=(O=b.exec(r))[1])+"i"}if((b=g).test(r)){i=(O=b.exec(r))[1],T=O[2],(b=n).test(i)&&(r=i+e[T])}if((b=v).test(r)){i=(O=b.exec(r))[1],T=O[2],(b=n).test(i)&&(r=i+t[T])}if(P=w,(b=x).test(r)){i=(O=b.exec(r))[1],(b=s).test(i)&&(r=i)}else if(P.test(r)){i=(O=P.exec(r))[1]+O[2],(P=s).test(i)&&(r=i)}if((b=k).test(r)){i=(O=b.exec(r))[1],P=o,E=L,((b=s).test(i)||P.test(i)&&!E.test(i))&&(r=i)}return P=s,(b=Q).test(r)&&P.test(r)&&(b=c,r=r.replace(b,"")),"y"==S&&(r=S.toLowerCase()+r.substr(1)),r};return function(e){return e.update(T)}}(),e.Pipeline.registerFunction(e.stemmer,"stemmer"),e.generateStopWordFilter=function(e){var t=e.reduce(function(e,t){return e[t]=t,e},{});return function(e){if(e&&t[e.toString()]!==e.toString())return e}},e.stopWordFilter=e.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),e.Pipeline.registerFunction(e.stopWordFilter,"stopWordFilter"),e.trimmer=function(e){return e.update(function(e){return e.replace(/^\W+/,"").replace(/\W+$/,"")})},e.Pipeline.registerFunction(e.trimmer,"trimmer"),e.TokenSet=function(){this.final=!1,this.edges={},this.id=e.TokenSet._nextId,e.TokenSet._nextId+=1},e.TokenSet._nextId=1,e.TokenSet.fromArray=function(t){for(var r=new e.TokenSet.Builder,i=0,n=t.length;i<n;i++)r.insert(t[i]);return r.finish(),r.root},e.TokenSet.fromClause=function(t){return"editDistance"in t?e.TokenSet.fromFuzzyString(t.term,t.editDistance):e.TokenSet.fromString(t.term)},e.TokenSet.fromFuzzyString=function(t,r){for(var i=new e.TokenSet,n=[{node:i,editsRemaining:r,str:t}];n.length;){var s=n.pop();if(s.str.length>0){var o;(a=s.str.charAt(0))in s.node.edges?o=s.node.edges[a]:(o=new e.TokenSet,s.node.edges[a]=o),1==s.str.length?o.final=!0:n.push({node:o,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining>0&&s.str.length>1){var a,u;(a=s.str.charAt(1))in s.node.edges?u=s.node.edges[a]:(u=new e.TokenSet,s.node.edges[a]=u),s.str.length<=2?u.final=!0:n.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(2)})}if(s.editsRemaining>0&&1==s.str.length&&(s.node.final=!0),s.editsRemaining>0&&s.str.length>=1){if("*"in s.node.edges)var l=s.node.edges["*"];else{l=new e.TokenSet;s.node.edges["*"]=l}1==s.str.length?l.final=!0:n.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.editsRemaining>0){if("*"in s.node.edges)var d=s.node.edges["*"];else{d=new e.TokenSet;s.node.edges["*"]=d}0==s.str.length?d.final=!0:n.push({node:d,editsRemaining:s.editsRemaining-1,str:s.str})}if(s.editsRemaining>0&&s.str.length>1){var h,c=s.str.charAt(0),f=s.str.charAt(1);f in s.node.edges?h=s.node.edges[f]:(h=new e.TokenSet,s.node.edges[f]=h),1==s.str.length?h.final=!0:n.push({node:h,editsRemaining:s.editsRemaining-1,str:c+s.str.slice(2)})}}return i},e.TokenSet.fromString=function(t){for(var r=new e.TokenSet,i=r,n=!1,s=0,o=t.length;s<o;s++){var a=t[s],u=s==o-1;if("*"==a)n=!0,r.edges[a]=r,r.final=u;else{var l=new e.TokenSet;l.final=u,r.edges[a]=l,r=l,n&&(r.edges["*"]=i)}}return i},e.TokenSet.prototype.toArray=function(){for(var e=[],t=[{prefix:"",node:this}];t.length;){var r=t.pop(),i=Object.keys(r.node.edges),n=i.length;r.node.final&&e.push(r.prefix);for(var s=0;s<n;s++){var o=i[s];t.push({prefix:r.prefix.concat(o),node:r.node.edges[o]})}}return e},e.TokenSet.prototype.toString=function(){if(this._str)return this._str;for(var e=this.final?"1":"0",t=Object.keys(this.edges).sort(),r=t.length,i=0;i<r;i++){var n=t[i];e=e+n+this.edges[n].id}return e},e.TokenSet.prototype.intersect=function(t){for(var r=new e.TokenSet,i=void 0,n=[{qNode:t,output:r,node:this}];n.length;){i=n.pop();for(var s=Object.keys(i.qNode.edges),o=s.length,a=Object.keys(i.node.edges),u=a.length,l=0;l<o;l++)for(var d=s[l],h=0;h<u;h++){var c=a[h];if(c==d||"*"==d){var f=i.node.edges[c],p=i.qNode.edges[d],y=f.final&&p.final,m=void 0;c in i.output.edges?(m=i.output.edges[c]).final=m.final||y:((m=new e.TokenSet).final=y,i.output.edges[c]=m),n.push({qNode:p,output:m,node:f})}}}return r},e.TokenSet.Builder=function(){this.previousWord="",this.root=new e.TokenSet,this.uncheckedNodes=[],this.minimizedNodes={}},e.TokenSet.Builder.prototype.insert=function(t){var r,i=0;if(t<this.previousWord)throw new Error("Out of order word insertion");for(var n=0;n<t.length&&n<this.previousWord.length&&t[n]==this.previousWord[n];n++)i++;this.minimize(i),r=0==this.uncheckedNodes.length?this.root:this.uncheckedNodes[this.uncheckedNodes.length-1].child;for(n=i;n<t.length;n++){var s=new e.TokenSet,o=t[n];r.edges[o]=s,this.uncheckedNodes.push({parent:r,char:o,child:s}),r=s}r.final=!0,this.previousWord=t},e.TokenSet.Builder.prototype.finish=function(){this.minimize(0)},e.TokenSet.Builder.prototype.minimize=function(e){for(var t=this.uncheckedNodes.length-1;t>=e;t--){var r=this.uncheckedNodes[t],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}},e.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},e.Index.prototype.search=function(t){return this.query(function(r){new e.QueryParser(t,r).parse()})},e.Index.prototype.query=function(t){var r=new e.Query(this.fields),i=Object.create(null),n=Object.create(null),s=Object.create(null);t.call(r,r);for(var o=0;o<r.clauses.length;o++){var a=r.clauses[o],u=null;u=a.usePipeline?this.pipeline.runString(a.term):[a.term];for(var l=0;l<u.length;l++){var d=u[l];a.term=d;for(var h=e.TokenSet.fromClause(a),c=this.tokenSet.intersect(h).toArray(),f=0;f<c.length;f++)for(var p=c[f],y=this.invertedIndex[p],m=y._index,g=0;g<a.fields.length;g++){var v=a.fields[g],x=y[v],w=Object.keys(x),k=p+"/"+v;if(void 0===n[v]&&(n[v]=new e.Vector),n[v].upsert(m,1*a.boost,function(e,t){return e+t}),!s[k]){for(var Q=0;Q<w.length;Q++){var L,T=w[Q],S=new e.FieldRef(T,v),b=x[T];void 0===(L=i[S])?i[S]=new e.MatchData(p,v,b):L.add(p,v,b)}s[k]=!0}}}}var P=Object.keys(i),E=[],I=Object.create(null);for(o=0;o<P.length;o++){var O,F=e.FieldRef.fromString(P[o]),R=F.docRef,_=this.fieldVectors[F],N=n[F.fieldName].similarity(_);if(void 0!==(O=I[R]))O.score+=N,O.matchData.combine(i[F]);else{var C={ref:R,score:N,matchData:i[F]};I[R]=C,E.push(C)}}return E.sort(function(e,t){return t.score-e.score})},e.Index.prototype.toJSON=function(){var t=Object.keys(this.invertedIndex).sort().map(function(e){return[e,this.invertedIndex[e]]},this),r=Object.keys(this.fieldVectors).map(function(e){return[e,this.fieldVectors[e].toJSON()]},this);return{version:e.version,fields:this.fields,fieldVectors:r,invertedIndex:t,pipeline:this.pipeline.toJSON()}},e.Index.load=function(t){var r={},i={},n=t.fieldVectors,s={},o=t.invertedIndex,a=new e.TokenSet.Builder,u=e.Pipeline.load(t.pipeline);t.version!=e.version&&e.utils.warn("Version mismatch when loading serialised index. Current version of lunr '"+e.version+"' does not match serialized index '"+t.version+"'");for(var l=0;l<n.length;l++){var d=(c=n[l])[0],h=c[1];i[d]=new e.Vector(h)}for(l=0;l<o.length;l++){var c,f=(c=o[l])[0],p=c[1];a.insert(f),s[f]=p}return a.finish(),r.fields=t.fields,r.fieldVectors=i,r.invertedIndex=s,r.tokenSet=a.root,r.pipeline=u,new e.Index(r)},e.Builder=function(){this._ref="id",this._fields=[],this.invertedIndex=Object.create(null),this.fieldTermFrequencies={},this.fieldLengths={},this.tokenizer=e.tokenizer,this.pipeline=new e.Pipeline,this.searchPipeline=new e.Pipeline,this.documentCount=0,this._b=.75,this._k1=1.2,this.termIndex=0,this.metadataWhitelist=[]},e.Builder.prototype.ref=function(e){this._ref=e},e.Builder.prototype.field=function(e){this._fields.push(e)},e.Builder.prototype.b=function(e){this._b=e<0?0:e>1?1:e},e.Builder.prototype.k1=function(e){this._k1=e},e.Builder.prototype.add=function(t){var r=t[this._ref];this.documentCount+=1;for(var i=0;i<this._fields.length;i++){var n=this._fields[i],s=t[n],o=this.tokenizer(s),a=this.pipeline.run(o),u=new e.FieldRef(r,n),l=Object.create(null);this.fieldTermFrequencies[u]=l,this.fieldLengths[u]=0,this.fieldLengths[u]+=a.length;for(var d=0;d<a.length;d++){var h=a[d];if(void 0==l[h]&&(l[h]=0),l[h]+=1,void 0==this.invertedIndex[h]){var c=Object.create(null);c._index=this.termIndex,this.termIndex+=1;for(var f=0;f<this._fields.length;f++)c[this._fields[f]]=Object.create(null);this.invertedIndex[h]=c}void 0==this.invertedIndex[h][n][r]&&(this.invertedIndex[h][n][r]=Object.create(null));for(var p=0;p<this.metadataWhitelist.length;p++){var y=this.metadataWhitelist[p],m=h.metadata[y];void 0==this.invertedIndex[h][n][r][y]&&(this.invertedIndex[h][n][r][y]=[]),this.invertedIndex[h][n][r][y].push(m)}}}},e.Builder.prototype.calculateAverageFieldLengths=function(){for(var t=Object.keys(this.fieldLengths),r=t.length,i={},n={},s=0;s<r;s++){var o=e.FieldRef.fromString(t[s]);n[a=o.fieldName]||(n[a]=0),n[a]+=1,i[a]||(i[a]=0),i[a]+=this.fieldLengths[o]}for(s=0;s<this._fields.length;s++){var a;i[a=this._fields[s]]=i[a]/n[a]}this.averageFieldLength=i},e.Builder.prototype.createFieldVectors=function(){for(var t={},r=Object.keys(this.fieldTermFrequencies),i=r.length,n=Object.create(null),s=0;s<i;s++){for(var o=e.FieldRef.fromString(r[s]),a=o.fieldName,u=this.fieldLengths[o],l=new e.Vector,d=this.fieldTermFrequencies[o],h=Object.keys(d),c=h.length,f=0;f<c;f++){var p,y,m,g=h[f],v=d[g],x=this.invertedIndex[g]._index;void 0===n[g]?(p=e.idf(this.invertedIndex[g],this.documentCount),n[g]=p):p=n[g],y=p*((this._k1+1)*v)/(this._k1*(1-this._b+this._b*(u/this.averageFieldLength[a]))+v),m=Math.round(1e3*y)/1e3,l.insert(x,m)}t[o]=l}this.fieldVectors=t},e.Builder.prototype.createTokenSet=function(){this.tokenSet=e.TokenSet.fromArray(Object.keys(this.invertedIndex).sort())},e.Builder.prototype.build=function(){return this.calculateAverageFieldLengths(),this.createFieldVectors(),this.createTokenSet(),new e.Index({invertedIndex:this.invertedIndex,fieldVectors:this.fieldVectors,tokenSet:this.tokenSet,fields:this._fields,pipeline:this.searchPipeline})},e.Builder.prototype.use=function(e){var t=Array.prototype.slice.call(arguments,1);t.unshift(this),e.apply(this,t)},e.MatchData=function(e,t,r){for(var i=Object.create(null),n=Object.keys(r),s=0;s<n.length;s++){var o=n[s];i[o]=r[o].slice()}this.metadata=Object.create(null),this.metadata[e]=Object.create(null),this.metadata[e][t]=i},e.MatchData.prototype.combine=function(e){for(var t=Object.keys(e.metadata),r=0;r<t.length;r++){var i=t[r],n=Object.keys(e.metadata[i]);void 0==this.metadata[i]&&(this.metadata[i]=Object.create(null));for(var s=0;s<n.length;s++){var o=n[s],a=Object.keys(e.metadata[i][o]);void 0==this.metadata[i][o]&&(this.metadata[i][o]=Object.create(null));for(var u=0;u<a.length;u++){var l=a[u];void 0==this.metadata[i][o][l]?this.metadata[i][o][l]=e.metadata[i][o][l]:this.metadata[i][o][l]=this.metadata[i][o][l].concat(e.metadata[i][o][l])}}}},e.MatchData.prototype.add=function(e,t,r){if(!(e in this.metadata))return this.metadata[e]=Object.create(null),void(this.metadata[e][t]=r);if(t in this.metadata[e])for(var i=Object.keys(r),n=0;n<i.length;n++){var s=i[n];s in this.metadata[e][t]?this.metadata[e][t][s]=this.metadata[e][t][s].concat(r[s]):this.metadata[e][t][s]=r[s]}else this.metadata[e][t]=r},e.Query=function(e){this.clauses=[],this.allFields=e},e.Query.wildcard=new String("*"),e.Query.wildcard.NONE=0,e.Query.wildcard.LEADING=1,e.Query.wildcard.TRAILING=2,e.Query.prototype.clause=function(t){return"fields"in t||(t.fields=this.allFields),"boost"in t||(t.boost=1),"usePipeline"in t||(t.usePipeline=!0),"wildcard"in t||(t.wildcard=e.Query.wildcard.NONE),t.wildcard&e.Query.wildcard.LEADING&&t.term.charAt(0)!=e.Query.wildcard&&(t.term="*"+t.term),t.wildcard&e.Query.wildcard.TRAILING&&t.term.slice(-1)!=e.Query.wildcard&&(t.term=t.term+"*"),this.clauses.push(t),this},e.Query.prototype.term=function(e,t){var r=t||{};return r.term=e,this.clause(r),this},e.QueryParseError=function(e,t,r){this.name="QueryParseError",this.message=e,this.start=t,this.end=r},e.QueryParseError.prototype=new Error,e.QueryLexer=function(e){this.lexemes=[],this.str=e,this.length=e.length,this.pos=0,this.start=0,this.escapeCharPositions=[]},e.QueryLexer.prototype.run=function(){for(var t=e.QueryLexer.lexText;t;)t=t(this)},e.QueryLexer.prototype.sliceString=function(){for(var e=[],t=this.start,r=this.pos,i=0;i<this.escapeCharPositions.length;i++)r=this.escapeCharPositions[i],e.push(this.str.slice(t,r)),t=r+1;return e.push(this.str.slice(t,this.pos)),this.escapeCharPositions.length=0,e.join("")},e.QueryLexer.prototype.emit=function(e){this.lexemes.push({type:e,str:this.sliceString(),start:this.start,end:this.pos}),this.start=this.pos},e.QueryLexer.prototype.escapeCharacter=function(){this.escapeCharPositions.push(this.pos-1),this.pos+=1},e.QueryLexer.prototype.next=function(){if(this.pos>=this.length)return e.QueryLexer.EOS;var t=this.str.charAt(this.pos);return this.pos+=1,t},e.QueryLexer.prototype.width=function(){return this.pos-this.start},e.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},e.QueryLexer.prototype.backup=function(){this.pos-=1},e.QueryLexer.prototype.acceptDigitRun=function(){var t,r;do{r=(t=this.next()).charCodeAt(0)}while(r>47&&r<58);t!=e.QueryLexer.EOS&&this.backup()},e.QueryLexer.prototype.more=function(){return this.pos<this.length},e.QueryLexer.EOS="EOS",e.QueryLexer.FIELD="FIELD",e.QueryLexer.TERM="TERM",e.QueryLexer.EDIT_DISTANCE="EDIT_DISTANCE",e.QueryLexer.BOOST="BOOST",e.QueryLexer.lexField=function(t){return t.backup(),t.emit(e.QueryLexer.FIELD),t.ignore(),e.QueryLexer.lexText},e.QueryLexer.lexTerm=function(t){if(t.width()>1&&(t.backup(),t.emit(e.QueryLexer.TERM)),t.ignore(),t.more())return e.QueryLexer.lexText},e.QueryLexer.lexEditDistance=function(t){return t.ignore(),t.acceptDigitRun(),t.emit(e.QueryLexer.EDIT_DISTANCE),e.QueryLexer.lexText},e.QueryLexer.lexBoost=function(t){return t.ignore(),t.acceptDigitRun(),t.emit(e.QueryLexer.BOOST),e.QueryLexer.lexText},e.QueryLexer.lexEOS=function(t){t.width()>0&&t.emit(e.QueryLexer.TERM)},e.QueryLexer.termSeparator=e.tokenizer.separator,e.QueryLexer.lexText=function(t){for(;;){var r=t.next();if(r==e.QueryLexer.EOS)return e.QueryLexer.lexEOS;if(92!=r.charCodeAt(0)){if(":"==r)return e.QueryLexer.lexField;if("~"==r)return t.backup(),t.width()>0&&t.emit(e.QueryLexer.TERM),e.QueryLexer.lexEditDistance;if("^"==r)return t.backup(),t.width()>0&&t.emit(e.QueryLexer.TERM),e.QueryLexer.lexBoost;if(r.match(e.QueryLexer.termSeparator))return e.QueryLexer.lexTerm}else t.escapeCharacter()}},e.QueryParser=function(t,r){this.lexer=new e.QueryLexer(t),this.query=r,this.currentClause={},this.lexemeIdx=0},e.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var t=e.QueryParser.parseFieldOrTerm;t;)t=t(this);return this.query},e.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},e.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},e.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},e.QueryParser.parseFieldOrTerm=function(t){var r=t.peekLexeme();if(void 0!=r)switch(r.type){case e.QueryLexer.FIELD:return e.QueryParser.parseField;case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var i="expected either a field or a term, found "+r.type;throw r.str.length>=1&&(i+=" with value '"+r.str+"'"),new e.QueryParseError(i,r.start,r.end)}},e.QueryParser.parseField=function(t){var r=t.consumeLexeme();if(void 0!=r){if(-1==t.query.allFields.indexOf(r.str)){var i=t.query.allFields.map(function(e){return"'"+e+"'"}).join(", "),n="unrecognised field '"+r.str+"', possible fields: "+i;throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.fields=[r.str];var s=t.peekLexeme();if(void 0==s){n="expecting term, found nothing";throw new e.QueryParseError(n,r.start,r.end)}switch(s.type){case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:n="expecting term, found '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}}},e.QueryParser.parseTerm=function(t){var r=t.consumeLexeme();if(void 0!=r){t.currentClause.term=r.str.toLowerCase(),-1!=r.str.indexOf("*")&&(t.currentClause.usePipeline=!1);var i=t.peekLexeme();if(void 0!=i)switch(i.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;default:var n="Unexpected lexeme type '"+i.type+"'";throw new e.QueryParseError(n,i.start,i.end)}else t.nextClause()}},e.QueryParser.parseEditDistance=function(t){var r=t.consumeLexeme();if(void 0!=r){var i=parseInt(r.str,10);if(isNaN(i)){var n="edit distance must be numeric";throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.editDistance=i;var s=t.peekLexeme();if(void 0!=s)switch(s.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;default:n="Unexpected lexeme type '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}else t.nextClause()}},e.QueryParser.parseBoost=function(t){var r=t.consumeLexeme();if(void 0!=r){var i=parseInt(r.str,10);if(isNaN(i)){var n="boost must be numeric";throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.boost=i;var s=t.peekLexeme();if(void 0!=s)switch(s.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;default:n="Unexpected lexeme type '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}else t.nextClause()}},r=this,i=function(){return e},"function"==typeof define&&define.amd?define(i):"object"==typeof exports?module.exports=i():r.lunr=i();var r,i}();
|
@@ -14,13 +14,12 @@ function buildIndex(corpus, indexFields) {
|
|
14
14
|
boost = indexFields[fieldName];
|
15
15
|
this.field(fieldName, boost);
|
16
16
|
}
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
}
|
17
|
+
corpus.entries.forEach(function(page) {
|
18
|
+
if (page.skip_index !== true) {
|
19
|
+
this.add(page);
|
20
|
+
urlToDoc[page.url] = {url: page.url, title: page.title};
|
21
|
+
}
|
22
|
+
}, this);
|
24
23
|
});
|
25
24
|
|
26
25
|
return JSON.stringify({
|
@@ -1,7 +1,7 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require_relative './bundler'
|
3
2
|
require_relative './compressor'
|
4
3
|
require_relative './config'
|
4
|
+
require_relative './search_hook'
|
5
5
|
require_relative './search_page'
|
6
6
|
require_relative './search_page_layouts'
|
7
7
|
|
@@ -34,11 +34,13 @@ module Jekyll
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def pages_api_search_after_write
|
37
|
-
index = pages.find
|
37
|
+
index = pages.find do |p|
|
38
|
+
p.name == JekyllPagesApiSearch::SearchIndexBuilder::INDEX_FILE
|
39
|
+
end
|
38
40
|
raise 'Search index not found' if index.nil?
|
39
41
|
JekyllPagesApiSearch::Compressor.gzip_in_memory_content(
|
40
42
|
"#{index.destination self.dest}" => index.output)
|
41
|
-
JekyllPagesApiSearch::
|
43
|
+
JekyllPagesApiSearch::Bundler.create_search_bundles(self)
|
42
44
|
end
|
43
45
|
end
|
44
46
|
end
|
@@ -1,21 +1,34 @@
|
|
1
|
-
# @author Mike Bland (michael.bland@gsa.gov)
|
2
|
-
|
3
1
|
require 'jekyll_pages_api'
|
4
2
|
require 'safe_yaml'
|
5
3
|
|
6
4
|
module JekyllPagesApiSearch
|
5
|
+
# This is a stand-in for a normal Jekyll::Site used only by the
|
6
|
+
# standalone.rb module in this directory, since the full Jekyll::Site would be
|
7
|
+
# too complex for this purpose.
|
7
8
|
class Site
|
8
|
-
attr_reader :source, :config
|
9
|
+
attr_reader :source, :dest, :config, :baseurl
|
9
10
|
attr_accessor :pages
|
10
11
|
|
11
12
|
def initialize(basedir, config)
|
12
13
|
@source = basedir
|
14
|
+
@dest = basedir
|
13
15
|
@config = SafeYAML.load_file(config, :safe => true)
|
16
|
+
@baseurl = @config['baseurl'] || '/'
|
14
17
|
@pages = []
|
15
18
|
end
|
16
19
|
|
17
|
-
#
|
18
|
-
|
20
|
+
# Needed by Jekyll::Page.initialize().
|
21
|
+
def in_source_dir(*paths)
|
22
|
+
paths
|
23
|
+
end
|
24
|
+
|
25
|
+
# Needed by Jekyll::Page.initialize().
|
26
|
+
def in_theme_dir(*paths)
|
27
|
+
nil
|
28
|
+
end
|
29
|
+
|
30
|
+
# Adds an existing pages.json file (generated by jekyll_pages_api) to
|
31
|
+
# this site's `pages` collection.
|
19
32
|
def load_pages_json(pages_json_path)
|
20
33
|
basename = File.basename pages_json_path
|
21
34
|
rel_dir = File.dirname pages_json_path
|
@@ -1,10 +1,26 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require_relative './bundler'
|
3
2
|
require_relative './compressor'
|
4
3
|
require_relative './site'
|
5
4
|
require 'fileutils'
|
6
5
|
require 'jekyll_pages_api'
|
7
6
|
|
7
|
+
module JekyllPagesApi
|
8
|
+
# Reopens the existing JekyllPagesApi::GeneratedSite to add methods needed by
|
9
|
+
# Jekyll::Page.initialize().
|
10
|
+
#
|
11
|
+
# These are invoked via Standalone.generate_index() when using
|
12
|
+
# JekyllPagesApi::Generator to create a new `pages.json` file.
|
13
|
+
class GeneratedSite
|
14
|
+
def in_source_dir(*paths)
|
15
|
+
paths
|
16
|
+
end
|
17
|
+
|
18
|
+
def in_theme_dir(*paths)
|
19
|
+
nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
8
24
|
module JekyllPagesApiSearch
|
9
25
|
class Standalone
|
10
26
|
def self.generate_index(basedir, config, pages_json, baseURL,
|
@@ -30,6 +46,7 @@ module JekyllPagesApiSearch
|
|
30
46
|
File.open(outfile, 'w') {|f| f << content}
|
31
47
|
end
|
32
48
|
Compressor::gzip_in_memory_content output
|
49
|
+
Bundler::create_search_bundles(site)
|
33
50
|
Assets::copy_to_basedir site.source
|
34
51
|
end
|
35
52
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
# @author Mike Bland (michael.bland@gsa.gov)
|
2
|
-
|
3
1
|
require_relative './config'
|
4
2
|
require 'liquid'
|
5
3
|
|
@@ -34,8 +32,8 @@ module JekyllPagesApiSearch
|
|
34
32
|
end
|
35
33
|
|
36
34
|
def self.generate_script(baseurl, site: nil)
|
37
|
-
"<script>JEKYLL_PAGES_API_SEARCH_BASEURL = '#{baseurl}';</script>\n" +
|
38
35
|
site_bundle_load_tag(site, baseurl) +
|
36
|
+
"<script src=\"#{baseurl}/assets/js/search-constants.js\"></script>\n" +
|
39
37
|
"<script async src=\"#{baseurl}/assets/js/search-bundle.js\">" +
|
40
38
|
"</script>"
|
41
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_pages_api_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Bland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll_pages_api
|
@@ -139,15 +139,15 @@ dependencies:
|
|
139
139
|
description: Contains a Jekyll plugin and associated files that facilitate adding
|
140
140
|
client-side search features to a site using the jekyll_pages_api gem.
|
141
141
|
email:
|
142
|
-
-
|
142
|
+
- mbland@acm.org
|
143
143
|
executables:
|
144
144
|
- jekyll_pages_api_search
|
145
145
|
extensions: []
|
146
146
|
extra_rdoc_files: []
|
147
147
|
files:
|
148
|
-
- CONTRIBUTING.md
|
149
148
|
- LICENSE.md
|
150
149
|
- README.md
|
150
|
+
- assets/js/merge-options.js
|
151
151
|
- assets/js/search-bundle.js
|
152
152
|
- assets/js/search-bundle.js.gz
|
153
153
|
- assets/js/search-engine.js
|
@@ -159,7 +159,7 @@ files:
|
|
159
159
|
- lib/jekyll_pages_api_search.rb
|
160
160
|
- lib/jekyll_pages_api_search/assets.rb
|
161
161
|
- lib/jekyll_pages_api_search/browserify.js
|
162
|
-
- lib/jekyll_pages_api_search/
|
162
|
+
- lib/jekyll_pages_api_search/bundler.rb
|
163
163
|
- lib/jekyll_pages_api_search/compressor.rb
|
164
164
|
- lib/jekyll_pages_api_search/config.rb
|
165
165
|
- lib/jekyll_pages_api_search/generator.rb
|
@@ -177,9 +177,9 @@ files:
|
|
177
177
|
- lib/jekyll_pages_api_search/standalone.rb
|
178
178
|
- lib/jekyll_pages_api_search/tags.rb
|
179
179
|
- lib/jekyll_pages_api_search/version.rb
|
180
|
-
homepage: https://github.com/
|
180
|
+
homepage: https://github.com/mbland/jekyll_pages_api_search
|
181
181
|
licenses:
|
182
|
-
-
|
182
|
+
- ISC
|
183
183
|
metadata: {}
|
184
184
|
post_install_message:
|
185
185
|
rdoc_options: []
|
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
197
|
version: '0'
|
198
198
|
requirements: []
|
199
199
|
rubyforge_project:
|
200
|
-
rubygems_version: 2.
|
200
|
+
rubygems_version: 2.6.13
|
201
201
|
signing_key:
|
202
202
|
specification_version: 4
|
203
203
|
summary: Adds lunr.js search based on the jekyll_pages_api gem
|
data/CONTRIBUTING.md
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
## Welcome!
|
2
|
-
|
3
|
-
We're so glad you're thinking about contributing to an 18F open source project!
|
4
|
-
If you're unsure or afraid of anything, just ask or submit the issue or pull
|
5
|
-
request anyways. The worst that can happen is that you'll be politely asked to
|
6
|
-
change something. We appreciate any sort of contribution, and don't want a wall
|
7
|
-
of rules to get in the way of that.
|
8
|
-
|
9
|
-
Before contributing, we encourage you to read our CONTRIBUTING policy (you are
|
10
|
-
here), our LICENSE, and our README, all of which should be in this repository.
|
11
|
-
If you have any questions, or want to read more about our underlying policies,
|
12
|
-
you can consult the 18F Open Source Policy GitHub repository at
|
13
|
-
https://github.com/18f/open-source-policy, or just shoot us an email/official
|
14
|
-
government letterhead note to [18f@gsa.gov](mailto:18f@gsa.gov).
|
15
|
-
|
16
|
-
## Public domain
|
17
|
-
|
18
|
-
This project is in the public domain within the United States, and
|
19
|
-
copyright and related rights in the work worldwide are waived through
|
20
|
-
the [CC0 1.0 Universal public domain dedication](https://creativecommons.org/publicdomain/zero/1.0/).
|
21
|
-
|
22
|
-
All contributions to this project will be released under the CC0
|
23
|
-
dedication. By submitting a pull request, you are agreeing to comply
|
24
|
-
with this waiver of copyright interest.
|
25
|
-
|
26
|
-
## Starting work on an issue
|
27
|
-
|
28
|
-
Issues that are marked with the `ready` label are ripe for the picking! Simply
|
29
|
-
assign yourself to the issue to and change its label to `in progress` to
|
30
|
-
indicate that you are working on it.
|
31
|
-
|
32
|
-
If the issue involves writing code or producing some other change that will
|
33
|
-
result in a pull request, begin by creating yourself a branch with a short
|
34
|
-
descriptive name of the work that includes the issue number at the end, e.g.,
|
35
|
-
`document-pr-process-#36`.
|
36
|
-
|
37
|
-
**Note:** If you are not a part of the 18F Team, please fork the repository
|
38
|
-
first and then create a branch for yourself with the same convention.
|
39
|
-
|
40
|
-
Once your local branch is created, simply push it remotely and this will
|
41
|
-
assign the issue to you and move it to be `in progress` automatically.
|
42
|
-
|
43
|
-
## Submitting a pull request and completing work
|
44
|
-
|
45
|
-
When you are satisfied with your work and ready to submit it to be completed,
|
46
|
-
please submit a pull request for review. If you haven't already, please
|
47
|
-
follow the instructions above and create a branch for yourself first. Prior
|
48
|
-
to submitting the pull request, please make note of the following:
|
49
|
-
|
50
|
-
1. Code changes should be accompanied by tests.
|
51
|
-
2. Please run the tests (`$ npm test`) and the linter
|
52
|
-
(`$ npm run-script lint`) to make sure there are no regressions.
|
53
|
-
|
54
|
-
Once everything is ready to go, [submit your pull request](https://help.github.com/articles/using-pull-requests/)!
|
55
|
-
When creating a pull request please be sure to reference the issue number it
|
56
|
-
is associated with, preferably in the title.
|
57
|
-
|
58
|
-
If you are working in a branch off of the `18F/jekyll_pages_api_search` repo
|
59
|
-
directly, you can reference the issue like this:
|
60
|
-
`Closes #45: Short sentence describing the pull request`
|
61
|
-
|
62
|
-
If you are working in a forked copy of the repo, please reference the issue
|
63
|
-
like this:
|
64
|
-
`Closes 18F/jekyll_pages_api_search#45: Short sentence describing the pull
|
65
|
-
request`
|
66
|
-
|
67
|
-
In both cases, please include a descriptive summary of the change in the body
|
68
|
-
of the pull request as that will help greatly in reviewing the change and
|
69
|
-
understanding what should be taking place inside of it.
|
70
|
-
|
71
|
-
By referencing the issue in the pull request as noted above, this will
|
72
|
-
automatically update the issue with a `needs review` label and notify the
|
73
|
-
collaborators on the project that something is ready for a review. One of us
|
74
|
-
will take a look as soon as we can and initiate the review process, provide
|
75
|
-
feedback as necessary, and ultimately merge the change.
|
76
|
-
|
77
|
-
Once the code is merged, the branch will be deleted and the `in review`
|
78
|
-
label will be removed. The issue will be automatically updated again to be
|
79
|
-
marked as Done and Closed.
|
80
|
-
|
81
|
-
## Performing a review of a pull request
|
82
|
-
|
83
|
-
If you are performing a review of a pull request please add the `in review`
|
84
|
-
label to the pull request and be sure keep the `needs review` label
|
85
|
-
associated with it. This will help keep our Waffle board up-to-date and
|
86
|
-
reflect that the pull request is being actively reviewed. Also, please
|
87
|
-
assign yourself so others know who the primary reviewer is.
|
88
|
-
|