You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by keenkiller <ya...@gmail.com> on 2018/02/01 03:09:53 UTC
Re: How to use facet pivoting with paging?
Sorry for late reply.
Just like the original post, if i set facet.offset=0, everything is OK. The
request is like:
GET
http://172.16.51.98:8983/solr/channel/select?q=channelType:1&rows=0&facet=true&facet.limit=1&facet.offset=0&facet.pivot=partnerId,partnerName&wt=json
And the response is:
{
"responseHeader": {
"zkConnected": true,
"status": 0,
"QTime": 7,
"params": {
"q": "channelType:1",
"facet.limit": "1",
"facet.pivot": "partnerId,partnerName",
"rows": "0",
"facet": "true",
"wt": "json",
"facet.offset": "0"
}
},
"response": {
"numFound": 238,
"start": 0,
"docs": []
},
"facet_counts": {
"facet_queries": {},
"facet_fields": {},
"facet_ranges": {},
"facet_intervals": {},
"facet_heatmaps": {},
"facet_pivot": {
"partnerId,partnerName": [
{
"field": "partnerId",
"value": 6028,
"count": 40,
"pivot": [
{
"field": "partnerName",
"value": "shanghai",
"count": 40
}
]
}
]
}
}
}
But when facet.offset > 0, the response is:
{
"responseHeader": {
"zkConnected": true,
"status": 0,
"QTime": 2,
"params": {
"q": "channelType:1",
"facet.limit": "1",
"facet.pivot": "partnerId,partnerName",
"rows": "0",
"facet": "true",
"wt": "json",
"facet.offset": "1"
}
},
"response": {
"numFound": 238,
"start": 0,
"docs": []
},
"facet_counts": {
"facet_queries": {},
"facet_fields": {},
"facet_ranges": {},
"facet_intervals": {},
"facet_heatmaps": {},
"facet_pivot": {
"partnerId,partnerName": [
{
"field": "partnerId",
"value": 505,
"count": 24
}
]
}
}
}
Here we lost pivot field in facet_pivot.
So, i don't know why and how to fix this problem.
--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Re: How to use facet pivoting with paging?
Posted by keenkiller <ya...@gmail.com>.
Oh, thanks for your help. I got it. I misunderstand the meaning of `offset`.
--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Re: How to use facet pivoting with paging?
Posted by Emir Arnautović <em...@sematext.com>.
You are welcome!
Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/
> On 1 Feb 2018, at 11:04, keenkiller <ya...@gmail.com> wrote:
>
> Oh, I got it. Thanks a lot!
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Re: How to use facet pivoting with paging?
Posted by keenkiller <ya...@gmail.com>.
Oh, I got it. Thanks a lot!
--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Re: How to use facet pivoting with paging?
Posted by Emir Arnautović <em...@sematext.com>.
Hi,
When you set facet.offset=1, it applies to all facets - it offsets both partnerId and partnerName by 1. Since you have only one name, it is empty.
What you should do is set offset only for partnerId facet by setting f.partnerId.facet.offset=1.
If this is your only usecase, you might consider indexing id-name as a single field and use regular facets on that field.
Thanks,
Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/
> On 1 Feb 2018, at 04:09, keenkiller <ya...@gmail.com> wrote:
>
> Sorry for late reply.
>
> Just like the original post, if i set facet.offset=0, everything is OK. The
> request is like:
>
> GET
> http://172.16.51.98:8983/solr/channel/select?q=channelType:1&rows=0&facet=true&facet.limit=1&facet.offset=0&facet.pivot=partnerId,partnerName&wt=json
>
> And the response is:
>
> {
> "responseHeader": {
> "zkConnected": true,
> "status": 0,
> "QTime": 7,
> "params": {
> "q": "channelType:1",
> "facet.limit": "1",
> "facet.pivot": "partnerId,partnerName",
> "rows": "0",
> "facet": "true",
> "wt": "json",
> "facet.offset": "0"
> }
> },
> "response": {
> "numFound": 238,
> "start": 0,
> "docs": []
> },
> "facet_counts": {
> "facet_queries": {},
> "facet_fields": {},
> "facet_ranges": {},
> "facet_intervals": {},
> "facet_heatmaps": {},
> "facet_pivot": {
> "partnerId,partnerName": [
> {
> "field": "partnerId",
> "value": 6028,
> "count": 40,
> "pivot": [
> {
> "field": "partnerName",
> "value": "shanghai",
> "count": 40
> }
> ]
> }
> ]
> }
> }
> }
>
> But when facet.offset > 0, the response is:
>
> {
> "responseHeader": {
> "zkConnected": true,
> "status": 0,
> "QTime": 2,
> "params": {
> "q": "channelType:1",
> "facet.limit": "1",
> "facet.pivot": "partnerId,partnerName",
> "rows": "0",
> "facet": "true",
> "wt": "json",
> "facet.offset": "1"
> }
> },
> "response": {
> "numFound": 238,
> "start": 0,
> "docs": []
> },
> "facet_counts": {
> "facet_queries": {},
> "facet_fields": {},
> "facet_ranges": {},
> "facet_intervals": {},
> "facet_heatmaps": {},
> "facet_pivot": {
> "partnerId,partnerName": [
> {
> "field": "partnerId",
> "value": 505,
> "count": 24
> }
> ]
> }
> }
> }
>
> Here we lost pivot field in facet_pivot.
>
> So, i don't know why and how to fix this problem.
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html