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 Arvydas Silanskas <nm...@gmail.com> on 2019/02/17 15:57:37 UTC

Faceting filter tagging doesn't work in case where 0 matches are found

Good evening,

I am using facet json api to query aggregation data, and I don't care about
the returned documents themselves. One of the use cases I want to employ is
tagging filter queries for fields, and then exclude those filters when
faceting. My problem is, however, that in those cases where the filter has
0 matches, the facets aren't calculated at all.

I'm using dataset I found at
https://www.raspberry.nl/2010/12/29/solr-test-dataset/ . To illustrate --
this is an an example when filter doesn't filter out everything (working as
expected):

Request:
{
  "query": "*:*",
  "facet": {
    "latitude_f": {
      "type": "range",
      "start": -90,
      "facet": {
        "population": "sum(population_i)"
      },
      "domain": {
        "excludeTags": "latitude_f"
      },
      "gap": 10,
      "end": -70,
      "field": "latitude_f"
    }
  },
  "limit": 0,
  "filter": [
    "{!tag=latitude_f}latitude_f:[-80.0 TO -70.0]"
  ]
}

Response:

{
  "facets": {
    "count": 1,
    "latitude_f": {
      "buckets": [
        {
          "val": -90,
          "count": 0
        },
        {
          "val": -80,
          "count": 1,
          "population": 1258
        }
      ]
    }
  }
}


Example when filter filters everything out:

Request is the same, except the filter field value is

  "filter": [
    "{!tag=latitude_f}latitude_f:[-90.0 TO -80.0]"
  ]

and response is

 "facets":{
    "count":0}

. I'm returned no facets whatsoever. However I'd expect the response to be
the same as and for the first request, since the only one filter is used,
and is excluded in faceting.

Is this a bug? What are the workarounds for such problem?

Re: Faceting filter tagging doesn't work in case where 0 matches are found

Posted by Zheng Lin Edwin Yeo <ed...@gmail.com>.
Hi,

Which version of Solr are you using when you face this problem?

Regards,
Edwin

On Mon, 18 Feb 2019 at 15:43, Mikhail Khludnev <mk...@apache.org> wrote:

> Hello,
> I'm not sure but it sounds like an issue, would you mind to raise one at
> https://issues.apache.org/jira/projects/SOLR/ ?
>
> On Sun, Feb 17, 2019 at 6:57 PM Arvydas Silanskas <
> nma.arvydas.silanskas@gmail.com> wrote:
>
> > Good evening,
> >
> > I am using facet json api to query aggregation data, and I don't care
> about
> > the returned documents themselves. One of the use cases I want to employ
> is
> > tagging filter queries for fields, and then exclude those filters when
> > faceting. My problem is, however, that in those cases where the filter
> has
> > 0 matches, the facets aren't calculated at all.
> >
> > I'm using dataset I found at
> > https://www.raspberry.nl/2010/12/29/solr-test-dataset/ . To illustrate
> --
> > this is an an example when filter doesn't filter out everything (working
> as
> > expected):
> >
> > Request:
> > {
> >   "query": "*:*",
> >   "facet": {
> >     "latitude_f": {
> >       "type": "range",
> >       "start": -90,
> >       "facet": {
> >         "population": "sum(population_i)"
> >       },
> >       "domain": {
> >         "excludeTags": "latitude_f"
> >       },
> >       "gap": 10,
> >       "end": -70,
> >       "field": "latitude_f"
> >     }
> >   },
> >   "limit": 0,
> >   "filter": [
> >     "{!tag=latitude_f}latitude_f:[-80.0 TO -70.0]"
> >   ]
> > }
> >
> > Response:
> >
> > {
> >   "facets": {
> >     "count": 1,
> >     "latitude_f": {
> >       "buckets": [
> >         {
> >           "val": -90,
> >           "count": 0
> >         },
> >         {
> >           "val": -80,
> >           "count": 1,
> >           "population": 1258
> >         }
> >       ]
> >     }
> >   }
> > }
> >
> >
> > Example when filter filters everything out:
> >
> > Request is the same, except the filter field value is
> >
> >   "filter": [
> >     "{!tag=latitude_f}latitude_f:[-90.0 TO -80.0]"
> >   ]
> >
> > and response is
> >
> >  "facets":{
> >     "count":0}
> >
> > . I'm returned no facets whatsoever. However I'd expect the response to
> be
> > the same as and for the first request, since the only one filter is used,
> > and is excluded in faceting.
> >
> > Is this a bug? What are the workarounds for such problem?
> >
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>

Re: Faceting filter tagging doesn't work in case where 0 matches are found

Posted by Mikhail Khludnev <mk...@apache.org>.
I've consulted regarding this case. This is not an issue, you may bring
facet back adding not yet documented property processEmpty:true

On Mon, Feb 18, 2019 at 10:42 AM Mikhail Khludnev <mk...@apache.org> wrote:

> Hello,
> I'm not sure but it sounds like an issue, would you mind to raise one at
> https://issues.apache.org/jira/projects/SOLR/ ?
>
> On Sun, Feb 17, 2019 at 6:57 PM Arvydas Silanskas <
> nma.arvydas.silanskas@gmail.com> wrote:
>
>> Good evening,
>>
>> I am using facet json api to query aggregation data, and I don't care
>> about
>> the returned documents themselves. One of the use cases I want to employ
>> is
>> tagging filter queries for fields, and then exclude those filters when
>> faceting. My problem is, however, that in those cases where the filter has
>> 0 matches, the facets aren't calculated at all.
>>
>> I'm using dataset I found at
>> https://www.raspberry.nl/2010/12/29/solr-test-dataset/ . To illustrate --
>> this is an an example when filter doesn't filter out everything (working
>> as
>> expected):
>>
>> Request:
>> {
>>   "query": "*:*",
>>   "facet": {
>>     "latitude_f": {
>>       "type": "range",
>>       "start": -90,
>>       "facet": {
>>         "population": "sum(population_i)"
>>       },
>>       "domain": {
>>         "excludeTags": "latitude_f"
>>       },
>>       "gap": 10,
>>       "end": -70,
>>       "field": "latitude_f"
>>     }
>>   },
>>   "limit": 0,
>>   "filter": [
>>     "{!tag=latitude_f}latitude_f:[-80.0 TO -70.0]"
>>   ]
>> }
>>
>> Response:
>>
>> {
>>   "facets": {
>>     "count": 1,
>>     "latitude_f": {
>>       "buckets": [
>>         {
>>           "val": -90,
>>           "count": 0
>>         },
>>         {
>>           "val": -80,
>>           "count": 1,
>>           "population": 1258
>>         }
>>       ]
>>     }
>>   }
>> }
>>
>>
>> Example when filter filters everything out:
>>
>> Request is the same, except the filter field value is
>>
>>   "filter": [
>>     "{!tag=latitude_f}latitude_f:[-90.0 TO -80.0]"
>>   ]
>>
>> and response is
>>
>>  "facets":{
>>     "count":0}
>>
>> . I'm returned no facets whatsoever. However I'd expect the response to be
>> the same as and for the first request, since the only one filter is used,
>> and is excluded in faceting.
>>
>> Is this a bug? What are the workarounds for such problem?
>>
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>


-- 
Sincerely yours
Mikhail Khludnev

Re: Faceting filter tagging doesn't work in case where 0 matches are found

Posted by Mikhail Khludnev <mk...@apache.org>.
Hello,
I'm not sure but it sounds like an issue, would you mind to raise one at
https://issues.apache.org/jira/projects/SOLR/ ?

On Sun, Feb 17, 2019 at 6:57 PM Arvydas Silanskas <
nma.arvydas.silanskas@gmail.com> wrote:

> Good evening,
>
> I am using facet json api to query aggregation data, and I don't care about
> the returned documents themselves. One of the use cases I want to employ is
> tagging filter queries for fields, and then exclude those filters when
> faceting. My problem is, however, that in those cases where the filter has
> 0 matches, the facets aren't calculated at all.
>
> I'm using dataset I found at
> https://www.raspberry.nl/2010/12/29/solr-test-dataset/ . To illustrate --
> this is an an example when filter doesn't filter out everything (working as
> expected):
>
> Request:
> {
>   "query": "*:*",
>   "facet": {
>     "latitude_f": {
>       "type": "range",
>       "start": -90,
>       "facet": {
>         "population": "sum(population_i)"
>       },
>       "domain": {
>         "excludeTags": "latitude_f"
>       },
>       "gap": 10,
>       "end": -70,
>       "field": "latitude_f"
>     }
>   },
>   "limit": 0,
>   "filter": [
>     "{!tag=latitude_f}latitude_f:[-80.0 TO -70.0]"
>   ]
> }
>
> Response:
>
> {
>   "facets": {
>     "count": 1,
>     "latitude_f": {
>       "buckets": [
>         {
>           "val": -90,
>           "count": 0
>         },
>         {
>           "val": -80,
>           "count": 1,
>           "population": 1258
>         }
>       ]
>     }
>   }
> }
>
>
> Example when filter filters everything out:
>
> Request is the same, except the filter field value is
>
>   "filter": [
>     "{!tag=latitude_f}latitude_f:[-90.0 TO -80.0]"
>   ]
>
> and response is
>
>  "facets":{
>     "count":0}
>
> . I'm returned no facets whatsoever. However I'd expect the response to be
> the same as and for the first request, since the only one filter is used,
> and is excluded in faceting.
>
> Is this a bug? What are the workarounds for such problem?
>


-- 
Sincerely yours
Mikhail Khludnev