Package org.apache.lucene.search

Examples of org.apache.lucene.search.PrefixFilter


        String query = copyToStringFromClasspath("/org/elasticsearch/index/query/prefix-filter-named.json");
        ParsedQuery parsedQuery = queryParser.parse(query);
        assertThat(parsedQuery.namedFilters().containsKey("test"), equalTo(true));
        assertThat(parsedQuery.query(), instanceOf(FilteredQuery.class));
        FilteredQuery filteredQuery = (FilteredQuery) parsedQuery.query();
        PrefixFilter prefixFilter = (PrefixFilter) filteredQuery.getFilter();
        assertThat(prefixFilter.getPrefix(), equalTo(new Term("name.first", "sh")));
    }
View Full Code Here


    /**
     * @return a filter that returns all nested documents.
     */
    private static Filter nestedFilter() {
        return new PrefixFilter(new Term(TypeFieldMapper.NAME, new BytesRef("__")));
    }
View Full Code Here

            } else {
                filter = smartNameFieldMappers.mapper().prefixFilter(value, parseContext);
            }
        }
        if (filter == null) {
            filter = new PrefixFilter(new Term(fieldName, BytesRefs.toBytesRef(value)));
        }

        if (cache) {
            filter = parseContext.cacheFilter(filter, cacheKey);
        }
View Full Code Here

TOP

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

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.