From 23380d0519365d09cb629a66fe2ccba1c56e91f2 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sun, 31 Jul 2022 16:55:25 -0700 Subject: [PATCH] fix: title not being selected properly, bump hugo-obsidian for uri fix --- .github/workflows/deploy.yaml | 2 +- assets/js/semantic-search.js | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 8b8c5ae..a6a6b53 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -14,7 +14,7 @@ jobs: fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod - name: Build Link Index - uses: jackyzha0/hugo-obsidian@v2.16 + uses: jackyzha0/hugo-obsidian@v2.17 with: index: true input: content diff --git a/assets/js/semantic-search.js b/assets/js/semantic-search.js index a62d3d5..45c51e0 100644 --- a/assets/js/semantic-search.js +++ b/assets/js/semantic-search.js @@ -25,11 +25,14 @@ function debounce(func, timeout = 300) { registerHandlers(debounce((e) => { term = e.target.value - searchContents(term) - .then((res) => res.results.map(entry => ({ - url: entry.object.metadata.url, - content: entry.snippet, - title: entry.object.title - }))) - .then(results => displayResults(results)) + if (term !== "") { + searchContents(term) + .then((res) => res.results.map(entry => ({ + url: entry.object.properties.url, + content: entry.snippet, + title: entry.object.metadata.title + }) + )) + .then(results => displayResults(results)) + } }))