Hi Chris ,

 

I did try what you suggested, but I am not getting the expected results. The
code is given below,

 

 

            SolrQuery query = new SolrQuery();

            query.set("q","apple");

            query.set("facet","true"); 

       

            query.set("facet.range", "createdOnGMTDate");

            query.set("facet.range.start", "2010-01-01T00:00:00Z") ;

            query.set("facet.range.gap", "+1DAY");

            

            QueryResponse qr = server.query(query);

            

            SolrDocumentList sdl = qr.getResults();

            

            System.out.println("Found: " + sdl.getNumFound());

            System.out.println("Start: " + sdl.getStart());

 

            System.out.println("-----------");

           

            List<FacetField> facets = qr.getFacetFields();

            

            for(FacetField facet : facets)

            {

                List<FacetField.Count> facetEntries = facet.getValues();

 

                for(FacetField.Count fcount : facetEntries)

                {

                    System.out.println(fcount.getName() + ": " +
fcount.getCount());

                }

            }       

 

Regards,

Rohit

 

-----Original Message-----
From: Chris Hostetter [mailto:hossman_luc...@fucit.org] 
Sent: 07 May 2011 04:36
To: solr-user@lucene.apache.org
Subject: RE: Solr: org.apache.solr.common.SolrException: Invalid Date
String:

 

 

: Thanks for the response, actually what we need to achive is see group by

: results based on dates like,

: 

: 2011-01-01  23

: 2011-01-02  14

: 2011-01-03  40

: 2011-01-04  10

: 

: Now the records in my table run into millions, grouping the result based
on

: UTC date would not produce the right result since the result should be

: grouped on users timezone.  Is there anyway we can achieve this in Solr?

 

Date faceting is entirely driven by query params, so if you index your 

events using the "true" time that they happend at (formatted as a string 

in UTC) you can then select your date ranges using whatever timezone 

offset is specified by your user at query time as a UTC offset.

 

      facet.range = dateField

      facet.range.start = 2011-01-01T00:00:00Z+${useroffset}MINUTES

      facet.range.gap = +1DAY

      etc...

 

 

-Hoss

Reply via email to