Package org.elasticsearch.index.search.geo

Examples of org.elasticsearch.index.search.geo.GeoBoundingBoxFilter$Point


        IndexQueryParserService queryParser = queryParser();
        String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_boundingbox4.json");
        Query parsedQuery = queryParser.parse(query).query();
        assertThat(parsedQuery, instanceOf(DeletionAwareConstantScoreQuery.class));
        DeletionAwareConstantScoreQuery constantScoreQuery = (DeletionAwareConstantScoreQuery) parsedQuery;
        GeoBoundingBoxFilter filter = (GeoBoundingBoxFilter) constantScoreQuery.getFilter();
        assertThat(filter.fieldName(), equalTo("location"));
        assertThat(filter.topLeft().lat, closeTo(40, 0.00001));
        assertThat(filter.topLeft().lon, closeTo(-70, 0.00001));
        assertThat(filter.bottomRight().lat, closeTo(30, 0.00001));
        assertThat(filter.bottomRight().lon, closeTo(-80, 0.00001));
    }
View Full Code Here


        String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_boundingbox-named.json");
        ParsedQuery parsedQuery = queryParser.parse(query);
        assertThat(parsedQuery.query(), instanceOf(DeletionAwareConstantScoreQuery.class));
        assertThat(parsedQuery.namedFilters().containsKey("test"), equalTo(true));
        DeletionAwareConstantScoreQuery constantScoreQuery = (DeletionAwareConstantScoreQuery) parsedQuery.query();
        GeoBoundingBoxFilter filter = (GeoBoundingBoxFilter) constantScoreQuery.getFilter();
        assertThat(filter.fieldName(), equalTo("location"));
        assertThat(filter.topLeft().lat, closeTo(40, 0.00001));
        assertThat(filter.topLeft().lon, closeTo(-70, 0.00001));
        assertThat(filter.bottomRight().lat, closeTo(30, 0.00001));
        assertThat(filter.bottomRight().lon, closeTo(-80, 0.00001));
    }
View Full Code Here

        IndexQueryParserService queryParser = queryParser();
        String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_boundingbox1.json");
        Query parsedQuery = queryParser.parse(query).query();
        assertThat(parsedQuery, instanceOf(DeletionAwareConstantScoreQuery.class));
        DeletionAwareConstantScoreQuery constantScoreQuery = (DeletionAwareConstantScoreQuery) parsedQuery;
        GeoBoundingBoxFilter filter = (GeoBoundingBoxFilter) constantScoreQuery.getFilter();
        assertThat(filter.fieldName(), equalTo("location"));
        assertThat(filter.topLeft().lat, closeTo(40, 0.00001));
        assertThat(filter.topLeft().lon, closeTo(-70, 0.00001));
        assertThat(filter.bottomRight().lat, closeTo(30, 0.00001));
        assertThat(filter.bottomRight().lon, closeTo(-80, 0.00001));
    }
View Full Code Here

        IndexQueryParserService queryParser = queryParser();
        String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_boundingbox2.json");
        Query parsedQuery = queryParser.parse(query).query();
        assertThat(parsedQuery, instanceOf(DeletionAwareConstantScoreQuery.class));
        DeletionAwareConstantScoreQuery constantScoreQuery = (DeletionAwareConstantScoreQuery) parsedQuery;
        GeoBoundingBoxFilter filter = (GeoBoundingBoxFilter) constantScoreQuery.getFilter();
        assertThat(filter.fieldName(), equalTo("location"));
        assertThat(filter.topLeft().lat, closeTo(40, 0.00001));
        assertThat(filter.topLeft().lon, closeTo(-70, 0.00001));
        assertThat(filter.bottomRight().lat, closeTo(30, 0.00001));
        assertThat(filter.bottomRight().lon, closeTo(-80, 0.00001));
    }
View Full Code Here

        IndexQueryParserService queryParser = queryParser();
        String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_boundingbox3.json");
        Query parsedQuery = queryParser.parse(query).query();
        assertThat(parsedQuery, instanceOf(DeletionAwareConstantScoreQuery.class));
        DeletionAwareConstantScoreQuery constantScoreQuery = (DeletionAwareConstantScoreQuery) parsedQuery;
        GeoBoundingBoxFilter filter = (GeoBoundingBoxFilter) constantScoreQuery.getFilter();
        assertThat(filter.fieldName(), equalTo("location"));
        assertThat(filter.topLeft().lat, closeTo(40, 0.00001));
        assertThat(filter.topLeft().lon, closeTo(-70, 0.00001));
        assertThat(filter.bottomRight().lat, closeTo(30, 0.00001));
        assertThat(filter.bottomRight().lon, closeTo(-80, 0.00001));
    }
View Full Code Here

            throw new QueryParsingException(parseContext.index(), "field [" + fieldName + "] is not a geo_point field");
        }
        fieldName = mapper.names().indexName();


        Filter filter = new GeoBoundingBoxFilter(topLeft, bottomRight, fieldName, parseContext.indexCache().fieldData());
        if (cache) {
            filter = parseContext.cacheFilter(filter, cacheKey);
        }
        filter = wrapSmartNameFilter(filter, parseContext.smartFieldMappers(fieldName), parseContext);
        if (filterName != null) {
View Full Code Here

TOP

Related Classes of org.elasticsearch.index.search.geo.GeoBoundingBoxFilter$Point

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.