diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..b15c6e6
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,12 @@
+# These are supported funding model platforms
+
+github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
+patreon: # Replace with a single Patreon username
+open_collective: doks # Replace with a single Open Collective username
+ko_fi: # Replace with a single Ko-fi username
+tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
+community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
+liberapay: # Replace with a single Liberapay username
+issuehunt: # Replace with a single IssueHunt username
+otechie: # Replace with a single Otechie username
+custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
diff --git a/assets/js/index.js b/assets/js/index.js
index 0df2fd2..248b22b 100644
--- a/assets/js/index.js
+++ b/assets/js/index.js
@@ -117,39 +117,36 @@ Source:
suggestions.addEventListener('click', accept_suggestion, true);
function show_results(){
+ const maxResult = 5;
var value = this.value;
- var results = index.search(value, { limit: 5, index: ["content"], enrich: true });
- var entry, childs = suggestions.childNodes;
- var i = 0, len = results.length;
+ var results = index.search(value, {limit: maxResult, enrich: true});
suggestions.classList.remove('d-none');
+ suggestions.innerHTML = "";
- results.forEach(function(results) {
-
- entry = document.createElement('div');
-
- entry.innerHTML = '';
-
- a = entry.querySelector('a'),
- t = entry.querySelector('span:first-child'),
- d = entry.querySelector('span:nth-child(2)');
-
- // console.log(results);
-
- a.href = results.result[i].doc.href;
- t.textContent = results.result[i].doc.title;
- d.textContent = results.result[i].doc.description;
-
- suggestions.appendChild(entry);
-
+ //flatSearch now returns results for each index field. create a single list
+ const flatResults = {}; //keyed by href to dedupe results
+ results.forEach(result=>{
+ result.result.forEach(r=>{
+ flatResults[r.doc.href] = r.doc;
+ });
});
- while(childs.length > len){
+ //construct a list of suggestions list
+ for(const href in flatResults) {
+ const doc = flatResults[href];
- suggestions.removeChild(childs[i])
+ const entry = document.createElement('div');
+ entry.innerHTML = '';
+
+ entry.querySelector('a').href = href;
+ entry.querySelector('span:first-child').textContent = doc.title;
+ entry.querySelector('span:nth-child(2)').textContent = doc.description;
+
+ suggestions.appendChild(entry);
+ if(suggestions.childElementCount == maxResult) break;
}
-
}
function accept_suggestion(){