Package org.elasticsearch.common.lucene.docset

Examples of org.elasticsearch.common.lucene.docset.DocSet


                LongsLAB longsLAB = null;
                if (cache.labEnabled) {
                    longsLAB = new LongsLAB(cache.labChunkSizeBytes, cache.labMaxAllocBytes);
                }
                DocIdSet docIdSet = filter.getDocIdSet(reader);
                DocSet docSet = FilterCacheValue.cacheable(reader, longsLAB, docIdSet);
                cacheValue = new FilterCacheValue<DocSet>(docSet, longsLAB);
                FilterCacheValue<DocSet> previous = innerCache.putIfAbsent(cacheKey, cacheValue);
                if (previous == null) {
                    cache.totalSizeInBytes.addAndGet(cacheValue.value().sizeInBytes());
                    cache.totalCount.incrementAndGet();
View Full Code Here


            Object key = filter;
            if (filter instanceof CacheKeyFilter) {
                key = ((CacheKeyFilter) filter).cacheKey();
            }

            DocSet docSet = cacheValue.value().get(key);
            if (docSet != null) {
                return docSet;
            }
            DocIdSet docIdSet = filter.getDocIdSet(reader);
            docSet = FilterCacheValue.cacheable(reader, cacheValue.longsLAB(), docIdSet);
            DocSet prev = cacheValue.value().putIfAbsent(key, docSet);
            if (prev != null) {
                docSet = prev;
            }
            return docSet == DocSet.EMPTY_DOC_SET ? null : docSet;
        }
View Full Code Here

                return subQueryExpl;
            }

            if (scoreMode == ScoreMode.First) {
                for (FilterFunction filterFunction : filterFunctions) {
                    DocSet docSet = DocSets.convert(reader, filterFunction.filter.getDocIdSet(reader));
                    if (docSet.get(doc)) {
                        filterFunction.function.setNextReader(reader);
                        Explanation functionExplanation = filterFunction.function.explain(doc, subQueryExpl);
                        float sc = getValue() * functionExplanation.getValue();
                        Explanation res = new ComplexExplanation(true, sc, "custom score, product of:");
                        res.addDetail(new Explanation(1.0f, "match filter: " + filterFunction.filter.toString()));
                        res.addDetail(functionExplanation);
                        res.addDetail(new Explanation(getValue(), "queryBoost"));
                        return res;
                    }
                }
            } else {
                int count = 0;
                float total = 0;
                float max = Float.NEGATIVE_INFINITY;
                ArrayList<Explanation> filtersExplanations = new ArrayList<Explanation>();
                for (FilterFunction filterFunction : filterFunctions) {
                    DocSet docSet = DocSets.convert(reader, filterFunction.filter.getDocIdSet(reader));
                    if (docSet.get(doc)) {
                        filterFunction.function.setNextReader(reader);
                        Explanation functionExplanation = filterFunction.function.explain(doc, subQueryExpl);
                        float sc = functionExplanation.getValue();
                        count++;
                        total += sc;
View Full Code Here

            String name = entry.getKey();
            Filter filter = entry.getValue();
            try {
                DocIdSet docIdSet = filter.getDocIdSet(hitContext.reader());
                if (docIdSet != null) {
                    DocSet docSet = DocSets.convert(hitContext.reader(), docIdSet);
                    if (docSet.get(hitContext.docId())) {
                        matchedFilters.add(name);
                    }
                }
            } catch (IOException e) {
                // ignore
View Full Code Here

TOP

Related Classes of org.elasticsearch.common.lucene.docset.DocSet

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.