You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by uwdanny <uw...@gmail.com> on 2010/02/16 02:24:44 UTC

How to retrieve relevance "explain" info in code?

Hi, 

I was trying to get the detailed "explain" info in (java) code using the
APIs, see codes below,

-----------------
ResponseBuilder rb (from some inherited process function)
SolrIndexSearcher searcher = rb.req.getSearcher();
Query query = rb.getQuery();
Explanation epl = searcher.explain(query, docId) 
-----------------

here, the docId is a valid doc id, the query is a valid one as well
(verified in log); however, I always get back score 0.0 for any matching 
----
INFO: 0.0 = (NON-MATCH) Failure to meet condition(s) of required/prohibited
clause(s)
----

but if I issue the same query thru url with debugQuery=on, the explain
section shows the breakdown of the score correctly.

anything I'm missing here?

thanks,

- danny Z
-- 
View this message in context: http://old.nabble.com/How-to-retrieve-relevance-%22explain%22-info-in-code--tp27602530p27602530.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: How to retrieve relevance "debug/explain" info in code?

Posted by Erick Erickson <er...@gmail.com>.
Thanks for bringing closure.

Erick

On Tue, Feb 16, 2010 at 7:13 PM, uwdanny <uw...@gmail.com> wrote:

>
> update - found the answer
>
> API getExplainList in org.apache.solr.util.SolrPluginUtils
>
> works.
>
>
>
>
> uwdanny wrote:
> >
> > Hi,
> >
> > I was trying to get the detailed "explain" info in (java) code using the
> > APIs, see codes below,
> >
> > -----------------
> > ResponseBuilder rb (from some inherited process function)
> > SolrIndexSearcher searcher = rb.req.getSearcher();
> > Query query = rb.getQuery();
> > Explanation epl = searcher.explain(query, docId)
> > -----------------
> >
> > here, the docId is a valid doc id, the query is a valid one as well
> > (verified in log); however, I always get back score 0.0 for any matching
> > ----
> > INFO: 0.0 = (NON-MATCH) Failure to meet condition(s) of
> > required/prohibited clause(s)
> > ----
> >
> > but if I issue the same query thru url with debugQuery=on, the explain
> > section shows the breakdown of the score correctly.
> >
> > anything I'm missing here?
> >
> > thanks,
> >
> > - danny Z
> >
>
> --
> View this message in context:
> http://old.nabble.com/How-to-retrieve-relevance-%22debug-explain%22-info-in-code--tp27602530p27617278.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>

Re: How to retrieve relevance "debug/explain" info in code?

Posted by uwdanny <uw...@gmail.com>.
update - found the answer

API getExplainList in org.apache.solr.util.SolrPluginUtils 

works.




uwdanny wrote:
> 
> Hi, 
> 
> I was trying to get the detailed "explain" info in (java) code using the
> APIs, see codes below,
> 
> -----------------
> ResponseBuilder rb (from some inherited process function)
> SolrIndexSearcher searcher = rb.req.getSearcher();
> Query query = rb.getQuery();
> Explanation epl = searcher.explain(query, docId) 
> -----------------
> 
> here, the docId is a valid doc id, the query is a valid one as well
> (verified in log); however, I always get back score 0.0 for any matching 
> ----
> INFO: 0.0 = (NON-MATCH) Failure to meet condition(s) of
> required/prohibited clause(s)
> ----
> 
> but if I issue the same query thru url with debugQuery=on, the explain
> section shows the breakdown of the score correctly.
> 
> anything I'm missing here?
> 
> thanks,
> 
> - danny Z
> 

-- 
View this message in context: http://old.nabble.com/How-to-retrieve-relevance-%22debug-explain%22-info-in-code--tp27602530p27617278.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: How to retrieve relevance "debug/explain" info in code?

Posted by uwdanny <uw...@gmail.com>.
Hi erick, thanks for the reply.

my query url includes "debugQuery=on" and the result page is correctly
showing all the debug / explain info. the problem I'm facing is that I
cannot get the same debug/explain info in code. I've been trying
IndexSearcher.explain(Weight, int ) API, as well as Searcher.explain( Query,
int ) API, the methods (in code) always throw me 0.0 score, whereas on url
return page everything's fine.

appreciate the help =)



Erick Erickson wrote:
> 
> Any details? This is pretty ambiguous....
> 
> tacking debugQuery=true to a URL brings back some stuff....
> 
> in Lucene, IndexSearcher.explain()?
> 
> Erick
> 
> On Tue, Feb 16, 2010 at 1:21 PM, uwdanny <uw...@gmail.com> wrote:
> 
>>
>> any hints?
>> --
>> View this message in context:
>> http://old.nabble.com/How-to-retrieve-relevance-%22debug-explain%22-info-in-code--tp27602530p27612814.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/How-to-retrieve-relevance-%22debug-explain%22-info-in-code--tp27602530p27613601.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: How to retrieve relevance "debug/explain" info in code?

Posted by Erick Erickson <er...@gmail.com>.
Any details? This is pretty ambiguous....

tacking debugQuery=true to a URL brings back some stuff....

in Lucene, IndexSearcher.explain()?

Erick

On Tue, Feb 16, 2010 at 1:21 PM, uwdanny <uw...@gmail.com> wrote:

>
> any hints?
> --
> View this message in context:
> http://old.nabble.com/How-to-retrieve-relevance-%22debug-explain%22-info-in-code--tp27602530p27612814.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>

Re: How to retrieve relevance "debug/explain" info in code?

Posted by uwdanny <uw...@gmail.com>.
any hints?
-- 
View this message in context: http://old.nabble.com/How-to-retrieve-relevance-%22debug-explain%22-info-in-code--tp27602530p27612814.html
Sent from the Solr - User mailing list archive at Nabble.com.