Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Declaring unique key as int in solr results in error

Tags:

solr

Declaring

<field name="id" type="int" indexed="true" stored="true" required="true" 
 multiValued="false" />

in schema.xml results in the following error.

 HTTP Status 500 - {msg=SolrCore 'collection1' is not available due to init failure:     Error initializing QueryElevationComponent.,trace=org.apache.solr.common.SolrException: SolrCore 'collection1' is not available due to init failure: Error initializing QueryElevationComponent. at 
    org.apache.solr.core.CoreContainer.getCore(CoreContainer.java:860) at 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:251) at 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:158) 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:222) at
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at 
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023) at 
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at 
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310) at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at 
java.lang.Thread.run(Thread.java:619) Caused by: org.apache.solr.common.SolrException: Error initializing QueryElevationComponent. at 
org.apache.solr.core.SolrCore.<init>(SolrCore.java:835) at 
org.apache.solr.core.SolrCore.<init>(SolrCore.java:629) at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:622) at 
org.apache.solr.core.CoreContainer.create(CoreContainer.java:657) at 
org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:364) at 
org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:356) at 
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at 
java.util.concurrent.FutureTask.run(FutureTask.java:138) at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at 
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at 
java.util.concurrent.FutureTask.run(FutureTask.java:138) 
... 3 more Caused by: org.apache.solr.common.SolrException: Error initializing QueryElevationComponent. at 
org.apache.solr.handler.component.QueryElevationComponent.inform(QueryElevationComponent.java:240) at 
org.apache.solr.core.SolrResourceLoader.inform(SolrResourceLoader.java:601) at 
org.apache.solr.core.SolrCore.<init>(SolrCore.java:830) 
... 13 more Caused by: java.lang.NumberFormatException: For input string: "MA147LL/A" at
 java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) at 
java.lang.Integer.parseInt(Integer.java:449) at java.lang.Integer.parseInt(Integer.java:499) at 
org.apache.solr.schema.TrieField.readableToIndexed(TrieField.java:387) at 
org.apache.solr.schema.TrieField.readableToIndexed(TrieField.java:378) at 
org.apache.solr.handler.component.QueryElevationComponent$ElevationObj.<init>(QueryElevationComponent.java:136) at 
org.apache.solr.handler.component.QueryElevationComponent.loadElevationMap(QueryElevationComponent.java:309) at 
org.apache.solr.handler.component.QueryElevationComponent.inform(QueryElevationComponent.java:223) ... 15 more ,code=500}

Can any one tell me why this is happening?

like image 417
user2852305 Avatar asked Oct 17 '13 07:10

user2852305


2 Answers

Go to elevate.xml @ SOLR_HOME\example\example-DIH\solr\solr\conf

modify it this way

<query text="ipod">
<!--   <doc id="MA147LL/A" />   put the actual ipod at the top 
   <doc id="IW-02" exclude="true" /> exclude this cable -->
 </query>

So, you actually comment out these two lines which are causing exception for you

<doc id="MA147LL/A" />   put the actual ipod at the top 
<doc id="IW-02" exclude="true" /> exclude this cable

I hope it solves your issue.

like image 113
prerna Keshari Avatar answered Oct 10 '22 00:10

prerna Keshari


You defined id as int and from the error message you are trying to add this content MA147LL/A to it (NumberFormatException: For input string: "MA147LL/A" at)..

so with the following line in you schema.xml

<field name="id" type="string" indexed="true" stored="true" 
 required="true" multiValued="false" />

you should be fine

like image 35
harpax Avatar answered Oct 09 '22 22:10

harpax