mirror of
https://github.com/tcsenpai/obsidiangarden_netlify.git
synced 2025-06-06 20:55:21 +00:00
fix: search by tags (#171)
This commit is contained in:
parent
bda59556a2
commit
7df3ef0d1e
@ -128,7 +128,7 @@
|
|||||||
})
|
})
|
||||||
posts.forEach((p, idx) => {
|
posts.forEach((p, idx) => {
|
||||||
contentIndex.add({
|
contentIndex.add({
|
||||||
id: idx, title: p.title, content: p.content, //Change to removeHTML
|
id: idx, title: p.title, content: p.content, tags: p.tags //Change to removeHTML
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
return contentIndex;
|
return contentIndex;
|
||||||
@ -333,7 +333,7 @@
|
|||||||
function offlineSearch(searchQuery) {
|
function offlineSearch(searchQuery) {
|
||||||
let data = window.docs;
|
let data = window.docs;
|
||||||
|
|
||||||
let isTagSearch = search[0] === "#" && search.length > 1;
|
let isTagSearch = searchQuery[0] === "#" && searchQuery.length > 1;
|
||||||
|
|
||||||
let searchResults = isTagSearch
|
let searchResults = isTagSearch
|
||||||
? index.search(searchQuery.substring(1), [
|
? index.search(searchQuery.substring(1), [
|
||||||
@ -361,7 +361,8 @@
|
|||||||
}
|
}
|
||||||
const allIds = new Set([
|
const allIds = new Set([
|
||||||
...getByField("title"),
|
...getByField("title"),
|
||||||
...getByField("content")
|
...getByField("content"),
|
||||||
|
...getByField("tags")
|
||||||
])
|
])
|
||||||
const dataIds = [...allIds];
|
const dataIds = [...allIds];
|
||||||
const finalResults = dataIds.map((id) => {
|
const finalResults = dataIds.map((id) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user