Skip to content

Commit

Permalink
Revert "在goroutine worker里不要用return"
Browse files Browse the repository at this point in the history
This reverts commit e1b46af.
  • Loading branch information
lijingpeng committed Dec 3, 2015
1 parent e1b46af commit 06d71d0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions core/indexer.go
Expand Up @@ -176,9 +176,6 @@ 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]
Expand Down Expand Up @@ -211,7 +208,8 @@ func (indexer *Indexer) Lookup(
}
}

if found {
_, ok := indexer.tableLock.docs[baseDocId]
if found && ok {
indexedDoc := types.IndexedDocument{}

// 当为LocationsIndex时计算关键词紧邻距离
Expand Down Expand Up @@ -420,6 +418,5 @@ func (indexer *Indexer) RemoveDoc(docId uint64) {

indexer.tableLock.Lock()
delete(indexer.tableLock.docs, docId)
indexer.numDocuments--
indexer.tableLock.Unlock()
}
2 changes: 1 addition & 1 deletion engine/indexer_worker.go
Expand Up @@ -47,7 +47,7 @@ func (engine *Engine) indexerLookupWorker(shard int) {

if request.countDocsOnly {
request.rankerReturnChannel <- rankerReturnRequest{numDocs: numDocs}
continue
return
}

if len(docs) == 0 {
Expand Down

0 comments on commit 06d71d0

Please sign in to comment.