Package org.elasticsearch.common.bloom

Examples of org.elasticsearch.common.bloom.BloomFilter


            // no version, get the version from the index, we know that we refresh on flush
            Searcher searcher = searcher();
            try {
                UnicodeUtil.UTF8Result utf8 = Unicode.fromStringAsUtf8(get.uid().text());
                for (IndexReader reader : searcher.searcher().subReaders()) {
                    BloomFilter filter = bloomCache.filter(reader, UidFieldMapper.NAME, asyncLoadBloomFilter);
                    // we know that its not there...
                    if (!filter.isPresent(utf8.result, 0, utf8.length)) {
                        continue;
                    }
                    UidField.DocIdAndVersion docIdAndVersion = UidField.loadDocIdAndVersion(reader, get.uid());
                    if (docIdAndVersion != null && docIdAndVersion.docId != Lucene.NO_DOC) {
                        return new GetResult(searcher, docIdAndVersion);
View Full Code Here


    private long loadCurrentVersionFromIndex(Term uid) {
        UnicodeUtil.UTF8Result utf8 = Unicode.fromStringAsUtf8(uid.text());
        Searcher searcher = searcher();
        try {
            for (IndexReader reader : searcher.searcher().subReaders()) {
                BloomFilter filter = bloomCache.filter(reader, UidFieldMapper.NAME, asyncLoadBloomFilter);
                // we know that its not there...
                if (!filter.isPresent(utf8.result, 0, utf8.length)) {
                    continue;
                }
                long version = UidField.loadVersion(reader, uid);
                // either -2 (its there, but no version associated), or an actual version
                if (version != -1) {
View Full Code Here

    // TODO Optimizations
    // - If we have a single id, we can create a SingleIdDocIdSet to save on mem
    // - We can use sorted int array DocIdSet to reserve memory compared to OpenBitSet in some cases
    @Override public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
        BloomFilter filter = bloomCache.filter(reader, UidFieldMapper.NAME, true);
        OpenBitSet set = null;
        TermDocs td = null;
        try {
            for (Term uid : uids) {
                UnicodeUtil.UTF8Result utf8 = Unicode.fromStringAsUtf8(uid.text());
                if (!filter.isPresent(utf8.result, 0, utf8.length)) {
                    continue;
                }
                if (td == null) {
                    td = reader.termDocs();
                }
View Full Code Here

        @SuppressWarnings({"StringEquality"})
        @Override public void run() {
            TermDocs termDocs = null;
            TermEnum termEnum = null;
            try {
                BloomFilter filter = BloomFilterFactory.getFilter(reader.numDocs(), 15);
                termDocs = reader.termDocs();
                termEnum = reader.terms(new Term(field));
                do {
                    Term term = termEnum.term();
                    if (term == null || term.field() != field) break;

                    // LUCENE MONITOR: 4.0, move to use bytes!
                    UnicodeUtil.UTF8Result utf8Result = Unicode.fromStringAsUtf8(term.text());
                    termDocs.seek(termEnum);
                    while (termDocs.next()) {
                        // when traversing, make sure to ignore deleted docs, so the key->docId will be correct
                        if (!reader.isDeleted(termDocs.doc())) {
                            filter.add(utf8Result.result, 0, utf8Result.length);
                        }
                    }
                } while (termEnum.next());
                ConcurrentMap<String, BloomFilterEntry> fieldCache = cache.get(reader.getCoreCacheKey());
                if (fieldCache != null) {
View Full Code Here

TOP

Related Classes of org.elasticsearch.common.bloom.BloomFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.