diff options
Diffstat (limited to 'theme/mkdocs_windmill/js')
-rw-r--r-- | theme/mkdocs_windmill/js/elasticlunr.js | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/theme/mkdocs_windmill/js/elasticlunr.js b/theme/mkdocs_windmill/js/elasticlunr.js index 37d9986..46302e1 100644 --- a/theme/mkdocs_windmill/js/elasticlunr.js +++ b/theme/mkdocs_windmill/js/elasticlunr.js @@ -22,7 +22,7 @@ * * When using this convenience function a new index will be created with the * following functions already in the pipeline: - * + * * 1. elasticlunr.trimmer - trim non-word character * 2. elasticlunr.StopWordFilter - filters out any stop words before they enter the * index @@ -35,29 +35,29 @@ * this.addField('id'); * this.addField('title'); * this.addField('body'); - * + * * //this.setRef('id'); // default ref is 'id' * * this.pipeline.add(function () { * // some custom pipeline function * }); * }); - * + * * idx.addDoc({ - * id: 1, + * id: 1, * title: 'Oracle released database 12g', * body: 'Yestaday, Oracle has released their latest database, named 12g, more robust. this product will increase Oracle profit.' * }); - * + * * idx.addDoc({ - * id: 2, + * id: 2, * title: 'Oracle released annual profit report', * body: 'Yestaday, Oracle has released their annual profit report of 2015, total profit is 12.5 Billion.' * }); - * + * * # simple search * idx.search('oracle database'); - * + * * # search with query-time boosting * idx.search('oracle database', {fields: {title: {boost: 2}, body: {boost: 1}}}); * @@ -144,7 +144,7 @@ elasticlunr.utils.toString = function (obj) { * * Each event could has multiple corresponding functions, * these functions will be called as the sequence that they are added into the event. - * + * * @constructor */ elasticlunr.EventEmitter = function () { @@ -313,7 +313,7 @@ elasticlunr.tokenizer.getSeperator = function() { */ /** - * elasticlunr.Pipelines maintain an ordered list of functions to be applied to + * elasticlunr.Pipelines maintain an ordered list of functions to be applied to * both documents tokens and query tokens. * * An instance of elasticlunr.Index will contain a pipeline @@ -547,7 +547,7 @@ elasticlunr.Pipeline.prototype.reset = function () { /** * Returns a representation of the pipeline ready for serialisation. * Only serialize pipeline function's name. Not storing function, so when - * loading the archived JSON index file, corresponding pipeline function is + * loading the archived JSON index file, corresponding pipeline function is * added by registered function of elasticlunr.Pipeline.registeredFunctions * * Logs a warning if the function has not been registered. @@ -949,28 +949,28 @@ elasticlunr.Index.prototype.fieldSearch = function (queryTokens, fieldName, conf tokens = this.index[fieldName].expandToken(token); } // Consider every query token in turn. If expanded, each query token - // corresponds to a set of tokens, which is all tokens in the + // corresponds to a set of tokens, which is all tokens in the // index matching the pattern queryToken* . // For the set of tokens corresponding to a query token, find and score - // all matching documents. Store those scores in queryTokenScores, + // all matching documents. Store those scores in queryTokenScores, // keyed by docRef. // Then, depending on the value of booleanType, combine the scores // for this query token with previous scores. If booleanType is OR, // then merge the scores by summing into the accumulated total, adding - // new document scores are required (effectively a union operator). - // If booleanType is AND, accumulate scores only if the document + // new document scores are required (effectively a union operator). + // If booleanType is AND, accumulate scores only if the document // has previously been scored by another query token (an intersection - // operation0. - // Furthermore, since when booleanType is AND, additional + // operation0. + // Furthermore, since when booleanType is AND, additional // query tokens can't add new documents to the result set, use the - // current document set to limit the processing of each new query + // current document set to limit the processing of each new query // token for efficiency (i.e., incremental intersection). - + var queryTokenScores = {}; tokens.forEach(function (key) { var docs = this.index[fieldName].getDocs(key); var idf = this.idf(key, fieldName); - + if (scores && booleanType == 'AND') { // special case, we can rule out documents that have been // already been filtered out because they weren't scored @@ -1017,7 +1017,7 @@ elasticlunr.Index.prototype.fieldSearch = function (queryTokens, fieldName, conf } } }, this); - + scores = this.mergeScores(scores, queryTokenScores, booleanType); }, this); @@ -1039,7 +1039,7 @@ elasticlunr.Index.prototype.fieldSearch = function (queryTokens, fieldName, conf elasticlunr.Index.prototype.mergeScores = function (accumScores, scores, op) { if (!accumScores) { - return scores; + return scores; } if (op == 'AND') { var intersection = {}; @@ -1608,7 +1608,7 @@ elasticlunr.clearStopWords = function () { /** * Add customized stop words * user could use this function to add customized stop words - * + * * @params {Array} words customized stop words * @return {null} */ @@ -1827,7 +1827,7 @@ elasticlunr.InvertedIndex.load = function (serialisedData) { * By default this function starts at the root of the current inverted index, however * it can start at any node of the inverted index if required. * - * @param {String} token + * @param {String} token * @param {Object} tokenInfo format: { ref: 1, tf: 2} * @param {Object} root An optional node at which to start looking for the * correct place to enter the doc, by default the root of this elasticlunr.InvertedIndex @@ -1859,7 +1859,7 @@ elasticlunr.InvertedIndex.prototype.addToken = function (token, tokenInfo, root) /** * Checks whether a token is in this elasticlunr.InvertedIndex. - * + * * * @param {String} token The token to be checked * @return {Boolean} @@ -1881,7 +1881,7 @@ elasticlunr.InvertedIndex.prototype.hasToken = function (token) { /** * Retrieve a node from the inverted index for a given token. * If token not found in this InvertedIndex, return null. - * + * * * @param {String} token The token to get the node for. * @return {Object} @@ -2026,60 +2026,60 @@ elasticlunr.InvertedIndex.prototype.toJSON = function () { * elasticlunr.Configuration * Copyright (C) 2016 Wei Song */ - - /** + + /** * elasticlunr.Configuration is used to analyze the user search configuration. - * + * * By elasticlunr.Configuration user could set query-time boosting, boolean model in each field. - * + * * Currently configuration supports: * 1. query-time boosting, user could set how to boost each field. * 2. boolean model chosing, user could choose which boolean model to use for each field. * 3. token expandation, user could set token expand to True to improve Recall. Default is False. - * - * Query time boosting must be configured by field category, "boolean" model could be configured + * + * Query time boosting must be configured by field category, "boolean" model could be configured * by both field category or globally as the following example. Field configuration for "boolean" * will overwrite global configuration. * Token expand could be configured both by field category or golbally. Local field configuration will * overwrite global configuration. - * + * * configuration example: * { - * fields:{ + * fields:{ * title: {boost: 2}, * body: {boost: 1} * }, * bool: "OR" * } - * + * * "bool" field configuation overwrite global configuation example: * { - * fields:{ + * fields:{ * title: {boost: 2, bool: "AND"}, * body: {boost: 1} * }, * bool: "OR" * } - * + * * "expand" example: * { - * fields:{ + * fields:{ * title: {boost: 2, bool: "AND"}, * body: {boost: 1} * }, * bool: "OR", * expand: true * } - * + * * "expand" example for field category: * { - * fields:{ + * fields:{ * title: {boost: 2, bool: "AND", expand: true}, * body: {boost: 1} * }, * bool: "OR" * } - * + * * setting the boost to 0 ignores the field (this will only search the title): * { * fields:{ @@ -2090,10 +2090,10 @@ elasticlunr.InvertedIndex.prototype.toJSON = function () { * * then, user could search with configuration to do query-time boosting. * idx.search('oracle database', {fields: {title: {boost: 2}, body: {boost: 1}}}); - * - * + * + * * @constructor - * + * * @param {String} config user configuration * @param {Array} fields fields of index instance * @module @@ -2119,7 +2119,7 @@ elasticlunr.Configuration = function (config, fields) { /** * Build default search configuration. - * + * * @param {Array} fields fields of index instance */ elasticlunr.Configuration.prototype.buildDefaultConfig = function (fields) { @@ -2135,7 +2135,7 @@ elasticlunr.Configuration.prototype.buildDefaultConfig = function (fields) { /** * Build user configuration. - * + * * @param {JSON} config User JSON configuratoin * @param {Array} fields fields of index instance */ @@ -2177,7 +2177,7 @@ elasticlunr.Configuration.prototype.buildUserConfig = function (config, fields) /** * Add all fields to user search configuration. - * + * * @param {String} bool Boolean model * @param {String} expand Expand model * @param {Array} fields fields of index instance |