Hi
For a given query and sort order, Solr returns the results(ordered based on
score and sort order) set along with facets(ordered in descending order of
buckets counts)

Is there any way to get the facets also in the same order as results/docs? I
tried with json facet, but I am not able to make it. 

In the below example, I sorted based on multiple fields, say, 'rank' and
'sales' and the first doc is sku: 123456, but the same is not returned in
the facets, but I want those SKUs to be part of the facets.

*Sample query:*
http://localhost:8983/solr/samplecollection/select?q=((group_id: ("g.0" OR
"g.1")) OR (!group_id: "g.46"))
AND
!(sku: 1000422 OR group_id: g.13) &json.facet={ sku: { type: terms, field:
sku, facet: { fc_ids: { type: terms, field: fc_id } } } }&sort=rank desc,
sales desc&fl=score *&rows=3
*Sample Response:*
"response": {
"numFound": 1998,
"start": 0,
"maxScore": 1.7779741,
"docs": [
{
"sku": "123456",
"group_id": "g.0",
"id": "123456.0",
"fc_id": "0",
"_version_": 1664396609960542200,
"score": 1.7779741
},
{
"sku": "366222",
"group_id": "g.0",
"id": "366222.0",
"fc_id": "0",
"_version_": 1664396609963688000,
"score": 1.7779741
},
{
"sku": "1000425",
"group_id": "g.0",
"id": "1000425.0",
"fc_id": "0",
"_version_": 1664396609964736500,
"score": 1.7779741
}
]
},
"facets": {
"count": 1998,
"sku": {
"buckets": [
{
"val": "1000425",
"count": 2,
"fc_ids": {
"buckets": [
{
"val": "0",
"count": 1
},
{
"val": "1",
"count": 1
}
]
}
},
{
"val": "100253356",
"count": 2,
"fc_ids": {
"buckets": [
{
"val": "0",
"count": 1
},
{
"val": "1",
"count": 1
}
]
}
}




--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Reply via email to