Solr
  1. Solr
  2. SOLR-1896

Add a Range QParser that makes it trivial to express range filters resulting from range faceting

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: query parsers
    • Labels:
      None

      Description

      It would be handy if there was a QParser designed specifically for ease of use in specifying fq params to filter on ranges generated when people want to drill down while doing numeric range faceting.

        Activity

        Hide
        Hoss Man added a comment -

        Proposed semantics:

        DateRangeQParser (aka: drange) with the following local params:

        • v (aka: the value to parse) = the lower bounds of the range
        • f = the field to use
        • u = the upper bounds of the range
        • g = a gap to add to the lower bound to compute the upper bound (ignored if "u" is set)
        • il = boolean indicating if the lower bound should be inclusive
        • iu - boolean indicating if the upper bound should be inclusive

        "f" and "v" are always mandatory, but if date faceting is enabled, and the field specified by "f" is one of the fields being faceted on, then...

        • g defaults to facet.date.gap
        • u defaults to facet.date.end if facet.date.hardend=true and facet.date.end < v+g
        • "before", "after" and "between" are considered valid values for the v param, and cause v & u to be set appropriately
        • il and iu default as needed to correspond to facet.date.include (see SOLR-397)

        If the field specified by "f" is not involved in date faceting, then either "u" or "g" are mandatory, and some sensible defaults can be used for il and iu (probably both "true")

        Example usage...

        Assuming we start with

        facet.date=bday & facet.date.start=NOW/YEAR & facet.date.end=NOW/YEAR+1YEAR &facet.date.gap=+1DAY
        

        Then these params would all be legal...

        filter on today...
          fq={drange f=bday}NOW/DAY
        
        filter on a specific day...
          fq={drange f=bday}2010-04-28T00:00:00Z
        
        filter on a ten day range starting today
          fq={drange f=bday g=+10DAYS}NOW/DAY
        
        filter on a field (unrelated to the faceting) for an 11 hour and 34 minute range 
        starting at a specific moment...
          fq={drange f=event g=+11HOURS+34MIN}2010-04-28T03:23:00Z
        
        filter on a field (unrelated to the faceting) for between two specific moments 
        specified by other params...
          fq={drange f=event u=$upper v=$lower} & lower=2010-03-06T01:57:00Z upper=2010-04-28T03:23:00Z
        
        
        Show
        Hoss Man added a comment - Proposed semantics: DateRangeQParser (aka: drange) with the following local params: v (aka: the value to parse) = the lower bounds of the range f = the field to use u = the upper bounds of the range g = a gap to add to the lower bound to compute the upper bound (ignored if "u" is set) il = boolean indicating if the lower bound should be inclusive iu - boolean indicating if the upper bound should be inclusive "f" and "v" are always mandatory, but if date faceting is enabled, and the field specified by "f" is one of the fields being faceted on, then... g defaults to facet.date.gap u defaults to facet.date.end if facet.date.hardend=true and facet.date.end < v+g "before", "after" and "between" are considered valid values for the v param, and cause v & u to be set appropriately il and iu default as needed to correspond to facet.date.include (see SOLR-397 ) If the field specified by "f" is not involved in date faceting, then either "u" or "g" are mandatory, and some sensible defaults can be used for il and iu (probably both "true") Example usage... Assuming we start with facet.date=bday & facet.date.start=NOW/YEAR & facet.date.end=NOW/YEAR+1YEAR &facet.date.gap=+1DAY Then these params would all be legal... filter on today... fq={drange f=bday}NOW/DAY filter on a specific day... fq={drange f=bday}2010-04-28T00:00:00Z filter on a ten day range starting today fq={drange f=bday g=+10DAYS}NOW/DAY filter on a field (unrelated to the faceting) for an 11 hour and 34 minute range starting at a specific moment... fq={drange f=event g=+11HOURS+34MIN}2010-04-28T03:23:00Z filter on a field (unrelated to the faceting) for between two specific moments specified by other params... fq={drange f=event u=$upper v=$lower} & lower=2010-03-06T01:57:00Z upper=2010-04-28T03:23:00Z
        Hide
        Hoss Man added a comment -

        generalizing issue summary/description to target general "range" faceting as introduced in SOLR-1240

        Show
        Hoss Man added a comment - generalizing issue summary/description to target general "range" faceting as introduced in SOLR-1240

          People

          • Assignee:
            Unassigned
            Reporter:
            Hoss Man
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development