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

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


    return getSolrOperations().queryForPage(query, Product.class);
  }

  @Override
  public FacetPage<Product> findByNameStartingWithAndFacetOnAvailable(String namePrefix) {
    FacetQuery query = new SimpleFacetQuery(new Criteria(SolrSearchableFields.NAME).startsWith(namePrefix));
    query.setFacetOptions(new FacetOptions(SolrSearchableFields.AVAILABLE));
    return getSolrOperations().queryForFacetPage(query, Product.class);
  }
View Full Code Here


    if (solrQueryMethod.isPageQuery() || solrQueryMethod.isSliceQuery()) {
      if (solrQueryMethod.isFacetQuery() && solrQueryMethod.isHighlightQuery()) {
        throw new InvalidDataAccessApiUsageException("Facet and Highlight cannot be combined.");
      }
      if (solrQueryMethod.isFacetQuery()) {
        FacetQuery facetQuery = SimpleFacetQuery.fromQuery(query, new SimpleFacetQuery());
        facetQuery.setFacetOptions(extractFacetOptions(solrQueryMethod, accessor));
        return new FacetPageExecution(accessor.getPageable()).execute(facetQuery);
      }
      if (solrQueryMethod.isHighlightQuery()) {
        HighlightQuery highlightQuery = SimpleHighlightQuery.fromQuery(query, new SimpleHighlightQuery());
        highlightQuery.setHighlightOptions(extractHighlightOptions(solrQueryMethod, accessor));
View Full Code Here

      values.add(createExampleBeanWithId(Integer.toString(i)));
    }
    solrTemplate.saveBeans(values);
    solrTemplate.commit();

    FacetQuery q = new SimpleFacetQuery(new Criteria(Criteria.WILDCARD).expression(Criteria.WILDCARD))
        .setFacetOptions(new FacetOptions().addFacetOnField("name").addFacetOnField("id").setFacetLimit(5));

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

    for (Page<FacetFieldEntry> facetResultPage : page.getFacetResultPages()) {
View Full Code Here

      values.add(createExampleBeanWithId(Integer.toString(i)));
    }
    solrTemplate.saveBeans(values);
    solrTemplate.commit();

    FacetQuery q = new SimpleFacetQuery(new Criteria(Criteria.WILDCARD).expression(Criteria.WILDCARD))
        .setFacetOptions(new FacetOptions().addFacetOnPivot("cat", "name"));

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

    List<FacetPivotFieldEntry> pivotEntries = page.getPivot("cat,name");
View Full Code Here

      values.add(bean);
    }
    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

    ExampleSolrBean language = new ExampleSolrBean("4", "java", "language");

    solrTemplate.saveBeans(Arrays.asList(season, framework, island, language));
    solrTemplate.commit();

    FacetQuery q = new SimpleFacetQuery(new Criteria(Criteria.WILDCARD).expression(Criteria.WILDCARD))
        .setFacetOptions(new FacetOptions().addFacetOnField("name").setFacetLimit(5).setFacetPrefix("spr"));

    FacetPage<ExampleSolrBean> page = solrTemplate.queryForFacetPage(q, ExampleSolrBean.class);
    Page<FacetFieldEntry> facetPage = page.getFacetResultPage(new SimpleField("name"));
    for (FacetFieldEntry entry : facetPage) {
View Full Code Here

    ExampleSolrBean island = new ExampleSolrBean("3", "java", "island");
    ExampleSolrBean language = new ExampleSolrBean("4", "java", "language");

    solrTemplate.saveBeans(Arrays.asList(season, framework, island, language));
    solrTemplate.commit();
    FacetQuery q = new SimpleFacetQuery(new Criteria(Criteria.WILDCARD).expression(Criteria.WILDCARD))
        .setFacetOptions(new FacetOptions().addFacetOnField(new FieldWithFacetParameters("name").setPrefix("spr"))
            .addFacetOnField("cat").setFacetPrefix("lan").setFacetLimit(5));

    FacetPage<ExampleSolrBean> page = solrTemplate.queryForFacetPage(q, ExampleSolrBean.class);
    Page<FacetFieldEntry> facetPage = page.getFacetResultPage(new SimpleField("name"));
View Full Code Here

    nl.add("sumOfSquares", sumOfSquares);
    return nl;
  }

  private FacetQuery createFacetQuery(SolrDataQuery... facetQueries) {
    FacetQuery fq = new SimpleFacetQuery(new SimpleStringCriteria("*:*"));
    fq.setFacetOptions(new FacetOptions(facetQueries));
    return fq;
  }
View Full Code Here

    fq.setFacetOptions(new FacetOptions(facetQueries));
    return fq;
  }

  private FacetQuery createFacetQuery(String... facetFields) {
    FacetQuery fq = new SimpleFacetQuery(new Criteria(facetFields[0]));
    fq.setFacetOptions(new FacetOptions(facetFields));
    return fq;
  }
View Full Code Here

    fq.setFacetOptions(new FacetOptions(facetFields));
    return fq;
  }

  private FacetQuery createFacetPivotQuery(String... pivotFieldNames) {
    FacetQuery fq = new SimpleFacetQuery(new Criteria("field_1"));
    fq.setFacetOptions(new FacetOptions().addFacetOnPivot(pivotFieldNames));
    return fq;
  }
View Full Code Here

TOP

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

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.