Examples of ExampleSolrBean


Examples of org.springframework.data.solr.ExampleSolrBean

    Assert.assertThat(result.getContent().get(0).getId(), Is.is(bean2.getId()));
  }

  @Test
  public void testFunctionQueryInFieldProjection() {
    ExampleSolrBean bean1 = new ExampleSolrBean("id-1", "one", null);
    bean1.setStore("45.17614,-93.87341");
    ExampleSolrBean bean2 = new ExampleSolrBean("id-2", "one two", null);
    bean2.setStore("40.7143,-74.006");

    solrTemplate.saveBeans(Arrays.asList(bean1, bean2));
    solrTemplate.commit();

    Query q = new SimpleQuery("*:*");
 
View Full Code Here

Examples of org.springframework.data.solr.ExampleSolrBean

  /**
   * @see DATASOLR-121
   */
  @Test
  public void testRegularGroupQuery() {
    solrTemplate.saveBean(new ExampleSolrBean("id_1", "name1", "category1", 2, true));
    solrTemplate.saveBean(new ExampleSolrBean("id_2", "name1", "category2"));
    solrTemplate.saveBean(new ExampleSolrBean("id_3", "name2", "category2", 1, true));
    solrTemplate.saveBean(new ExampleSolrBean("id_4", "name3", "category2"));
    solrTemplate.commit();

    Function f = IfFunction.when("inStock").then("1").otherwise("2");
    Query q1 = new SimpleQuery("cat:category2");
    Query q2 = new SimpleQuery("cat:category1");
View Full Code Here

Examples of org.springframework.data.solr.ExampleSolrBean

  /**
   * @see DATASOLR-121
   */
  @Test
  public void testGroupQueryWithFacets() {
    solrTemplate.saveBean(new ExampleSolrBean("id_1", "name1", "category1", 2, true));
    solrTemplate.saveBean(new ExampleSolrBean("id_2", "name1", "category1", 2, true));
    solrTemplate.saveBean(new ExampleSolrBean("id_3", "name1", "category1", 1, true));
    solrTemplate.saveBean(new ExampleSolrBean("id_4", "name2", "category2", 1, false));
    solrTemplate.saveBean(new ExampleSolrBean("id_5", "name2", "category2", 2, false));
    solrTemplate.saveBean(new ExampleSolrBean("id_6", "name2", "category1", 1, true));
    solrTemplate.commit();

    SimpleFacetQuery groupQuery = new SimpleFacetQuery(new SimpleStringCriteria("*:*"));
    GroupOptions groupOptions = new GroupOptions();
    groupQuery.setGroupOptions(groupOptions);
View Full Code Here

Examples of org.springframework.data.solr.ExampleSolrBean

   * @see DATASOLR-83
   */
  @Test
  public void testGetById() {

    ExampleSolrBean bean1 = new ExampleSolrBean("id-1", "one", null);
    ExampleSolrBean bean2 = new ExampleSolrBean("id-2", "two", null);
    solrTemplate.saveBeans(Arrays.asList(bean1, bean2));

    ExampleSolrBean beanReturned = solrTemplate.getById("id-1", ExampleSolrBean.class);

    Assert.assertEquals(bean1.getId(), beanReturned.getId());
  }
View Full Code Here

Examples of org.springframework.data.solr.ExampleSolrBean

   * @see DATASOLR-83
   */
  @Test
  public void testGetByIds() {

    ExampleSolrBean bean1 = new ExampleSolrBean("id-1", "one", null);
    ExampleSolrBean bean2 = new ExampleSolrBean("id-2", "two", null);
    solrTemplate.saveBeans(Arrays.asList(bean1, bean2));

    List<String> ids = Arrays.<String> asList("id-1", "id-2");
    Collection<ExampleSolrBean> beansReturned = solrTemplate.getById(ids, ExampleSolrBean.class);
    List<ExampleSolrBean> listBeansReturned = new ArrayList<ExampleSolrBean>(beansReturned);

    Assert.assertEquals(2, beansReturned.size());
    Assert.assertEquals(bean1.getId(), listBeansReturned.get(0).getId());
    Assert.assertEquals(bean2.getId(), listBeansReturned.get(1).getId());
  }
View Full Code Here

Examples of org.springframework.data.solr.ExampleSolrBean

   * @see DATASOLR-160
   */
  @Test
  public void testDistinctStatsRequest() {

    ExampleSolrBean bean1 = new ExampleSolrBean("id-1", "name1", null);
    bean1.setPrice(10);
    bean1.setPopularity(1);
    ExampleSolrBean bean2 = new ExampleSolrBean("id-2", "name2", null);
    bean2.setPrice(20);
    bean1.setPopularity(1);
    ExampleSolrBean bean3 = new ExampleSolrBean("id-3", "name3", null);
    bean3.setPrice(20);
    bean1.setPopularity(2);

    solrTemplate.saveBeans(Arrays.asList(bean1, bean2, bean3));
    solrTemplate.commit();

View Full Code Here

Examples of org.springframework.data.solr.ExampleSolrBean

    Assert.assertEquals(null, popularityStatResult.getDistinctCount());
  }

  private void executeAndCheckStatsRequest(StatsOptions statsOptions) {

    ExampleSolrBean bean1 = new ExampleSolrBean("id-1", "one", null);
    bean1.setPrice(10f);
    ExampleSolrBean bean2 = new ExampleSolrBean("id-2", "two", null);
    bean2.setPrice(20.5f);
    solrTemplate.saveBeans(Arrays.asList(bean1, bean2));
    solrTemplate.commit();

    SimpleQuery statsQuery = new SimpleQuery(new SimpleStringCriteria("*:*"));
    statsQuery.setStatsOptions(statsOptions);
 
View Full Code Here

Examples of org.springframework.data.solr.ExampleSolrBean

    repository.setSolrOperations(template);
  }

  @Test
  public void testBeanLifecyle() {
    ExampleSolrBean toInsert = createDefaultExampleBean();
    ExampleSolrBean savedBean = repository.save(toInsert);

    Assert.assertSame(toInsert, savedBean);

    Assert.assertTrue(repository.exists(savedBean.getId()));

    ExampleSolrBean retrieved = repository.findOne(savedBean.getId());
    Assert.assertNotNull(retrieved);
    Assert.assertTrue(EqualsBuilder.reflectionEquals(savedBean, retrieved, new String[] { "version" }));

    Assert.assertEquals(1, repository.count());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.