lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erick Erickson <erickerick...@gmail.com>
Subject Re: How to set default values for int fields
Date Thu, 07 Nov 2013 11:58:36 GMT
Uhhhh, put a valid number in your default, not the empty string? LIke
default="5"

Best,
Erick


On Thu, Nov 7, 2013 at 2:57 AM, manju16832003 <manju16832003@gmail.com>wrote:

> How do I set default value for int fields
> ex
>
> <field name="mileage" type="int" indexed="true" stored="true"
> multiValued="false" default=""/>
>
> While indexing lets say if I have not set the value for mileage, and solr
> tries to assign default value and it fails. Because *mileage* is of type
> int
> not string. It throws following exception
>
> 3656198 [http-bio-8080-exec-4] ERROR
> org.apache.solr.servlet.SolrDispatchFilter  –
> null:java.lang.NumberFormatException: For input string: ""
>         at
>
> java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
>         at java.lang.Integer.parseInt(Integer.java:493)
>         at java.lang.Integer.parseInt(Integer.java:514)
>         at org.apache.solr.schema.TrieField.createField(TrieField.java:592)
>         at
> org.apache.solr.schema.TrieField.createFields(TrieField.java:655)
>         at
> org.apache.solr.update.DocumentBuilder.addField(DocumentBuilder.java:186)
>         at
> org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:324)
>         at
>
> org.apache.solr.update.AddUpdateCommand.getLuceneDocument(AddUpdateCommand.java:73)
>         at
>
> org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:208)
>         at
>
> org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:69)
>         at
>
> org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:51)
>         at
>
> org.apache.solr.update.processor.DistributedUpdateProcessor.doLocalAdd(DistributedUpdateProcessor.java:519)
>         at
>
> org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:655)
>         at
>
> org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:398)
>         at
>
> org.apache.solr.update.processor.LogUpdateProcessor.processAdd(LogUpdateProcessorFactory.java:100)
>         at
> org.apache.solr.handler.loader.XMLLoader.processUpdate(XMLLoader.java:246)
>         at
> org.apache.solr.handler.loader.XMLLoader.load(XMLLoader.java:173)
>         at
>
> org.apache.solr.handler.UpdateRequestHandler$1.load(UpdateRequestHandler.java:92)
>         at
>
> org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:74)
>         at
>
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
>         at org.apache.solr.core.SolrCore.execute(SolrCore.java:1820)
>         at
>
> org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:656)
>         at
>
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:359)
>         at
>
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:155)
>         at
>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
>         at
>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>         at
>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
>         at
>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
>         at
>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
>         at
>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
>         at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
>         at
>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>         at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
>         at
>
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
>         at
>
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
>         at
>
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
>         at
>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
>         at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>         at java.lang.Thread.run(Thread.java:679)
>
> Also if I were to set default values for sting fields, it would be
> *default="null" and not null*.
>
> is there way to set default value of the field to *null instead of "null"*
>
> is there any solution?
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/How-to-set-default-values-for-int-fields-tp4099741.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message