minor search optimization
This commit is contained in:
parent
f7cc498722
commit
0336b322ef
@ -1386,7 +1386,7 @@
|
|||||||
})
|
})
|
||||||
getRef('explore_heading').textContent = 'Explore all'
|
getRef('explore_heading').textContent = 'Explore all'
|
||||||
} else {
|
} else {
|
||||||
const options = (type === 'category') ? { keys: ['categories'], threshold: 0 } : { keys: ['title', 'categories', 'tags'], threshold: 0.3 }
|
const options = (type === 'category') ? { keys: ['categories'], threshold: 0 } : { keys: ['title', 'tags'], threshold: 0.3 }
|
||||||
const fuse = new Fuse(sortedByTime, options)
|
const fuse = new Fuse(sortedByTime, options)
|
||||||
const searchResult = fuse.search(query).map(v => v.item)
|
const searchResult = fuse.search(query).map(v => v.item)
|
||||||
searchResult.forEach(articleDetail => {
|
searchResult.forEach(articleDetail => {
|
||||||
@ -1581,7 +1581,7 @@
|
|||||||
const searchKey = e.target.value.trim()
|
const searchKey = e.target.value.trim()
|
||||||
if (searchKey !== '') {
|
if (searchKey !== '') {
|
||||||
const options = {
|
const options = {
|
||||||
keys: ['title', 'tags', 'categories'],
|
keys: ['title', 'tags'],
|
||||||
threshold: 0.3
|
threshold: 0.3
|
||||||
}
|
}
|
||||||
const fuse = new Fuse(getArrayOfObj(floGlobals.appObjects.rmTimes.articles).sort((a, b) => b.published - a.published), options)
|
const fuse = new Fuse(getArrayOfObj(floGlobals.appObjects.rmTimes.articles).sort((a, b) => b.published - a.published), options)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user