lbdremy/solr-node-client

Any way to mitigate specific errors caused by some field ?

bacloud23 opened this issue · 0 comments

Hi,
We have a basic schema but now extended to include some arbitrary keys, apparently Solr doesn't like schema-less and infer schema based on first inserted documents (as far as I understood).

So having such error when inserting documents (one only is erroneous):

Error: Request HTTP error 400: {
"responseHeader":{
"status":400,
"QTime":1},
"error":{
"metadata":[
"error-class","org.apache.solr.common.SolrException",
"root-error-class","org.apache.solr.common.SolrException"],
"msg":"ERROR: [doc=c24b6880-0000-11ec-b3d7-315ff10bc15c/expByDate#] Error adding field 'power_point'='17' msg=incompatible dimension (2) and values (17). Only 0 values specified",
"code":400}}

I wish not to ignore the erroneous document, but go back and modify it (removing the only field causing problems).

I can spot the field dynamically scanning the error message but is there a better way ? maybe a custom error because it is nearly impossible to parse the error reliably:
All I could do is to retrieve error.message which is a string, that I could not parse as a JSON anyhow.

or maybe in solrClient.add(data); itself, (like except a specific failing facet or field if I understand well).

of course insertion is simply:

await solrClient.add(data);
this.solrCommit();

Thanks again :)