confusing code..., but we can't release the searcher in a get result case

we need that searcher later on..., need to think of how to simplify that..., added a comment for now
This commit is contained in:
Shay Banon 2013-04-05 23:27:03 +02:00
parent 36ffd6d582
commit 815917fbf8
1 changed files with 4 additions and 2 deletions

View File

@ -333,15 +333,17 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine {
AtomicReaderContext readerContext = readers.get(i);
UidField.DocIdAndVersion docIdAndVersion = UidField.loadDocIdAndVersion(readerContext, get.uid());
if (docIdAndVersion != null && docIdAndVersion.docId != Lucene.NO_DOC) {
// note, we don't release the searcher here, since it will be released as part of the external
// API usage, since it still needs it to load data...
return new GetResult(searcher, docIdAndVersion);
}
}
} catch (Exception e) {
searcher.release();
//TODO: A better exception goes here
throw new EngineException(shardId(), "failed to load document", e);
} finally {
searcher.release();
}
searcher.release();
return GetResult.NOT_EXISTS;
} finally {
rwl.readLock().unlock();