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 Stefan Matheis <st...@mathe.is> on 2016/09/14 14:12:53 UTC

JSON Facets and excluded tags - not working for empty results

I’m not entirely sure i’m describing the correct problem here - for now it looks like the only way it occurs and i hope it’s not misleading any pointers that would be helpful. so in case you think i got it wrong, please say so

I have two documents in the index [{"source":"foo"}, {"source":"bar”}] where source is a simple string field (indexed as well as stored, if that’ll matter).

Using

> ?q=*:*
> &fq={!tag=source}source:"meh"
> &json.facet={"source":{"type":"terms","field":"source","domain":{"excludeTags":"source"}}}

where meh is a value that is not available for source, i get no results (expected) but no facets as well - which is rather unexpected to me. as soon as i go with source:”bar” (or something else that yields at least one record) i’m getting a record back and as well facets.

which is why i’ve started of with the idea that there might be a correlation between those things. verifying the situation using the old facet approach i always get the expected facets back, no matter if the result is empty or not.

Or isn’t it supposed to work like this anymore and i’m the guy who didn’t get the memo?

Thanks
Stefan


Re: JSON Facets and excluded tags - not working for empty results

Posted by Yonik Seeley <ys...@gmail.com>.
I opened
https://issues.apache.org/jira/browse/SOLR-9519

-Yonik


On Thu, Sep 15, 2016 at 9:17 AM, Yonik Seeley <ys...@gmail.com> wrote:
> On Wed, Sep 14, 2016 at 10:12 AM, Stefan Matheis <st...@mathe.is> wrote:
>> I’m not entirely sure i’m describing the correct problem here - for now it looks like the only way it occurs and i hope it’s not misleading any pointers that would be helpful. so in case you think i got it wrong, please say so
>>
>> I have two documents in the index [{"source":"foo"}, {"source":"bar”}] where source is a simple string field (indexed as well as stored, if that’ll matter).
>>
>> Using
>>
>>> ?q=*:*
>>> &fq={!tag=source}source:"meh"
>>> &json.facet={"source":{"type":"terms","field":"source","domain":{"excludeTags":"source"}}}
>>
>> where meh is a value that is not available for source, i get no results (expected) but no facets as well - which is rather unexpected to me. as soon as i go with source:”bar” (or something else that yields at least one record) i’m getting a record back and as well facets.
>
> A case this simple should be categorized as a bug...
>
> Background: the JSON Facet API does not execute sub-facets for a facet
> bucket with a 0 count (and the root facet bucket is like any other
> facet bucket).
> This was to help prevent the combinatorial explosion of deeply nested
> sub-facets with useless information.
>
> This is obviously incorrect though, when a sub-facet does something
> that can expand the domain rather than just restrict it.  Facet
> exclusions are one of these cases.
> For zero facet buckets, we should check if any sub-facets have these
> properties and then recurse if so.
>
> -Yonik
>
>
>> which is why i’ve started of with the idea that there might be a correlation between those things. verifying the situation using the old facet approach i always get the expected facets back, no matter if the result is empty or not.
>>
>> Or isn’t it supposed to work like this anymore and i’m the guy who didn’t get the memo?
>>
>> Thanks
>> Stefan
>>

Re: JSON Facets and excluded tags - not working for empty results

Posted by Yonik Seeley <ys...@gmail.com>.
On Wed, Sep 14, 2016 at 10:12 AM, Stefan Matheis <st...@mathe.is> wrote:
> I’m not entirely sure i’m describing the correct problem here - for now it looks like the only way it occurs and i hope it’s not misleading any pointers that would be helpful. so in case you think i got it wrong, please say so
>
> I have two documents in the index [{"source":"foo"}, {"source":"bar”}] where source is a simple string field (indexed as well as stored, if that’ll matter).
>
> Using
>
>> ?q=*:*
>> &fq={!tag=source}source:"meh"
>> &json.facet={"source":{"type":"terms","field":"source","domain":{"excludeTags":"source"}}}
>
> where meh is a value that is not available for source, i get no results (expected) but no facets as well - which is rather unexpected to me. as soon as i go with source:”bar” (or something else that yields at least one record) i’m getting a record back and as well facets.

A case this simple should be categorized as a bug...

Background: the JSON Facet API does not execute sub-facets for a facet
bucket with a 0 count (and the root facet bucket is like any other
facet bucket).
This was to help prevent the combinatorial explosion of deeply nested
sub-facets with useless information.

This is obviously incorrect though, when a sub-facet does something
that can expand the domain rather than just restrict it.  Facet
exclusions are one of these cases.
For zero facet buckets, we should check if any sub-facets have these
properties and then recurse if so.

-Yonik


> which is why i’ve started of with the idea that there might be a correlation between those things. verifying the situation using the old facet approach i always get the expected facets back, no matter if the result is empty or not.
>
> Or isn’t it supposed to work like this anymore and i’m the guy who didn’t get the memo?
>
> Thanks
> Stefan
>

Re: JSON Facets and excluded tags - not working for empty results

Posted by Stefan Matheis <st...@mathe.is>.
Thanks for the Pointer Mikhail,

i didn’t ;o i’ve seen it in some tests but i didn’t realize that it might help (now pretty obvious) .. and now i’m finding all the relevant threads as well.

Thanks again,
Stefan

On September 15, 2016 at 10:10:32 AM, Mikhail Khludnev (mkhl@apache.org) wrote:
> Hello Stefan,
> Have you tried to add processEmpty:true ?
>  
> json.facet={processEmpty:true,"source":{"type":"terms","field":"source","  
> domain":{"excludeTags":"source"}}}
>  
> On Wed, Sep 14, 2016 at 5:12 PM, Stefan Matheis wrote:
>  
> > I’m not entirely sure i’m describing the correct problem here - for now it
> > looks like the only way it occurs and i hope it’s not misleading any
> > pointers that would be helpful. so in case you think i got it wrong, please
> > say so
> >
> > I have two documents in the index [{"source":"foo"}, {"source":"bar”}]
> > where source is a simple string field (indexed as well as stored, if
> > that’ll matter).
> >
> > Using
> >
> > > ?q=*:*
> > > &fq={!tag=source}source:"meh"
> > > &json.facet={"source":{"type":"terms","field":"source","
> > domain":{"excludeTags":"source"}}}
> >
> > where meh is a value that is not available for source, i get no results
> > (expected) but no facets as well - which is rather unexpected to me. as
> > soon as i go with source:”bar” (or something else that yields at least one
> > record) i’m getting a record back and as well facets.
> >
> > which is why i’ve started of with the idea that there might be a
> > correlation between those things. verifying the situation using the old
> > facet approach i always get the expected facets back, no matter if the
> > result is empty or not.
> >
> > Or isn’t it supposed to work like this anymore and i’m the guy who didn’t
> > get the memo?
> >
> > Thanks
> > Stefan
> >
> >
>  
>  
> --
> Sincerely yours
> Mikhail Khludnev
>  


Re: JSON Facets and excluded tags - not working for empty results

Posted by Mikhail Khludnev <mk...@apache.org>.
Hello Stefan,
Have you tried to add processEmpty:true ?

json.facet={processEmpty:true,"source":{"type":"terms","field":"source","
domain":{"excludeTags":"source"}}}

On Wed, Sep 14, 2016 at 5:12 PM, Stefan Matheis <st...@mathe.is> wrote:

> I’m not entirely sure i’m describing the correct problem here - for now it
> looks like the only way it occurs and i hope it’s not misleading any
> pointers that would be helpful. so in case you think i got it wrong, please
> say so
>
> I have two documents in the index [{"source":"foo"}, {"source":"bar”}]
> where source is a simple string field (indexed as well as stored, if
> that’ll matter).
>
> Using
>
> > ?q=*:*
> > &fq={!tag=source}source:"meh"
> > &json.facet={"source":{"type":"terms","field":"source","
> domain":{"excludeTags":"source"}}}
>
> where meh is a value that is not available for source, i get no results
> (expected) but no facets as well - which is rather unexpected to me. as
> soon as i go with source:”bar” (or something else that yields at least one
> record) i’m getting a record back and as well facets.
>
> which is why i’ve started of with the idea that there might be a
> correlation between those things. verifying the situation using the old
> facet approach i always get the expected facets back, no matter if the
> result is empty or not.
>
> Or isn’t it supposed to work like this anymore and i’m the guy who didn’t
> get the memo?
>
> Thanks
> Stefan
>
>


-- 
Sincerely yours
Mikhail Khludnev