Updated docfx. Generated fresh docs. Added an icon.

This commit is contained in:
Charlie Kindel
2020-05-23 02:30:00 -06:00
parent 585f249b1c
commit 14f08a8d63
229 changed files with 134298 additions and 68079 deletions

View File

@@ -1,13 +1,12 @@
(function () {
importScripts('lunr.min.js');
var lunrIndex = lunr(function () {
this.pipeline.remove(lunr.stopWordFilter);
this.ref('href');
this.field('title', { boost: 50 });
this.field('keywords', { boost: 20 });
});
lunr.tokenizer.seperator = /[\s\-\.]+/;
var lunrIndex;
var stopWords = null;
var searchData = {};
lunr.tokenizer.separator = /[\s\-\.]+/;
var stopWordsRequest = new XMLHttpRequest();
stopWordsRequest.open('GET', '../search-stopwords.json');
@@ -15,14 +14,11 @@
if (this.status != 200) {
return;
}
var stopWords = JSON.parse(this.responseText);
var docfxStopWordFilter = lunr.generateStopWordFilter(stopWords);
lunr.Pipeline.registerFunction(docfxStopWordFilter, 'docfxStopWordFilter');
lunrIndex.pipeline.add(docfxStopWordFilter);
stopWords = JSON.parse(this.responseText);
buildIndex();
}
stopWordsRequest.send();
var searchData = {};
var searchDataRequest = new XMLHttpRequest();
searchDataRequest.open('GET', '../index.json');
@@ -31,11 +27,9 @@
return;
}
searchData = JSON.parse(this.responseText);
for (var prop in searchData) {
if (searchData.hasOwnProperty(prop)) {
lunrIndex.add(searchData[prop]);
}
}
buildIndex();
postMessage({ e: 'index-ready' });
}
searchDataRequest.send();
@@ -50,4 +44,37 @@
});
postMessage({ e: 'query-ready', q: q, d: results });
}
function buildIndex() {
if (stopWords !== null && !isEmpty(searchData)) {
lunrIndex = lunr(function () {
this.pipeline.remove(lunr.stopWordFilter);
this.ref('href');
this.field('title', { boost: 50 });
this.field('keywords', { boost: 20 });
for (var prop in searchData) {
if (searchData.hasOwnProperty(prop)) {
this.add(searchData[prop]);
}
}
var docfxStopWordFilter = lunr.generateStopWordFilter(stopWords);
lunr.Pipeline.registerFunction(docfxStopWordFilter, 'docfxStopWordFilter');
this.pipeline.add(docfxStopWordFilter);
this.searchPipeline.add(docfxStopWordFilter);
});
}
}
function isEmpty(obj) {
if(!obj) return true;
for (var prop in obj) {
if (obj.hasOwnProperty(prop))
return false;
}
return true;
}
})();