You'll need to wrap the date in quotes, since it contains a colon:

String a = "speechDate:\"1992-07-10T17:33:18Z\"";

-Michael

-----Original Message-----
From: Mirko Torrisi [mailto:mirko.torr...@ucdconnect.ie] 
Sent: Tuesday, March 10, 2015 3:34 PM
To: solr-user@lucene.apache.org
Subject: Invalid Date String:'1992-07-10T17'

Hi all,

I am very new with Solr (and Lucene) and I use the last version of it.
I do not understand why I obtain this:

    Exception in thread "main"
    org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error
    from server at http://localhost:8983/solr/Collection1: Invalid Date
    String:'1992-07-10T17'
         at
    
org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:558)
         at
    
org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:214)
         at
    
org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:210)
         at
    
org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:91)
         at
    org.apache.solr.client.solrj.SolrClient.query(SolrClient.java:302)
         at Update.main(Update.java:18)


Here the code that creates this error:

             SolrQuery query = new SolrQuery();
             String a = "speechDate:1992-07-10T17:33:18Z";
             query.set("fq", a);
             //query.setQuery( a );  <-- I also tried using this one.



According to
https://cwiki.apache.org/confluence/display/solr/Working+with+Dates, it should 
be right. I tried with others date, or just |YYYY-MM-DD, with no success.


My goal is to group these speeches (hopefully using date math syntax). I would 
like to know if you suggest me to use date or tdate or other because I have not 
understood the difference.


Thanks in advance,|

Mirko||

Reply via email to