Implementing Tagging and Excluding Filters with Solrj / Spring Data Solr

前端 未结 2 1877
礼貌的吻别
礼貌的吻别 2021-01-20 16:56

I am trying to implement a Solr Facet search with multi-select on a field. To take this example: http://docs.lucidworks.com/display/solr/Faceting#Faceting-LocalParametersfor

相关标签:
2条回答
  • 2021-01-20 17:13

    With link I can do this :-

    ModifiableSolrParams params = new ModifiableSolrParams();
    params.add("fq", "{!tag=dt}doctype:pdf");
    params.add("facet.field", "{!ex=dt}doctype");
    
    0 讨论(0)
  • 2021-01-20 17:18

    The following block should create the querystring you want.

    SimpleFacetQuery query = new SimpleFacetQuery(new SimpleStringCriteria("mainquery"))
      .addFilterQuery(new SimpleQuery(new Criteria("status").is("public")))
      .addFilterQuery(new SimpleQuery(new Criteria("{!tag=dt}doctype").is("pdf")));
    query.setFacetOptions(new FacetOptions("{!ex=dt}doctype"));
    
    solrTemplate.queryForFacetPage(query, YourBean.class);
    
    0 讨论(0)
提交回复
热议问题