[ 
https://issues.apache.org/jira/browse/SOLR-2366?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12996341#comment-12996341
 ] 

Jan Høydahl commented on SOLR-2366:
-----------------------------------

+1 for using absolute values instead of gap values
+1 for keeping the bucket spec as a separate param, including start and end
+1 for letting the start/end in the spec automatically disable hardend

I wrote down some thoughts the other day which is almost exactly what Hoss 
suggests, only I called it facet.range.spec :) Was going to start another issue 
but now that the dicussion is rolling here, here we go.

The facet.range.spec must be intuitive and should include start, all absolute 
boundaries and end. Sample:

{code}
facet.range.spec=0,5,25,50,100,400 ==> 0-5, 5-25, 25-50, 50-100, 100-400.
{code}

To specify the gap size instead of next absolute threshold, we could have a +N 
syntax:
{code}
facet.range.spec=0,5,25,+25,+50,400
{code}
would be equivalent to the above absolute spec.

A +N value would repeat as many times as needed to reach the next absolute 
value:
{code}
facet.range.spec=0,5,+10,25,50,100,+100,400 ==> 0-5, 5-15, 15-25, 25-50, 
50-100, 100-200, 200-300, 300-400
facet.range.spec=0,5,+10,25,50,100,+100,400 ==> 0-5, 5-15, 15-25, 25-50, 
50-100, 100-200, 200-300, 300-400
{code}

Date example:
{code}
facet.range.spec=*,2000-01-01T00:00:00Z,+5YEARS,NOW/YEAR,+1MONTH,NOW
{code}
...gives a range before 2000, two 5-year ranges 2000-2005, 2005-2010, one range 
until start of this year 2010-2011, then monthly ranges for this year until now.

Now, having all this power of defining buckets available, it would be easy to 
introduce (i.e. feature creep :) a facet.range.labels param. Imagine:
{code}
facet.range.spec=NOW/MONTH-1MONTH,NOW/MONTH,NOW/DAY-1DAY,NOW/DAY,NOW/HOUR,NOW,*
facet.range.labels="Last month","This month","Yesterday","Today","This 
hour","Future"
{code}


> Facet Range Gaps
> ----------------
>
>                 Key: SOLR-2366
>                 URL: https://issues.apache.org/jira/browse/SOLR-2366
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Priority: Minor
>             Fix For: 3.2, 4.0
>
>         Attachments: SOLR-2366.patch, SOLR-2366.patch
>
>
> There really is no reason why the range gap for date and numeric faceting 
> needs to be evenly spaced.  For instance, if and when SOLR-1581 is completed 
> and one were doing spatial distance calculations, one could facet by function 
> into 3 different sized buckets: walking distance (0-5KM), driving distance 
> (5KM-150KM) and everything else (150KM+), for instance.  We should be able to 
> quantize the results into arbitrarily sized buckets.  I'd propose the syntax 
> to be a comma separated list of sizes for each bucket.  If only one value is 
> specified, then it behaves as it currently does.  Otherwise, it creates the 
> different size buckets.  If the number of buckets doesn't evenly divide up 
> the space, then the size of the last bucket specified is used to fill out the 
> remaining space (not sure on this)
> For instance,
> facet.range.start=0
> facet.range.end=400
> facet.range.gap=5,25,50,100
> would yield buckets of:
> 0-5,5-30,30-80,80-180,180-280,280-380,380-400

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to