Hi,

Nutch 1.3-dev seems to have changed its tstamp field from a long to a properly 
formatted Solr readable date/time but the example Solr schema for Nutch still 
configures the tstamp field as a long. This results in a formatted date/time 
in a long field, which i think should not be allowed in the first place by 
Solr.

<long name="tstamp">2011-04-19T08:16:31.675Z</long>

While the above is strange enough, i only found out it's all wrong when using 
the javabin format. The following query will throw an exception while using 
XML response writer works find and returns the tstamp as long but formatted as 
a proper date/time.

javabin:

curl 
"http://localhost:8983/solr/select?fl=id,boost,tstamp,digest&start=0&q=id:
\[*+TO+*\]&wt=javabin&rows=2&version=1"

Apr 19, 2011 10:34:50 AM org.apache.solr.request.BinaryResponseWriter$Resolver 
getDoc
WARNING: Error reading a field from document : 
SolrDocument[{digest=7ff92a31c58e43a34fd45bc6d87cda03}]
java.lang.NumberFormatException: For input string: "2011-04-19T08:16:31.675Z"
        at 
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
        at java.lang.Long.parseLong(Long.java:419)
        at java.lang.Long.valueOf(Long.java:525)
        at org.apache.solr.schema.LongField.toObject(LongField.java:82)
        at org.apache.solr.schema.LongField.toObject(LongField.java:33)
        at 
org.apache.solr.request.BinaryResponseWriter$Resolver.getDoc(BinaryResponseWriter.java:148)
        at 
org.apache.solr.request.BinaryResponseWriter$Resolver.writeDocList(BinaryResponseWriter.java:124)
        at 
org.apache.solr.request.BinaryResponseWriter$Resolver.resolve(BinaryResponseWriter.java:88)
        at 
org.apache.solr.common.util.JavaBinCodec.writeVal(JavaBinCodec.java:143)
        at 
org.apache.solr.common.util.JavaBinCodec.writeNamedList(JavaBinCodec.java:133)
        at 
org.apache.solr.common.util.JavaBinCodec.writeKnownType(JavaBinCodec.java:221)
        at 
org.apache.solr.common.util.JavaBinCodec.writeVal(JavaBinCodec.java:138)
        at 
org.apache.solr.common.util.JavaBinCodec.marshal(JavaBinCodec.java:87)
        at 
org.apache.solr.request.BinaryResponseWriter.write(BinaryResponseWriter.java:48)
        at 
org.apache.solr.servlet.SolrDispatchFilter.writeResponse(SolrDispatchFilter.java:322)
        at 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:254)
more trace from Jetty

Here's the wt=xml working fine and showing output for the tstamp field:

markus@midas:~$ curl 
"http://localhost:8983/solr/select?fl=id,boost,tstamp,digest&start=0&q=id:
\[*+TO+*\]&wt=xml&rows=2&version=1"

<?xml version="1.0" encoding="UTF-8"?>
<response>
<responseHeader><status>0</status><QTime>17</QTime>
<lst name="params">
<str name="fl">id,boost,tstamp,digest</str>
<str name="start">0</str>
<str name="q">id:[* TO *]</str>
<str name="wt">xml</str>
<str name="rows">2</str>
<str name="version">1</str><
/lst></responseHeader>
<result name="response" numFound="2" start="0">
<doc>
<str name="digest">478e77f99f7005ae71aa92a879be2fd4</str>
<str name="id">idfield</str>
<long name="tstamp">2011-04-19T08:16:31.689Z</long>
</doc>
<doc>
<str name="digest">7ff92a31c58e43a34fd45bc6d87cda03</str>
<str name="id">idfield</str>
<long name="tstamp">2011-04-19T08:16:31.675Z</long>
</doc>
</result>


Cheers,
-- 
Markus Jelsma - CTO - Openindex
http://www.linkedin.com/in/markus17
050-8536620 / 06-50258350

Reply via email to