Package org.elasticsearch.common.lucene.search

Examples of org.elasticsearch.common.lucene.search.NotFilter


            filter = new TermRangeFilter(fieldName, null, null, true, true);
        }

        // we always cache this one, really does not change... (exists)
        filter = parseContext.cacheFilter(filter, null);
        filter = new NotFilter(filter);
        // cache the not filter as well, so it will be faster
        filter = parseContext.cacheFilter(filter, null);

        filter = wrapSmartNameFilter(filter, smartNameFieldMappers, parseContext);
        if (filterName != null) {
View Full Code Here


        IndexQueryParserService queryParser = queryParser();
        Query parsedQuery = queryParser.parse(filteredQuery(matchAllQuery(), notFilter(termFilter("name.first", "shay1")))).query();
        assertThat(parsedQuery, instanceOf(DeletionAwareConstantScoreQuery.class));
        DeletionAwareConstantScoreQuery constantScoreQuery = (DeletionAwareConstantScoreQuery) parsedQuery;

        NotFilter notFilter = (NotFilter) constantScoreQuery.getFilter();
        assertThat(((TermFilter) notFilter.filter()).getTerm(), equalTo(new Term("name.first", "shay1")));
    }
View Full Code Here

        Query parsedQuery = queryParser.parse(query).query();
        assertThat(parsedQuery, instanceOf(FilteredQuery.class));
        FilteredQuery filteredQuery = (FilteredQuery) parsedQuery;
        assertThat(((TermQuery) filteredQuery.getQuery()).getTerm(), equalTo(new Term("name.first", "shay")));

        NotFilter notFilter = (NotFilter) filteredQuery.getFilter();
        assertThat(((TermFilter) notFilter.filter()).getTerm(), equalTo(new Term("name.first", "shay1")));
    }
View Full Code Here

        Query parsedQuery = queryParser.parse(query).query();
        assertThat(parsedQuery, instanceOf(FilteredQuery.class));
        FilteredQuery filteredQuery = (FilteredQuery) parsedQuery;
        assertThat(((TermQuery) filteredQuery.getQuery()).getTerm(), equalTo(new Term("name.first", "shay")));

        NotFilter notFilter = (NotFilter) filteredQuery.getFilter();
        assertThat(((TermFilter) notFilter.filter()).getTerm(), equalTo(new Term("name.first", "shay1")));
    }
View Full Code Here

        Query parsedQuery = queryParser.parse(query).query();
        assertThat(parsedQuery, instanceOf(FilteredQuery.class));
        FilteredQuery filteredQuery = (FilteredQuery) parsedQuery;
        assertThat(((TermQuery) filteredQuery.getQuery()).getTerm(), equalTo(new Term("name.first", "shay")));

        NotFilter notFilter = (NotFilter) filteredQuery.getFilter();
        assertThat(((TermFilter) notFilter.filter()).getTerm(), equalTo(new Term("name.first", "shay1")));
    }
View Full Code Here

        if (filter == null) {
            throw new QueryParsingException(parseContext.index(), "filter is required when using `not` filter");
        }

        Filter notFilter = new NotFilter(filter);
        if (cache) {
            notFilter = parseContext.cacheFilter(notFilter, cacheKey);
        }
        if (filterName != null) {
            parseContext.addNamedFilter(filterName, notFilter);
View Full Code Here

            filter = new TermRangeFilter(fieldName, null, null, true, true);
        }

        // we always cache this one, really does not change... (exists)
        filter = parseContext.cacheFilter(filter, null);
        filter = new NotFilter(filter);
        // cache the not filter as well, so it will be faster
        filter = parseContext.cacheFilter(filter, null);

        filter = wrapSmartNameFilter(filter, smartNameFieldMappers, parseContext);
View Full Code Here

                String columnName = reference.info().ident().columnIdent().fqn();
                QueryBuilderHelper builderHelper = QueryBuilderHelper.forType(reference.valueType());
                return new FilteredQuery(
                        Queries.newMatchAllQuery(),
                        new NotFilter(builderHelper.rangeFilter(columnName, null, null, true, true)));
            }
View Full Code Here

            return null;
        }

        // wrap the query with type query
        innerQuery = new FilteredQuery(innerQuery, parseContext.cacheFilter(parentDocMapper.typeFilter(), null));
        BitDocIdSetFilter childrenFilter = parseContext.bitsetFilter(new NotFilter(parentFilter));
        if (score) {
            return new ParentQuery(parentChildIndexFieldData, innerQuery, parentDocMapper.type(), childrenFilter);
        } else {
            return new ParentConstantScoreQuery(parentChildIndexFieldData, innerQuery, parentDocMapper.type(), childrenFilter);
        }
View Full Code Here

            }

            // we always cache this one, really does not change... (exists)
            // its ok to cache under the fieldName cacheKey, since its per segment and the mapping applies to this data on this segment...
            existenceFilter = parseContext.cacheFilter(boolFilter, new CacheKeyFilter.Key("$exists$" + fieldPattern));
            existenceFilter = new NotFilter(existenceFilter);
            // cache the not filter as well, so it will be faster
            existenceFilter = parseContext.cacheFilter(existenceFilter, new CacheKeyFilter.Key("$missing$" + fieldPattern));
        }

        if (nullValue) {
View Full Code Here

TOP

Related Classes of org.elasticsearch.common.lucene.search.NotFilter

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.