You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by bengates <be...@aliceadsl.fr> on 2014/12/17 23:00:55 UTC

Exception writing document to the index; possible analysis error.

Hello everyone,

I'm losing my hair trying to add a simple document on a freshly installed
Solr core.
I'm running Solr 4.10.2 on jetty with the start.jar.

I have the following (managed) schema and my core has been reloaded :


Consider my core have 0 document. Now I'm trying to add a document via the
/update API command :


And here's the server reply :


What the hell am I doing wrong ?
Thank you for your help,
Ben



--
View this message in context: http://lucene.472066.n3.nabble.com/Exception-writing-document-to-the-index-possible-analysis-error-tp4174845.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: [Resolved] Exception writing document to the index; possible analysis error.

Posted by Shawn Heisey <ap...@elyograg.org>.
On 12/18/2014 1:30 AM, bengates wrote:
> Ok, sorry but the issue was located between my keyboard and my chair.
> 
> The field "_collection_id" is required in the schema and not filled in my
> update request.
> 
> As the exception didn't warn me about any required field, I didn't look at
> this.

The reason it didn't say anything about a required field is that you
have default="" in your schema field definitions, so when it's missing,
that is the value that gets used.  I did not really look at the schema
before, because the exception was understandable but did not say which
field was blank ... so I didn't know which field to look at in the schema.

The blank string is an invalid default for numeric fields.  The default
for that field type should be omitted entirely or set to a real value,
like 0, -1, -2147483648 (for integer), -9223372036854775808 (for long).
 If it were me, I would not have a default value, so that the field is
missing if it is not present in the input document.

Thanks,
Shawn


[Resolved] Exception writing document to the index; possible analysis error.

Posted by bengates <be...@aliceadsl.fr>.
Ok, sorry but the issue was located between my keyboard and my chair.

The field "_collection_id" is required in the schema and not filled in my
update request.

As the exception didn't warn me about any required field, I didn't look at
this.

Thanks anyway,
Ben



--
View this message in context: http://lucene.472066.n3.nabble.com/Exception-writing-document-to-the-index-possible-analysis-error-tp4174845p4174936.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Exception writing document to the index; possible analysis error.

Posted by bengates <be...@aliceadsl.fr>.
Hello,
Thanks for your reply.

That's what I understand when I look at the exception.

However, if you look at my XML update command, there's no empty string
anywhere. That's why I don't understand why this exception is raised.

Thanks,
Ben



--
View this message in context: http://lucene.472066.n3.nabble.com/Exception-writing-document-to-the-index-possible-analysis-error-tp4174845p4174932.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Exception writing document to the index; possible analysis error.

Posted by Shawn Heisey <ap...@elyograg.org>.
On 12/17/2014 3:00 PM, bengates wrote:
> I'm losing my hair trying to add a simple document on a freshly installed
> Solr core.
> I'm running Solr 4.10.2 on jetty with the start.jar.
>
> I have the following (managed) schema and my core has been reloaded :
>
>
> Consider my core have 0 document. Now I'm trying to add a document via the
> /update API command :
>
>
> And here's the server reply :
>
>
> What the hell am I doing wrong ?

All your XML was eaten by nabble when it sent this to the mailing list. 
I had to open the nabble forum to see it.  Here's the relevant portion
of the exception:

Caused by: java.lang.NumberFormatException: For input string: ""
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:504)
	at java.lang.Integer.parseInt(Integer.java:527)
	at org.apache.solr.schema.TrieField.createField(TrieField.java:600)

I think you have tried to index an empty string into a numeric field.  That's not going to work.  It must be a valid number, or you need to leave the field completely out.

Thanks,
Shawn