Workaround for #129
This commit is contained in:
@@ -4,7 +4,6 @@ import { database } from './database'
|
|||||||
import MiniSearch from 'minisearch'
|
import MiniSearch from 'minisearch'
|
||||||
import { minisearchOptions } from './search/search-engine'
|
import { minisearchOptions } from './search/search-engine'
|
||||||
import { makeMD5 } from './tools/utils'
|
import { makeMD5 } from './tools/utils'
|
||||||
import { settings } from './settings'
|
|
||||||
|
|
||||||
class CacheManager {
|
class CacheManager {
|
||||||
private liveDocuments: Map<string, IndexedDocument> = new Map()
|
private liveDocuments: Map<string, IndexedDocument> = new Map()
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ export async function fileToIndexedDocument(
|
|||||||
// Look for links that lead to non-existing files,
|
// Look for links that lead to non-existing files,
|
||||||
// and add them to the index.
|
// and add them to the index.
|
||||||
if (metadata) {
|
if (metadata) {
|
||||||
|
// FIXME: https://github.com/scambier/obsidian-omnisearch/issues/129
|
||||||
const nonExisting = getNonExistingNotes(file, metadata)
|
const nonExisting = getNonExistingNotes(file, metadata)
|
||||||
for (const name of nonExisting.filter(
|
for (const name of nonExisting.filter(
|
||||||
o => !cacheManager.getLiveDocument(o)
|
o => !cacheManager.getLiveDocument(o)
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Notice, TAbstractFile, TFile } from 'obsidian'
|
import { Notice, TAbstractFile, TFile } from 'obsidian'
|
||||||
import { isFileIndexable, wait } from './tools/utils'
|
import { isFileIndexable, wait } from './tools/utils'
|
||||||
import { removeAnchors } from './tools/notes'
|
import { removeAnchors } from './tools/notes'
|
||||||
import { settings } from './settings'
|
|
||||||
import { SearchEngine } from './search/search-engine'
|
import { SearchEngine } from './search/search-engine'
|
||||||
import { cacheManager } from './cache-manager'
|
import { cacheManager } from './cache-manager'
|
||||||
import type { IndexedDocument } from './globals'
|
import type { IndexedDocument } from './globals'
|
||||||
|
|||||||
@@ -150,7 +150,11 @@ export class SearchEngine {
|
|||||||
return exclusions.every(q => !content.includes(q.value))
|
return exclusions.every(q => !content.includes(q.value))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return results
|
// FIXME:
|
||||||
|
// Dedupe results - clutch for https://github.com/scambier/obsidian-omnisearch/issues/129
|
||||||
|
return results.filter(
|
||||||
|
(result, index, arr) => arr.findIndex(t => t.id === result.id) === index
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user