Package org.apache.lucene.search

Examples of org.apache.lucene.search.DeletionAwareConstantScoreQuery$DeletionConstantWeight


        if (path == null) {
            throw new QueryParsingException(parseContext.index(), "[nested] requires 'path' field");
        }

        if (filter != null) {
            query = new DeletionAwareConstantScoreQuery(filter);
        }

        query.setBoost(boost);

        MapperService.SmartNameObjectMapper mapper = parseContext.mapperService().smartNameObjectMapper(path);
View Full Code Here


        TermFilter filter = new TermFilter(new Term("id", "1"));
        Filter cachedFilter = filterCache.cache(filter);
        long constantScoreCount = filter == cachedFilter ? 0 : 1;
        // sadly, when caching based on cacheKey with NRT, this fails, that's why we have DeletionAware one
        assertThat(Lucene.count(searcher, new ConstantScoreQuery(cachedFilter), -1), equalTo(constantScoreCount));
        assertThat(Lucene.count(searcher, new DeletionAwareConstantScoreQuery(cachedFilter), -1), equalTo(0l));
        assertThat(Lucene.count(searcher, new FilteredQuery(new MatchAllDocsQuery(), cachedFilter), -1), equalTo(0l));

        indexWriter.close();
    }
View Full Code Here

            filter = parseContext.cacheFilter(filter, cacheKey);
        }

        // if its a match_all query, use constant_score
        if (Queries.isMatchAllQuery(query)) {
            Query q = new DeletionAwareConstantScoreQuery(filter);
            q.setBoost(boost);
            return q;
        }

        // TODO
        // With the way filtered queries work today, both query and filter advance (one at a time)
View Full Code Here

        if (path == null) {
            throw new QueryParsingException(parseContext.index(), "[nested] requires 'path' field");
        }

        if (filter != null) {
            query = new DeletionAwareConstantScoreQuery(filter);
        }

        query.setBoost(boost);

        MapperService.SmartNameObjectMapper mapper = parseContext.mapperService().smartNameObjectMapper(path);
View Full Code Here

        }
        return new TermFilter(termFactory.createTerm(value));
    }

    @Override public Query fieldQuery(String value, QueryParseContext context) {
        return new DeletionAwareConstantScoreQuery(context.cacheFilter(fieldFilter(value), null));
    }
View Full Code Here

        indexWriter.addDocument(doc().add(field("_id", "2")).add(field("text", "lucene release")).build());

        IndexReader reader = IndexReader.open(indexWriter, true);
        IndexSearcher searcher = new IndexSearcher(reader);

        DeletionAwareConstantScoreQuery query = new DeletionAwareConstantScoreQuery(Queries.MATCH_ALL_FILTER);
        long count = Lucene.count(searcher, query, -1);
        assertThat(count, equalTo(2l));

        reader.close();
        indexWriter.close();
View Full Code Here

        super(facetName);
        this.filter = filter;
    }

    @Override public void optimizedGlobalExecution(SearchContext searchContext) throws IOException {
        Query query = new DeletionAwareConstantScoreQuery(filter);
        if (super.filter != null) {
            query = new FilteredQuery(query, super.filter);
        }
        Filter searchFilter = searchContext.mapperService().searchFilter(searchContext.types());
        if (searchFilter != null) {
View Full Code Here

            // cache the filter if possible needed
            if (cache) {
                filter = parseContext.cacheFilter(filter, cacheKey);
            }

            Query query1 = new DeletionAwareConstantScoreQuery(filter);
            query1.setBoost(boost);
            return query1;
        }
        // Query
        query = new ConstantScoreQuery(query);
        query.setBoost(boost);
View Full Code Here

        shard.refresh(new Engine.Refresh(true));
        Engine.Searcher searcher = shard.searcher();
        try {
            // create a query to fetch all queries that are registered under the index name (which is the type
            // in the percolator).
            Query query = new DeletionAwareConstantScoreQuery(indexQueriesFilter(indexName));
            QueriesLoaderCollector queries = new QueriesLoaderCollector();
            searcher.searcher().search(query, queries);
            percolator.addQueries(queries.queries());
        } catch (IOException e) {
            throw new PercolatorException(index, "failed to load queries from percolator index");
View Full Code Here

        // we always cache this one, really does not change...
        filter = parseContext.cacheFilter(filter, null);

        filter = wrapSmartNameFilter(filter, smartNameFieldMappers, parseContext);

        return new DeletionAwareConstantScoreQuery(filter);
    }
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.DeletionAwareConstantScoreQuery$DeletionConstantWeight

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.