Package org.springframework.data.elasticsearch.core.query

Examples of org.springframework.data.elasticsearch.core.query.Criteria


  @Test
  public void shouldFindAuthorMarkersInRangeForGivenCriteriaQuery() {
    //given
    loadClassBaseEntities();
    CriteriaQuery geoLocationCriteriaQuery = new CriteriaQuery(
        new Criteria("location").within(new GeoPoint(45.7806d, 3.0875d), "20km"));
    //when
    List<AuthorMarkerEntity> geoAuthorsForGeoCriteria = elasticsearchTemplate.queryForList(geoLocationCriteriaQuery, AuthorMarkerEntity.class);

    //then
    assertThat(geoAuthorsForGeoCriteria.size(), is(1));
View Full Code Here


  @Test
  public void shouldFindSelectedAuthorMarkerInRangeForGivenCriteriaQuery() {
    //given
    loadClassBaseEntities();
    CriteriaQuery geoLocationCriteriaQuery2 = new CriteriaQuery(
        new Criteria("name").is("Mohsin Husen").and("location").within(new GeoPoint(51.5171d, 0.1062d), "20km"));
    //when
    List<AuthorMarkerEntity> geoAuthorsForGeoCriteria2 = elasticsearchTemplate.queryForList(geoLocationCriteriaQuery2, AuthorMarkerEntity.class);

    //then
    assertThat(geoAuthorsForGeoCriteria2.size(), is(1));
View Full Code Here

  @Test
  public void shouldFindStringAnnotatedGeoMarkersInRangeForGivenCriteriaQuery() {
    //given
    loadAnnotationBaseEntities();
    CriteriaQuery geoLocationCriteriaQuery = new CriteriaQuery(
        new Criteria("location").within(new GeoPoint(51.000000, 0.100000), "1km"));
    //when
    List<AuthorMarkerAnnotatedEntity> geoAuthorsForGeoCriteria = elasticsearchTemplate.queryForList(geoLocationCriteriaQuery, AuthorMarkerAnnotatedEntity.class);

    //then
    assertThat(geoAuthorsForGeoCriteria.size(), is(3));
View Full Code Here

  @Test
  public void shouldFindDoubleAnnotatedGeoMarkersInRangeForGivenCriteriaQuery() {
    //given
    loadAnnotationBaseEntities();
    CriteriaQuery geoLocationCriteriaQuery = new CriteriaQuery(
        new Criteria("additionalLocation").within(new GeoPoint(51.001000, 0.10100), "1km"));
    //when
    List<AuthorMarkerAnnotatedEntity> geoAuthorsForGeoCriteria = elasticsearchTemplate.queryForList(geoLocationCriteriaQuery, AuthorMarkerAnnotatedEntity.class);

    //then
    assertThat(geoAuthorsForGeoCriteria.size(), is(3));
View Full Code Here

  @Test
  public void shouldFindAnnotatedGeoMarkersInRangeForGivenCriteriaQuery() {
    //given
    loadAnnotationBaseEntities();
    CriteriaQuery geoLocationCriteriaQuery = new CriteriaQuery(
        new Criteria("additionalLocation").within("51.001000, 0.10100", "1km"));
    //when
    List<AuthorMarkerAnnotatedEntity> geoAuthorsForGeoCriteria = elasticsearchTemplate.queryForList(geoLocationCriteriaQuery, AuthorMarkerAnnotatedEntity.class);

    //then
    assertThat(geoAuthorsForGeoCriteria.size(), is(3));
View Full Code Here

  @Test
  public void shouldFindAnnotatedGeoMarkersInRangeForGivenCriteriaQueryUsingGeohashLocation() {
    //given
    loadAnnotationBaseEntities();
    CriteriaQuery geoLocationCriteriaQuery = new CriteriaQuery(
        new Criteria("additionalLocation").within("u1044", "1km"));
    //when
    List<AuthorMarkerAnnotatedEntity> geoAuthorsForGeoCriteria = elasticsearchTemplate.queryForList(geoLocationCriteriaQuery, AuthorMarkerAnnotatedEntity.class);

    //then
    assertThat(geoAuthorsForGeoCriteria.size(), is(3));
View Full Code Here

  @Test
  public void shouldFindAuthorMarkersInBoxForGivenCriteriaQueryUsingGeoBox() {
    //given
    loadClassBaseEntities();
    CriteriaQuery geoLocationCriteriaQuery3 = new CriteriaQuery(
        new Criteria("location").boundedBy(
            new GeoBox(new GeoPoint(53.5171d, 0),
                new GeoPoint(49.5171d, 0.2062d))
        )
    );
    //when
View Full Code Here

  @Test
  public void shouldFindAuthorMarkersInBoxForGivenCriteriaQueryUsingGeohash() {
    //given
    loadClassBaseEntities();
    CriteriaQuery geoLocationCriteriaQuery3 = new CriteriaQuery(
        new Criteria("location").boundedBy(GeoHashUtils.encode(53.5171d, 0), GeoHashUtils.encode(49.5171d, 0.2062d)));
    //when
    List<AuthorMarkerEntity> geoAuthorsForGeoCriteria3 = elasticsearchTemplate.queryForList(geoLocationCriteriaQuery3, AuthorMarkerEntity.class);

    //then
    assertThat(geoAuthorsForGeoCriteria3.size(), is(2));
View Full Code Here

  @Test
  public void shouldFindAuthorMarkersInBoxForGivenCriteriaQueryUsingGeoPoints() {
    //given
    loadClassBaseEntities();
    CriteriaQuery geoLocationCriteriaQuery3 = new CriteriaQuery(
        new Criteria("location").boundedBy(
            new GeoPoint(53.5171d, 0),
            new GeoPoint(49.5171d, 0.2062d))
    );
    //when
    List<AuthorMarkerEntity> geoAuthorsForGeoCriteria3 = elasticsearchTemplate.queryForList(geoLocationCriteriaQuery3, AuthorMarkerEntity.class);
View Full Code Here

  @Override
  protected CriteriaQuery create(Part part, Iterator<Object> iterator) {
    PersistentPropertyPath<ElasticsearchPersistentProperty> path = context
        .getPersistentPropertyPath(part.getProperty());
    return new CriteriaQuery(from(part.getType(),
        new Criteria(path.toDotPath(ElasticsearchPersistentProperty.PropertyToFieldNameConverter.INSTANCE)), iterator));
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.elasticsearch.core.query.Criteria

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.