Jacky Zhao
2022-08-01 8fc6b8e28ebd08eb05aea80e602b9f279f660b5b
docs: update, re-added debounce
2 files modified
14 ■■■■ changed files
assets/js/semantic-search.js 12 ●●●● patch | view | raw | blame | history
content/notes/search.md 2 ●●● patch | view | raw | blame | history
assets/js/semantic-search.js
@@ -15,7 +15,15 @@
  return (await response.json());
}
registerHandlers((e) => {
function debounce(func, timeout = 200) {
  let timer;
  return (...args) => {
    clearTimeout(timer)
    timer = setTimeout(() => { func.apply(this, args); }, timeout)
  };
}
registerHandlers(debounce((e) => {
  term = e.target.value
  if (term !== "") {
    searchContents(term)
@@ -27,4 +35,4 @@
      ))
      .then(results => displayResults(results))
  }
})
}))
content/notes/search.md
@@ -47,4 +47,4 @@
    3. Set the 'Repository Ref' to `master`
    4. Set the 'Repository Name' to the name of your repository (usually just `quartz` if you forked the repository without changing the name)
    5. Leave 'Root Path' and 'Root URL' empty
9. Wait for your repository to index and enjoy natural language search in Quartz!
9. Wait for your repository to index and enjoy natural language search in Quartz! Operand refreshes the index every 2h so all you need to do is just push to GitHub to update the contents in the search.