minor search optimization

This commit is contained in:
sairaj mote 2022-06-03 02:49:01 +05:30
parent f7cc498722
commit 0336b322ef

View File

@ -1386,7 +1386,7 @@
})
getRef('explore_heading').textContent = 'Explore all'
} 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 searchResult = fuse.search(query).map(v => v.item)
searchResult.forEach(articleDetail => {
@ -1581,7 +1581,7 @@
const searchKey = e.target.value.trim()
if (searchKey !== '') {
const options = {
keys: ['title', 'tags', 'categories'],
keys: ['title', 'tags'],
threshold: 0.3
}
const fuse = new Fuse(getArrayOfObj(floGlobals.appObjects.rmTimes.articles).sort((a, b) => b.published - a.published), options)