RE: Solr: org.apache.solr.common.SolrException: Invalid Date String:

2011-05-06 Thread Ahmet Arslan


--- On Fri, 5/6/11, Rohit ro...@in-rev.com wrote:

 From: Rohit ro...@in-rev.com
 Subject: RE: Solr: org.apache.solr.common.SolrException: Invalid Date String:
 To: solr-user@lucene.apache.org
 Date: Friday, May 6, 2011, 8:47 AM
 Hi Craig,
 
 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?

Easiest way can be create additional string typed field, and use copyField to 
populate it. (copy first 10 characters from (t)date into string)

And facet on that string field.  facet=onfacet.field=SDATE

field name=DATE type=tdate indexed=true stored=true/
field name=SDATE type=string indexed=true stored=true/

copyField source=DATE dest=SDATE maxChars=10/


RE: Solr: org.apache.solr.common.SolrException: Invalid Date String:

2011-05-06 Thread Rohit
Thanks Ahmet, let me give this a shot.

Regards,
Rohit



-Original Message-
From: Ahmet Arslan [mailto:iori...@yahoo.com] 
Sent: 06 May 2011 15:39
To: solr-user@lucene.apache.org
Subject: RE: Solr: org.apache.solr.common.SolrException: Invalid Date
String:



--- On Fri, 5/6/11, Rohit ro...@in-rev.com wrote:

 From: Rohit ro...@in-rev.com
 Subject: RE: Solr: org.apache.solr.common.SolrException: Invalid Date
String:
 To: solr-user@lucene.apache.org
 Date: Friday, May 6, 2011, 8:47 AM
 Hi Craig,
 
 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?

Easiest way can be create additional string typed field, and use copyField
to populate it. (copy first 10 characters from (t)date into string)

And facet on that string field.  facet=onfacet.field=SDATE

field name=DATE type=tdate indexed=true stored=true/
field name=SDATE type=string indexed=true stored=true/

copyField source=DATE dest=SDATE maxChars=10/



RE: Solr: org.apache.solr.common.SolrException: Invalid Date String:

2011-05-06 Thread Chris Hostetter

: 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


Re: Solr: org.apache.solr.common.SolrException: Invalid Date String:

2011-05-05 Thread Ahmet Arslan
 org.apache.solr.common.SolrException: Invalid Date
 String:'2011-01-07' at
 org.apache.solr.schema.DateField.parseMath(DateField.java:165)

Solr accepts date in the following format: 2011-01-07T00:00:00Z

 I understand from reading some articles that Solr stores
 time only in UTC,
 this is the query i am trying to index,

It seems that you are fetching data from a Relational Database. You may 
consider using http://wiki.apache.org/solr/DataImportHandler

 Why i am doing this timezone conversion is because i need
 to group results
 by the user timezone. How can i achieve this?

Save timezone info in a field and facet on that field?
http://wiki.apache.org/solr/SimpleFacetParameters


RE: Solr: org.apache.solr.common.SolrException: Invalid Date String:

2011-05-05 Thread Craig Stires

Rohit,

The solr server using TrieDateField must receive values in the format
2011-01-07T17:00:30Z

This should be a UTC-based datetime.  The offset can be applied once you get
your results back from solr
   SimpleDateFormat df =   new SimpleDateFormat(format);
   df.setTimeZone(TimeZone.getTimeZone(IST));
   java.util.Date dateunix = df.parse(datetime);


-Craig


-Original Message-
From: Rohit [mailto:ro...@in-rev.com] 
Sent: Friday, 6 May 2011 2:31 AM
To: solr-user@lucene.apache.org
Subject: Solr: org.apache.solr.common.SolrException: Invalid Date String:

Hi,

I am new to solr and this is my first attempt at indexing solr data, I am
getting the following exception while indexing,

org.apache.solr.common.SolrException: Invalid Date String:'2011-01-07' at
org.apache.solr.schema.DateField.parseMath(DateField.java:165) at
org.apache.solr.schema.TrieDateField.createField(TrieDateField.java:169) at
org.apache.solr.schema.SchemaField.createField(SchemaField.java:98) at
org.apache.solr.update.DocumentBuilder.addField(DocumentBuilder.java:204) at
org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:277)

I understand from reading some articles that Solr stores time only in UTC,
this is the query i am trying to index,

Select id,text,'language',links,tweetType,source,location,
bio,url,utcOffset,timeZone,frenCnt,createdAt,createdOnGMT,createdOnServerTim
e,follCnt,favCnt,totStatusCnt,usrCrtDate,humanSentiment,replied,replyMsg,cla
ssified,locationDetail,
geonameid,country,continent,placeLongitude,placeLatitude,listedCnt,hashtag,m
entions,senderInfScr,
createdOnGMTDate,DATE_FORMAT(CONVERT_TZ(createdOnGMTDate,'+00:00','+05:30'),
'%Y-%m-%d') as
IST,DATE_FORMAT(CONVERT_TZ(createdOnGMTDate,'+00:00','+01:00'),'%Y-%m-%d')
as
ECT,DATE_FORMAT(CONVERT_TZ(createdOnGMTDate,'+00:00','+02:00'),'%Y-%m-%d')
as
EET,DATE_FORMAT(CONVERT_TZ(createdOnGMTDate,'+00:00','+03:30'),'%Y-%m-%d')
as MET,sign(classified) as sentiment from

Why i am doing this timezone conversion is because i need to group results
by the user timezone. How can i achieve this?

Regards, Rohit

 




RE: Solr: org.apache.solr.common.SolrException: Invalid Date String:

2011-05-05 Thread Rohit
Hi Craig,

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?

Regards,
Rohit



-Original Message-
From: Craig Stires [mailto:craig.sti...@gmail.com] 
Sent: 06 May 2011 04:30
To: solr-user@lucene.apache.org
Subject: RE: Solr: org.apache.solr.common.SolrException: Invalid Date
String:


Rohit,

The solr server using TrieDateField must receive values in the format
2011-01-07T17:00:30Z

This should be a UTC-based datetime.  The offset can be applied once you get
your results back from solr
   SimpleDateFormat df =   new SimpleDateFormat(format);
   df.setTimeZone(TimeZone.getTimeZone(IST));
   java.util.Date dateunix = df.parse(datetime);


-Craig


-Original Message-
From: Rohit [mailto:ro...@in-rev.com] 
Sent: Friday, 6 May 2011 2:31 AM
To: solr-user@lucene.apache.org
Subject: Solr: org.apache.solr.common.SolrException: Invalid Date String:

Hi,

I am new to solr and this is my first attempt at indexing solr data, I am
getting the following exception while indexing,

org.apache.solr.common.SolrException: Invalid Date String:'2011-01-07' at
org.apache.solr.schema.DateField.parseMath(DateField.java:165) at
org.apache.solr.schema.TrieDateField.createField(TrieDateField.java:169) at
org.apache.solr.schema.SchemaField.createField(SchemaField.java:98) at
org.apache.solr.update.DocumentBuilder.addField(DocumentBuilder.java:204) at
org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:277)

I understand from reading some articles that Solr stores time only in UTC,
this is the query i am trying to index,

Select id,text,'language',links,tweetType,source,location,
bio,url,utcOffset,timeZone,frenCnt,createdAt,createdOnGMT,createdOnServerTim
e,follCnt,favCnt,totStatusCnt,usrCrtDate,humanSentiment,replied,replyMsg,cla
ssified,locationDetail,
geonameid,country,continent,placeLongitude,placeLatitude,listedCnt,hashtag,m
entions,senderInfScr,
createdOnGMTDate,DATE_FORMAT(CONVERT_TZ(createdOnGMTDate,'+00:00','+05:30'),
'%Y-%m-%d') as
IST,DATE_FORMAT(CONVERT_TZ(createdOnGMTDate,'+00:00','+01:00'),'%Y-%m-%d')
as
ECT,DATE_FORMAT(CONVERT_TZ(createdOnGMTDate,'+00:00','+02:00'),'%Y-%m-%d')
as
EET,DATE_FORMAT(CONVERT_TZ(createdOnGMTDate,'+00:00','+03:30'),'%Y-%m-%d')
as MET,sign(classified) as sentiment from

Why i am doing this timezone conversion is because i need to group results
by the user timezone. How can i achieve this?

Regards, Rohit