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

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


            new SolrPageRequest(0, itemCount)).addSort(sort), getEntityClass());
  }

  @Override
  public Iterable<T> findAll(Iterable<ID> ids) {
    org.springframework.data.solr.core.query.Query query = new SimpleQuery(new Criteria(this.idFieldName).in(ids));
    query.setPageRequest(new SolrPageRequest(0, (int) count(query)));

    return getSolrOperations().queryForPage(query, getEntityClass());
  }
View Full Code Here


    return getSolrOperations().queryForPage(query, getEntityClass());
  }

  @Override
  public long count() {
    return count(new SimpleQuery(new Criteria(Criteria.WILDCARD).expression(Criteria.WILDCARD)));
  }
View Full Code Here

    return getValue();
  }

  @Override
  public FilterQuery getQuery() {
    return new SimpleQuery(new SimpleStringCriteria(getValue()));
  }
View Full Code Here

      super(solrOperations, solrQueryMethod);
    }

    @Override
    protected Query createQuery(SolrParameterAccessor parameterAccessor) {
      return new SimpleQuery(new SimpleStringCriteria("fake:query"));
    }
View Full Code Here

  private void deleteAll() {
    SolrOperations template;
    try {
      template = createSolrTemplate();
      template.delete(new SimpleQuery(new SimpleStringCriteria("*:*")));
      template.commit();
    } catch (IOException e) {
      throw new RuntimeException(e);
    } catch (ParserConfigurationException e) {
      throw new RuntimeException(e);
View Full Code Here

        {
            ProductFunction.product(new Foo()).times(new SimpleField("field_1")).times(new Bar())
                .times(Long.valueOf(3)).times(new SimpleField("field_2")).build(),
            "{!func}product(foo(),field_1,bar(),3,field_2)" },
        { QueryFunction.query(new Criteria("field_1").is("value")), "{!func}query(field_1:value)" },
        { QueryFunction.query(new SimpleQuery(new Criteria("field_1").is("value"))), "{!func}query(field_1:value)" },
        { TermFrequencyFunction.termFequency("term").inField(new SimpleField("field_1")),
            "{!func}termfreq(field_1,term)" },
        { TermFrequencyFunction.termFequency("term").inField("field_1"), "{!func}termfreq(field_1,term)" } };
    return Arrays.asList(data);
  }
View Full Code Here

  @Test
  public void testBeanLifecycle() {
    ExampleSolrBean toInsert = createDefaultExampleBean();

    solrTemplate.saveBean(toInsert);
    ExampleSolrBean recalled = solrTemplate.queryForObject(new SimpleQuery(new Criteria("id").is("1")),
        ExampleSolrBean.class);
    Assert.assertNull(recalled);
    solrTemplate.commit();

    recalled = solrTemplate.queryForObject(new SimpleQuery(new Criteria("id").is("1")), ExampleSolrBean.class);
    Assert.assertEquals(toInsert.getId(), recalled.getId());

    solrTemplate.deleteById(toInsert.getId());
    recalled = solrTemplate.queryForObject(new SimpleQuery(new Criteria("id").is("1")), ExampleSolrBean.class);
    Assert.assertEquals(toInsert.getId(), recalled.getId());

    solrTemplate.commit();
    recalled = solrTemplate.queryForObject(new SimpleQuery(new Criteria("id").is("1")), ExampleSolrBean.class);
    Assert.assertNull(recalled);
  }
View Full Code Here

    solrTemplate.commit();

    Assert.assertEquals(10, solrTemplate.count(ALL_DOCUMENTS_QUERY));

    Page<ExampleSolrBean> recalled = solrTemplate.queryForPage(
        new SimpleQuery(new SimpleStringCriteria("popularity:5")), ExampleSolrBean.class);

    Assert.assertEquals(5, recalled.getNumberOfElements());

    for (ExampleSolrBean bean : recalled) {
      Assert.assertEquals("Category must not change on partial update", "category_" + bean.getId(), bean.getCategory()
View Full Code Here

  @Test
  public void testRollback() {
    ExampleSolrBean toInsert = createDefaultExampleBean();
    solrTemplate.saveBean(toInsert);
    ExampleSolrBean recalled = solrTemplate.queryForObject(new SimpleQuery(new Criteria("id").is("1")),
        ExampleSolrBean.class);
    Assert.assertNull(recalled);

    solrTemplate.rollback();
    recalled = solrTemplate.queryForObject(new SimpleQuery(new Criteria("id").is("1")), ExampleSolrBean.class);
    Assert.assertNull(recalled);
  }
View Full Code Here

    }
    solrTemplate.saveBeans(values);
    solrTemplate.commit();

    FacetQuery q = new SimpleFacetQuery(new SimpleStringCriteria("*:*"));
    q.setFacetOptions(new FacetOptions(new SimpleQuery(new SimpleStringCriteria("inStock:true")), new SimpleQuery(
        new SimpleStringCriteria("inStock:false"))));

    FacetPage<ExampleSolrBean> page = solrTemplate.queryForFacetPage(q, ExampleSolrBean.class);

    Page<FacetQueryEntry> facetQueryResultPage = page.getFacetQueryResult();
View Full Code Here

TOP

Related Classes of org.springframework.data.solr.core.query.SimpleQuery

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.