Re: [SolrNet] 400 Bad Request

316 views
Skip to first unread message

Ted Jardine

unread,
Aug 15, 2012, 2:45:14 PM8/15/12
to sol...@googlegroups.com
What's the specific error that you are getting? View the logs to see it. Likely you've got a mapping issue.

Of course, we're treating these snippets as very quick and dirty bits of code, correct? ;-)

Ted

On 15 August 2012 11:19, gswartz <gsw...@synergydatasystems.com> wrote:
I'm using the solr net to try and upgrade our job searching to use lucene.  The first code block works fine.  However the 2nd block of code throws a 400 Bad Request exception on the line where I call solr.Add(jobs[i]);  Anyone have any idea why?  Thanks.

/**********this works*****************/
static void Main(string[] args)
{
new SolrBaseRepository.Instance<Job>().Start();
var solr = ServiceLocator.Current.GetInstance<ISolrOperations<Job>>();

var options = new QueryOptions
{
Rows = 10, Start = 0
};

var qry = new SolrQuery("*:*");

foreach (var result in solr.Query(qry, options))
{
Console.WriteLine(result.PositionTitle);
}

Console.ReadLine();
}




/**********this doesn't work*****************/ 
static void Main(string[] args)
{
var jobs = GetJobs();

new SolrBaseRepository.Instance<Job>().Start();

var solr = ServiceLocator.Current.GetInstance<ISolrOperations<Job>>();

for (var i = 0; i < jobs.Count; i++)
{
solr.Add(jobs[i]);
if (i % 2 == 0)
solr.Commit();
}

solr.Commit();
solr.Optimize();

Console.ReadLine();
}

--
You received this message because you are subscribed to the Google Groups "SolrNet" group.
To view this discussion on the web visit https://groups.google.com/d/msg/solrnet/-/bln9GfIye3gJ.
To post to this group, send email to sol...@googlegroups.com.
To unsubscribe from this group, send email to solrnet+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/solrnet?hl=en.

gswartz

unread,
Aug 15, 2012, 3:50:54 PM8/15/12
to sol...@googlegroups.com
Thanks yes, these snippets are just proof of concept tests.  

In the tomcat configuration I've set the level of logging to debug but all I'm seeing in the latest updated log file is this - 127.0.0.1 - - [15/Aug/2012:15:48:30 -0400] "POST /solr/Jobs/update HTTP/1.1" 500 8152  
I then set the logging to error and I get this - 127.0.0.1 - - [15/Aug/2012:15:49:39 -0400] "POST /solr/Jobs/update HTTP/1.1" 500 8152

So, aside from the tomcat 7 logsin the logs folder, is there somewhere else I should look for the solr specific error?  Thanks.

gswartz

unread,
Aug 15, 2012, 4:33:38 PM8/15/12
to sol...@googlegroups.com
I think I'm starting to track this down but I'm not quite sure where to go from here.  I went back to the admin interface and got the following error. I restored the schema.xml to the default one and after restarting tomcat it worked fine.  I reverted to my previous schema, restarted tomcat and again, same error.  So obviously there's a problem with my schema file but I'm not sure what.  I'll attach that.


HTTP Status 500 - Severe errors in solr configuration. Check your log files for more detailed information on what may be wrong. If you want solr to continue after configuration errors, change: <abortOnConfigurationError>false</abortOnConfigurationError> in solr.xml ------------------------------------------------------------- org.apache.solr.common.SolrException at org.apache.solr.core.SolrCore.<init>(SolrCore.java:600) at org.apache.solr.core.CoreContainer.create(CoreContainer.java:480) at org.apache.solr.core.CoreContainer.load(CoreContainer.java:332) at org.apache.solr.core.CoreContainer.load(CoreContainer.java:216) at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:161) at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:96) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4650) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5306) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:963) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1600) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.apache.solr.common.SolrException: Error initializing QueryElevationComponent. at org.apache.solr.handler.component.QueryElevationComponent.inform(QueryElevationComponent.java:202) at org.apache.solr.core.SolrResourceLoader.inform(SolrResourceLoader.java:527) at org.apache.solr.core.SolrCore.<init>(SolrCore.java:594) ... 23 more Caused by: java.lang.NumberFormatException: For input string: "MA147LL/A" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at org.apache.solr.schema.TrieField.readableToIndexed(TrieField.java:291) at org.apache.solr.handler.component.QueryElevationComponent$ElevationObj.<init>(QueryElevationComponent.java:119) at org.apache.solr.handler.component.QueryElevationComponent.loadElevationMap(QueryElevationComponent.java:264) at org.apache.solr.handler.component.QueryElevationComponent.inform(QueryElevationComponent.java:186) ... 25 more

schema.xml

Mauricio Scheffer

unread,
Aug 15, 2012, 4:40:52 PM8/15/12
to sol...@googlegroups.com

Ken Foster

unread,
Aug 15, 2012, 4:43:22 PM8/15/12
to sol...@googlegroups.com
You are passing a string in a field you defined as integer.

MA147LL/A


To view this discussion on the web visit https://groups.google.com/d/msg/solrnet/-/mHfgcdpLnYsJ.

gswartz

unread,
Aug 15, 2012, 4:55:15 PM8/15/12
to sol...@googlegroups.com
I didn't realize that the uniqueKey had to be a string.  thanks!

Mauricio Scheffer

unread,
Aug 15, 2012, 9:25:12 PM8/15/12
to sol...@googlegroups.com
It *has* to be a string only if you're actually using the QueryElevationComponent. If you're not using it, just disable it.
Reply all
Reply to author
Forward
0 new messages