Package org.apache.lucene.search

Examples of org.apache.lucene.search.PublicTermsFilter


                useTermsFilter = false;
                break;
            }
        }
        if (useTermsFilter) {
            PublicTermsFilter termsFilter = new PublicTermsFilter();
            for (String type : types) {
                termsFilter.addTerm(TypeFieldMapper.TERM_FACTORY.createTerm(type));
            }
            return termsFilter;
        } else {
            XBooleanFilter bool = new XBooleanFilter();
            for (String type : types) {
View Full Code Here


            if (docMapper == null) {
                throw new TypeMissingException(index, types[0]);
            }
            return docMapper.typeFilter();
        }
        PublicTermsFilter termsFilter = new PublicTermsFilter();
        for (String type : types) {
            if (!hasMapping(type)) {
                throw new TypeMissingException(index, type);
            }
            termsFilter.addTerm(TypeFieldMapper.TERM_FACTORY.createTerm(type));
        }
        return termsFilter;
    }
View Full Code Here

    @Override public Filter parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
        XContentParser parser = parseContext.parser();

        MapperService.SmartNameFieldMappers smartNameFieldMappers = null;
        boolean cache = true;
        PublicTermsFilter termsFilter = new PublicTermsFilter();
        String filterName = null;
        String currentFieldName = null;
        CacheKeyFilter.Key cacheKey = null;
        XContentParser.Token token;
        while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
            if (token == XContentParser.Token.FIELD_NAME) {
                currentFieldName = parser.currentName();
            } else if (token == XContentParser.Token.START_ARRAY) {
                String fieldName = currentFieldName;
                FieldMapper fieldMapper = null;
                smartNameFieldMappers = parseContext.smartFieldMappers(fieldName);
                if (smartNameFieldMappers != null) {
                    if (smartNameFieldMappers.hasMapper()) {
                        fieldMapper = smartNameFieldMappers.mapper();
                        fieldName = fieldMapper.names().indexName();
                    }
                }

                while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
                    String value = parser.text();
                    if (value == null) {
                        throw new QueryParsingException(parseContext.index(), "No value specified for term filter");
                    }
                    if (fieldMapper != null) {
                        value = fieldMapper.indexedValue(value);
                    }
                    termsFilter.addTerm(new Term(fieldName, value));
                }
            } else if (token.isValue()) {
                if ("_name".equals(currentFieldName)) {
                    filterName = parser.text();
                } else if ("_cache".equals(currentFieldName)) {
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.PublicTermsFilter

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.