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/01/23 11:41:52 UTC

Re: How to use facet pivoting with paging?

I meet the same problem here. Can some one give any help?



--
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


Re: How to use facet pivoting with paging?

Posted by keenkiller <ya...@gmail.com>.
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 Emir Arnautović <em...@sematext.com>.
Hi,
Can you explain a bit more what is the issue? If you are talking of paging results, then it depends on your presentation layer - you can include facet numbers when returning the first page or ask for facets separately and for the next page you do not return facets and only refresh results. Or if your presentation layer cannot refresh only results, you ask for facets for every page. In any case you will get the same facet numbers - not only numbers for the page you are returning.

If you are asking about returning pages of facet results, then you have facet.offset and facet.limit parameters to return facet page.

HTH,
Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/



> On 23 Jan 2018, at 12:41, keenkiller <ya...@gmail.com> wrote:
> 
> I meet the same problem here. Can some one give any help?
> 
> 
> 
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html