Problem/Motivation

I get the following exception when starting Apache Solr with solrconfig.xml as supplied by the latest apachesolr Drupal module.

SEVERE: java.lang.NumberFormatException: For input string: "
       1
     "
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:470)
	at java.lang.Integer.<init>(Integer.java:636)
	at org.apache.solr.util.SolrPluginUtils.calculateMinShouldMatch(SolrPluginUtils.java:701)
	at org.apache.solr.util.SolrPluginUtils.setMinShouldMatch(SolrPluginUtils.java:662)
	at org.apache.solr.search.DisMaxQParser.getUserQuery(DisMaxQParser.java:205)
	at org.apache.solr.search.DisMaxQParser.addMainQuery(DisMaxQParser.java:162)
	at org.apache.solr.search.DisMaxQParser.parse(DisMaxQParser.java:78)
	at org.apache.solr.search.QParser.getQuery(QParser.java:142)
	at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:101)
	at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:173)
	at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
	at org.apache.solr.core.SolrCore.execute(SolrCore.java:1372)
	at org.apache.solr.core.QuerySenderListener.newSearcher(QuerySenderListener.java:54)
	at org.apache.solr.core.SolrCore$3.call(SolrCore.java:1181)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:679)

Fix

I was able to fix this by cleaning up a configuration value to remove prefixed and suffixed spacing.

CommentFileSizeAuthor
solr-exception.diff496 bytesthecarlhall

Comments

thecarlhall’s picture

This problem might be environmental but the fix should work in all JVMs.

$ java -version
java version "1.6.0_23"
OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre11-0ubuntu1.11.10)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)
nick_vh’s picture

Status: Needs review » Fixed

Good fix, committed this at once!

pwolanin’s picture

Version: 7.x-1.x-dev » 6.x-3.x-dev
Status: Fixed » Patch (to be ported)
nick_vh’s picture

Status: Patch (to be ported) » Closed (fixed)

Backport will start over with Beta15 as a reference. Closing this one

nick_vh’s picture

Committed to 6.x-3.x

shenzhuxi’s picture

Version: 6.x-3.x-dev » 7.x-1.x-dev

schema-solr3x.xml in 7.x-1.x also needs to be patched.

nick_vh’s picture

Done at once. Thanks for reporting!