tamaramata / solrnet

Automatically exported from code.google.com/p/solrnet
0 stars 0 forks source link

Nullpointer while parsing XML when using spellcheck #193

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi guys, I think i found a bug.

This is the code that give the nullpointer:

            Startup.Init<RADProduct>("http://maarten:8080/solr/coreProductsV2");
            ISolrOperations<RADProduct> SOLR = ServiceLocator.Current.GetInstance<ISolrOperations<RADProduct>>();

            var results = SOLR.Query("b", new QueryOptions
            {
                SpellCheck = new SpellCheckingParameters { Query = "b", Collate = false, Build = true },
                ExtraParams = new Dictionary<string, string> { 
                    { "qt", "/sitebox_nl" } 
                }
            });

I'm using solr.net v0.3.1 and solr v3.6.0

I've attached the full stacktrace, the solr xml output, my solr schema and my 
solr config.

I think this is a bug because the solr output looks fine, solr.net just doesn't 
seem to be able to parse the solr response.
But maybe i'm doing something wrong here...

Please help... thanks!

Original issue reported on code.google.com by maar...@rad.eu on 2 Oct 2012 at 9:12

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for the very detailed bug report. I'll take a look when I get some time.

Original comment by mauricio...@gmail.com on 2 Oct 2012 at 2:21

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I've noticed that when I add my spellcheck-component to the request handler, 
the <results> node disappears from the solr-xml-response...

This is because my spellcheck component is a Suggester.

Maybe solr.net is still looking for the <results>?

I had read issue #141 where it says this should work, hoping it would.

But as far is i can see the response is NOT the same as the normal 
SpellCheckComponent.
The Suggestor does not need to return any results since the actual search has 
yet to occur.

I sure hope you can confirm this as the problem :-)

I've attached two solr-outputs, one with and one without spellcheck.

Original comment by maar...@rad.eu on 2 Oct 2012 at 5:48

GoogleCodeExporter commented 8 years ago
You should set up the spellcheck component/suggester as a component of the 
default request handler. When you only want suggestions, simply query for *:* 
setting rows=0.

Original comment by mauricio...@gmail.com on 2 Oct 2012 at 6:40

GoogleCodeExporter commented 8 years ago
That's what I'm doing, attaching the component to the default request handler.
(Or at least I think that's what I'm doing)

Without the suggest component, SOLR returns <results> on that request handler,
But with the suggest component, the <results> just disappear.

I think it's normal SOLR behavior not to return <results> on any suggester.
(Again, I might be wrong, but every example I've seen is not returning 
<results>)

I've attached my solr config. Please take a look at the request handler with 
name="/sitebox_nl" and default="true" that has the suggest component attached 
to it.

Original comment by maar...@rad.eu on 3 Oct 2012 at 6:55

GoogleCodeExporter commented 8 years ago
It seems you're replacing the default components in the default request 
handler. Use "last-components" instead of "components". See 
http://wiki.apache.org/solr/SearchHandler#Search_Components for reference.

Original comment by mauricio...@gmail.com on 5 Oct 2012 at 1:52

GoogleCodeExporter commented 8 years ago
Confirmed!
Using "last-components" returns the <results>.

How dare I have doubted SolrNet :)
It officially supports Suggesters.

If you want me to write you a wiki-page on the subject, let me know.
I'm sure a lot of people would be happy to see that official page.

Thanks again!

Original comment by maar...@rad.eu on 5 Oct 2012 at 6:51

GoogleCodeExporter commented 8 years ago

Original comment by mauricio...@gmail.com on 2 Mar 2013 at 7:40