How to use facet pivoting with paging?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

How to use facet pivoting with paging?

Georgios Petasis-2
Hi all,

I am performing a facet with pivot query. The result I get is correct,
but when I use "facet.offset=1" in the query, the results I get differ,
as in pivot removed.

Instead of getting:

     "facet_pivot":{
       "buyer.name,agreedPrice.hasCurrency.notation":[{
           "field":"buyer.name",
           "value":"KOMPANIA W\u0118GLOWA S.A.",
           "count":11228,
           "pivot":[{
               "field":"agreedPrice.hasCurrency.notation",
               "value":"EUR",
               "count":11084,
               "stats":{
                 "stats_fields":{
                   "agreedPrice.hasCurrencyValue":{
                     "sum":5.069190961199988E9}}}}],
           "stats":{
             "stats_fields":{
               "agreedPrice.hasCurrencyValue":{
                 "sum":5.069190961199988E9}}}},

I get:

"facet_pivot":{
       "buyer.name,agreedPrice.hasCurrency.notation":[{
           "field":"buyer.name",
           "value":"KOMPANIA W\u0118GLOWA S.A.",
           "count":11228,
           "stats":{
             "stats_fields":{
               "agreedPrice.hasCurrencyValue":{
                 "sum":5.069190961199988E9}}}},

There is no "pivot" element. Is there a way to use paging and get the
results I get with facet.offset=0?

I am using Solr 6.4.2

Regards,

George

Reply | Threaded
Open this post in threaded view
|

Re: How to use facet pivoting with paging?

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



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Reply | Threaded
Open this post in threaded view
|

Re: How to use facet pivoting with paging?

Emir Arnautović
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 <[hidden email]> 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

Reply | Threaded
Open this post in threaded view
|

Re: How to use facet pivoting with paging?

keenkiller
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
Reply | Threaded
Open this post in threaded view
|

Re: How to use facet pivoting with paging?

Emir Arnautović
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 <[hidden email]> 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

Reply | Threaded
Open this post in threaded view
|

Re: How to use facet pivoting with paging?

keenkiller
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
Reply | Threaded
Open this post in threaded view
|

Re: How to use facet pivoting with paging?

keenkiller
In reply to this post by Emir Arnautović
Oh, I got it. Thanks a lot!



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Reply | Threaded
Open this post in threaded view
|

Re: How to use facet pivoting with paging?

Emir Arnautović
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 <[hidden email]> wrote:
>
> Oh, I got it. Thanks a lot!
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html