Created
January 15, 2013 11:13
-
-
Save martijnvg/4537938 to your computer and use it in GitHub Desktop.
The RobinEngine#loadCurrentVersionFromIndex method. Tweaked the BloomFilteringPostingsFormat to make bloom filter accessible for other users.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private long loadCurrentVersionFromIndex(Term uid) { | |
Searcher searcher = searcher(); | |
try { | |
List<AtomicReaderContext> readers = searcher.reader().leaves(); | |
Map<String, Map<String, BloomFilter>> testje = BloomFilteringPostingsFormat.testje; | |
for (int i = 0; i < readers.size(); i++) { | |
AtomicReaderContext readerContext = readers.get(i); | |
BloomFilter bloomFilter = testje.get(((SegmentReader)readerContext.reader()).getSegmentName()).get(uid.field()); | |
if (!bloomFilter.isPresent(uid.bytes())) { | |
continue; | |
} | |
long version = UidField.loadVersion(readerContext, uid); | |
// either -2 (its there, but no version associated), or an actual version | |
if (version != -1) { | |
return version; | |
} | |
} | |
return -1; | |
} finally { | |
searcher.release(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment