Package org.springframework.data.solr.core.query

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


    DateTime dateTime = new DateTime(2012, 8, 21, 6, 35, 0, DateTimeZone.UTC);
    Calendar calendar = Calendar.getInstance();
    calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
    calendar.setTimeInMillis(dateTime.getMillis());

    Criteria criteria = new Criteria("dateField").is(calendar.getTime());
    Assert.assertEquals("dateField:2012\\-08\\-21T06\\:35\\:00.000Z",
        queryParser.createQueryStringFromCriteria(criteria));
  }
View Full Code Here


  @Test
  public void testIsWithJodaDateTime() {
    DateTime dateTime = new DateTime(2012, 8, 21, 6, 35, 0, DateTimeZone.UTC);

    Criteria criteria = new Criteria("dateField").is(dateTime);
    Assert.assertEquals("dateField:2012\\-08\\-21T06\\:35\\:00.000Z",
        queryParser.createQueryStringFromCriteria(criteria));
  }
View Full Code Here

  @Test
  public void testIsWithJodaLocalDateTime() {
    LocalDateTime dateTime = new LocalDateTime(new DateTime(2012, 8, 21, 6, 35, 0, DateTimeZone.UTC).getMillis(),
        DateTimeZone.UTC);

    Criteria criteria = new Criteria("dateField").is(dateTime);
    Assert.assertEquals("dateField:2012\\-08\\-21T06\\:35\\:00.000Z",
        queryParser.createQueryStringFromCriteria(criteria));
  }
View Full Code Here

        queryParser.createQueryStringFromCriteria(criteria));
  }

  @Test
  public void testIsWithNegativeNumner() {
    Criteria criteria = new Criteria("field_1").is(-100);
    Assert.assertEquals("field_1:\\-100", queryParser.createQueryStringFromCriteria(criteria));
  }
View Full Code Here

    Assert.assertEquals("field_1:\\-100", queryParser.createQueryStringFromCriteria(criteria));
  }

  @Test
  public void testNear() {
    Criteria criteria = new Criteria("field_1").near(new Point(48.303056, 14.290556), new Distance(5));
    Assert.assertEquals("{!bbox pt=48.303056,14.290556 sfield=field_1 d=5.0}",
        queryParser.createQueryStringFromCriteria(criteria));
  }
View Full Code Here

  /**
   * @see DATASOLR-142
   */
  @Test(expected = IllegalArgumentException.class)
  public void testCircleForNearMustNotBeNull() {
    new Criteria("field_1").near((Circle) null);
  }
View Full Code Here

    new Criteria("field_1").near((Circle) null);
  }

  @Test
  public void testNearWithDistanceUnitMiles() {
    Criteria criteria = new Criteria("field_1").near(new Point(48.303056, 14.290556), new Distance(1, Metrics.MILES));
    Assert.assertEquals("{!bbox pt=48.303056,14.290556 sfield=field_1 d=1.609344}",
        queryParser.createQueryStringFromCriteria(criteria));
  }
View Full Code Here

        queryParser.createQueryStringFromCriteria(criteria));
  }

  @Test
  public void testNearWithDistanceUnitKilometers() {
    Criteria criteria = new Criteria("field_1").near(new Point(48.303056, 14.290556), new Distance(1,
        Metrics.KILOMETERS));
    Assert.assertEquals("{!bbox pt=48.303056,14.290556 sfield=field_1 d=1.0}",
        queryParser.createQueryStringFromCriteria(criteria));
  }
View Full Code Here

        queryParser.createQueryStringFromCriteria(criteria));
  }

  @Test
  public void testNearWithCoords() {
    Criteria criteria = new Criteria("field_1").near(new Box(new Point(48.303056, 14.290556), new Point(48.303056,
        14.290556)));
    Assert.assertEquals("field_1:[48.303056,14.290556 TO 48.303056,14.290556]",
        queryParser.createQueryStringFromCriteria(criteria));
  }
View Full Code Here

        queryParser.createQueryStringFromCriteria(criteria));
  }

  @Test
  public void testWithinWithDistanceUnitMiles() {
    Criteria criteria = new Criteria("field_1").within(new Point(48.303056, 14.290556), new Distance(1, Metrics.MILES));
    Assert.assertEquals("{!geofilt pt=48.303056,14.290556 sfield=field_1 d=1.609344}",
        queryParser.createQueryStringFromCriteria(criteria));
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.solr.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.