简体   繁体   中英

Faceting on values using solrj

Can someone please tell how to do faceting on facet values. Lets say i have categories field which has facet values ["Clothing","FootWear","Accessories"] .Based on the Facet field "categories" im able to get the facetcount in the Queryresponse. my response looks like this:

Input request: http://127.0.0.1:8080/solr/selectfacet?q= : &facet.field=categories

Response:

facet": [
    {
        "value": "Accessories",
        "count": ​2
    },
    {
        "value": "Clothing",
        "count": ​1
    },
    {
        "value": "Footwear",
        "count": ​1
    },
    {
        "value": "FootWear",
        "count": ​0
    }
]

What needs to be done if i need to choose only Footwear as facet field or Clothing as facet field. Also how to achieve multi select on 2 facet values and achieve the faceting using solrj api. Some example codes will really help and may be proper links.

You can specify parameter &fq=categories:Clothing,Accessories , so your query match only clothing field and facet would calculated base on matched result.

If your search query is different then require facet then using solr tag to exclude or include filter query condintion. see solr face wiki

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM