This commit is contained in:
felixfontein 2025-02-18 20:26:44 +00:00
parent 9fe6e24fdc
commit f398ce47f8
4 changed files with 11 additions and 6 deletions

View file

@ -513,9 +513,11 @@ const Search = {
// perform the search on the required terms // perform the search on the required terms
searchTerms.forEach((word) => { searchTerms.forEach((word) => {
const files = []; const files = [];
// find documents, if any, containing the query word in their text/title term indices
// use Object.hasOwnProperty to avoid mismatching against prototype properties
const arr = [ const arr = [
{ files: terms[word], score: Scorer.term }, { files: terms.hasOwnProperty(word) ? terms[word] : undefined, score: Scorer.term },
{ files: titleTerms[word], score: Scorer.title }, { files: titleTerms.hasOwnProperty(word) ? titleTerms[word] : undefined, score: Scorer.title },
]; ];
// add support for partial matches // add support for partial matches
if (word.length > 2) { if (word.length > 2) {
@ -547,8 +549,9 @@ const Search = {
// set score for the word in each file // set score for the word in each file
recordFiles.forEach((file) => { recordFiles.forEach((file) => {
if (!scoreMap.has(file)) scoreMap.set(file, {}); if (!scoreMap.has(file)) scoreMap.set(file, new Map());
scoreMap.get(file)[word] = record.score; const fileScores = scoreMap.get(file);
fileScores.set(word, record.score);
}); });
}); });
@ -587,7 +590,7 @@ const Search = {
break; break;
// select one (max) score for the file. // select one (max) score for the file.
const score = Math.max(...wordList.map((w) => scoreMap.get(file)[w])); const score = Math.max(...wordList.map((w) => scoreMap.get(file).get(w)));
// add result to the result list // add result to the result list
results.push([ results.push([
docNames[file], docNames[file],

View file

@ -412,6 +412,7 @@ see <a class="reference internal" href="#ansible-collections-community-routeros-
<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">dhcp-server</span> <span class="pre">option</span> <span class="pre">sets&quot;</span></code></p></li> <li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">dhcp-server</span> <span class="pre">option</span> <span class="pre">sets&quot;</span></code></p></li>
<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">dns&quot;</span></code></p></li> <li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">dns&quot;</span></code></p></li>
<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">dns</span> <span class="pre">adlist&quot;</span></code></p></li> <li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">dns</span> <span class="pre">adlist&quot;</span></code></p></li>
<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">dns</span> <span class="pre">forwarders&quot;</span></code></p></li>
<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">dns</span> <span class="pre">static&quot;</span></code></p></li> <li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">dns</span> <span class="pre">static&quot;</span></code></p></li>
<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">firewall</span> <span class="pre">address-list&quot;</span></code></p></li> <li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">firewall</span> <span class="pre">address-list&quot;</span></code></p></li>
<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">firewall</span> <span class="pre">connection</span> <span class="pre">tracking&quot;</span></code></p></li> <li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">firewall</span> <span class="pre">connection</span> <span class="pre">tracking&quot;</span></code></p></li>

View file

@ -432,6 +432,7 @@ see <a class="reference internal" href="#ansible-collections-community-routeros-
<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">dhcp-server</span> <span class="pre">option</span> <span class="pre">sets&quot;</span></code></p></li> <li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">dhcp-server</span> <span class="pre">option</span> <span class="pre">sets&quot;</span></code></p></li>
<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">dns&quot;</span></code></p></li> <li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">dns&quot;</span></code></p></li>
<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">dns</span> <span class="pre">adlist&quot;</span></code></p></li> <li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">dns</span> <span class="pre">adlist&quot;</span></code></p></li>
<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">dns</span> <span class="pre">forwarders&quot;</span></code></p></li>
<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">dns</span> <span class="pre">static&quot;</span></code></p></li> <li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">dns</span> <span class="pre">static&quot;</span></code></p></li>
<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">firewall</span> <span class="pre">address-list&quot;</span></code></p></li> <li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">firewall</span> <span class="pre">address-list&quot;</span></code></p></li>
<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">firewall</span> <span class="pre">connection</span> <span class="pre">tracking&quot;</span></code></p></li> <li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">&quot;ip</span> <span class="pre">firewall</span> <span class="pre">connection</span> <span class="pre">tracking&quot;</span></code></p></li>

File diff suppressed because one or more lines are too long