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 Thibaut Rizzi <th...@anyware-services.com> on 2014/03/28 14:22:59 UTC

(Date) Range faceting issue when start = end

Hello all,

I'm not sure if I am missing something of if this is a bug but I am 
facing an issue with the following scenario.

I am doing a range faceting on a date field with the following parameters :
facet.range.start = facet.range.end = a date
facet.range.gap = +1YEAR
facet.range.hardend = true
facet.range.include = lower, facet.range.include = edge
facet.range.other = all (for debugging purpose).

For the date I am using, one document should be matching, but in the 
response, counts are empty. However the between value coming from 
facet.range.other = all is 1.
I tried playing with facet.range.include but I never had something in 
counts. If I add 1ms to facet.range.end, the counts are well populated.

Do you think I might have missed something or may it be a real issue?

FWIW, here are the interesting parts of the response (JSON):

    end = start
    ||  "facet_ranges":{
           "last-modified":{
             "counts":[],
             "gap":"+1YEAR",
             "start":"2014-03-26T16:31:59.885Z",
             "end":"2014-03-26T16:31:59.885Z",
             "before":0,
             "after":0,
             "between":1
           }
         }

    end = start + 1ms
    |"facet_ranges":{
           "last-modified":{
             "counts":[
               "2014-03-26T16:31:59.885Z",
               1
             ],
             "gap":"+1YEAR",
             "start":"2014-03-26T16:31:59.885Z",
             "end":"2014-03-26T16:31:59.886Z",
             "before":0,
             "after":0,
             "between":1
           }
         }|

Thanks.




Re: (Date) Range faceting issue when start = end

Posted by Chris Hostetter <ho...@fucit.org>.
: I'm not sure if I am missing something of if this is a bug but I am facing an
: issue with the following scenario.

The specific scnerios you are descirbing is an interesting edge case -- 
but i believe it's working as designed.

basically the range generation logic that computes the set of "(low,high)" 
pairs stops once "end <= low" -- in your case, you are initially starting 
with "start==end", so the very first "low" range value is equal to 
"end", and no ranges are generated.

The "fix" to your situation, would require changing the logic to 
allow both the low & high values for a pair to be equal to each other 
-- but if we did that, then (in normal usage) where start < end, the 
logic for building up the ranges would always wind up generating an extra 
pair where low==high.

ie...

   facet.range.start = NOW/YEAR
   facet.range.end = NOW/YEAR+6MONTHS
   facet.range.gap = +1MONTH
   facet.rage.hardend = true

would result in ranges...

   2014-01-01,2014-02-01
   2014-02-01,2014-03-01
   2014-03-01,2014-04-01
   2014-04-01,2014-05-01
   2014-05-01,2014-06-01
   2014-06-01,2014-07-01
   2014-07-01,2014-07-01 <- unexpected.

Does that make sense?

I'm curous about your usecase though ... can you epxlain a little bit more 
about what you are doing?  i can't think of any reason to set start==end 
that wouldn't be better served using a simple facet.query -- so it kind of 
smells like an XY Problem...

https://people.apache.org/~hossman/#xyproblem

-Hoss
http://www.lucidworks.com/