|
|
@@ -176,6 +176,9 @@ func (indexer *Indexer) Lookup(
|
|
|
for ; indexPointers[0] >= 0; indexPointers[0]-- {
|
|
|
// 以第一个搜索键出现的文档作为基准,并遍历其他搜索键搜索同一文档
|
|
|
baseDocId := indexer.getDocId(table[0], indexPointers[0])
|
|
|
+ if _, ok := indexer.tableLock.docs[baseDocId]; !ok {
|
|
|
+ continue
|
|
|
+ }
|
|
|
|
|
|
if docIds != nil {
|
|
|
_, found := docIds[baseDocId]
|
|
|
@@ -208,8 +211,7 @@ func (indexer *Indexer) Lookup(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- _, ok := indexer.tableLock.docs[baseDocId]
|
|
|
- if found && ok {
|
|
|
+ if found {
|
|
|
indexedDoc := types.IndexedDocument{}
|
|
|
|
|
|
// 当为LocationsIndex时计算关键词紧邻距离
|
|
|
@@ -418,5 +420,6 @@ func (indexer *Indexer) RemoveDoc(docId uint64) {
|
|
|
|
|
|
indexer.tableLock.Lock()
|
|
|
delete(indexer.tableLock.docs, docId)
|
|
|
+ indexer.numDocuments--
|
|
|
indexer.tableLock.Unlock()
|
|
|
}
|