You can only do this with some index time work. If you index the date
field rounded to the various levels you need, then you can pivot facet
on your rounded date. At present you will need to do this rounding in
your own indexing code before it gets near to Solr. However, I have
created some rounding UpdateProcessors [1] that would allow you to do
this within Solr itself.

It'd be great if these were included in 4.4 :-) (hint to committers)

Upayavira

[1] https://issues.apache.org/jira/browse/SOLR-4772



On Tue, Jun 25, 2013, at 11:14 AM, Jakob Frank wrote:
> Hi all,
> 
> is it possible using SOLR 4.3 to combine pivot-facets with (date) range
> facets?
> 
> Currently, what I get is sth. like
> 
> <lst name="facet_pivot">
>   <arr name="date,cat">
>     <lst>
>       <str name="field">date</str>
>       <date name="value">2001-06-19T20:31:12Z</date>
>       <int name="count">1</int>
>       <arr name="pivot"/>
>     </lst>
>     <lst>
>       <str name="field">date</str>
>       <date name="value">2001-06-20T09:40:35Z</date>
>       <int name="count">1</int>
>       <arr name="pivot">
>         <lst>
>           <str name="field">cat</str>
>           <str name="value">public</str>
>           <int name="count">1</int>
>         </lst>
>       </arr>
>     </lst>
>     ...
>   </arr>
> </lst>
> 
> I'd like to use the same mechanism like in facet.range with
> facet.range.start, facet.range.end and facet.range.gap. Is there
> something similar to have a result like:
> 
> <lst name="facet_pivot">
>   <arr name="date,cat">
>     <lst>
>       <str name="field">date</str>
>       <date name="value">2001-06-01T00:00:00Z</date>
>       <int name="count">36</int>
>       <arr name="pivot">
>         <lst>
>           <str name="field">cat</str>
>           <str name="value">public</str>
>           <int name="count">21</int>
>         </lst>
>         <lst>
>           <str name="field">cat</str>
>           <str name="value">private</str>
>           <int name="count">15</int>
>         </lst>
>      </arr>
>     </lst>
>     <lst>
>       <str name="field">date</str>
>       <date name="value">2001-07-01T00:00:00Z</date>
>       <int name="count">25</int>
>       <arr name="pivot">
>         <lst>
>           <str name="field">cat</str>
>           <str name="value">public</str>
>           <int name="count">19</int>
>         </lst>
>         <lst>
>           <str name="field">cat</str>
>           <str name="value">private</str>
>           <int name="count">6</int>
>         </lst>
>      </arr>
>    </lst>
>     ...
>   </arr>
> </lst>
> 
> Thanks,
> Jakob

Reply via email to