Even faster search
This commit is contained in:
parent
ece64f48be
commit
fabec4dd7e
|
@ -25,11 +25,16 @@ const documents = computed(() => {
|
||||||
// List the current location
|
// List the current location
|
||||||
if (!documentStore.search) return documentStore.document.filter(doc => doc.loc === loc)
|
if (!documentStore.search) return documentStore.document.filter(doc => doc.loc === loc)
|
||||||
// Find up to 100 newest documents that match the search
|
// Find up to 100 newest documents that match the search
|
||||||
let docs = documentStore.recentDocuments
|
|
||||||
const search = documentStore.search
|
const search = documentStore.search
|
||||||
console.log('Searching for', search)
|
|
||||||
const needle = needleFormat(search)
|
const needle = needleFormat(search)
|
||||||
docs = docs.filter(doc => localeIncludes(doc.haystack, needle)).slice(0, 100)
|
let limit = 100
|
||||||
|
let docs = []
|
||||||
|
for (const doc of documentStore.recentDocuments) {
|
||||||
|
if (localeIncludes(doc.haystack, needle)) {
|
||||||
|
docs.push(doc)
|
||||||
|
if (--limit === 0) break
|
||||||
|
}
|
||||||
|
}
|
||||||
// Organize by folder, by relevance
|
// Organize by folder, by relevance
|
||||||
const locsub = loc + '/'
|
const locsub = loc + '/'
|
||||||
docs.sort((a, b) => (
|
docs.sort((a, b) => (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user