You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Danilo Tomasoni <to...@cosbi.eu> on 2025/10/07 07:59:54 UTC

Explain of explainOther

I have a complex query with edismax parser, involving several subqueries.
I attach a readable version of it.

I want to use the debugQuery=on and explainOther parameters to understand why a given id didn't match.
I expect to see something like "CTSS was in title, but you required also other conditions that are not met"
and I like to know which one of the conditions was not met for my document.

To debug, I performed this query with curl like this

curl  -X POST --data @payload.txt "https://mysolr/jupiter/select?wt=json&rows=0&indent=off&debugQuery=on&explainOther=id%3APUBMEDPMID35868042"

where payload.txt is attached (the urlencoded version of readable query basically)

If I look at the response (explain_response.json attached) I see:
...
"PUBMEDPMID35868042": "\n0.0 = No matching clauses\n"
...

Even if I run this other query:

id:PUBMEDPMID35868042 AND titles:ctss

returns the document, and this is a partial match in subquery9, so I should have at least a matching clause.

Can you tell me what's wrong in my reasoning?
thank you very much.

Danilo


[cid:fbe1916b-00a9-4dc8-b795-0883b9ce0f22]<https://www.cosbi.eu/>

Danilo Tomasoni

Data Scientist & Software Engineer

Intelligent systems for Computational Biology
+39 0464 808845

tomasoni@cosbi.eu<ma...@cosbi.eu>

www.cosbi.eu<http://www.cosbi.eu/>


[cid:613c951b-dfa4-4b2b-9c48-10a6f04a3836]<https://twitter.com/FoundationCosbi/>[cid:8a755dfd-51a7-45ab-9ced-3a1980333f80]<https://www.linkedin.com/company/cosbi/>


Re: R: Explain of explainOther

Posted by Chris Hostetter <ho...@fucit.org>.
: Thank you very much for your explanation.
: I understand now.
: I thought explainOther would explain also why a document is not in the resultset,
: on the contrary, it explains only why a given document is in the result set.

The main advantage of explainOther (today) is that it let's you pick an 
"other" document that is not in the current *PAGE* of results, and see 
what it's score is (Example: to help you see why something you think 
should be high scoring isn't in the top 10)

Ideally it would *also* let you see why something doesn't match -- it 
was able to do a little bit of that back in really early versions of 
Solr -- but the explain() implementation in all of the core Lucene classes
were "streamlined" over the years to not bother with the 
recursive "details" of an Explanation instance (which is where "matches 
this clause but not this clause" type information live) when a document 
doesn't match the overall query.


-Hoss
http://www.lucidworks.com/

R: Explain of explainOther

Posted by Danilo Tomasoni <to...@cosbi.eu>.
Thank you very much for your explanation.
I understand now.
I thought explainOther would explain also why a document is not in the resultset,
on the contrary, it explains only why a given document is in the result set.

Thank you
Danilo

[cid:b3d50a32-cc6d-4ee9-a258-74ac05628882]<https://www.cosbi.eu/>

Danilo Tomasoni

Data Scientist & Software Engineer

Intelligent systems for Computational Biology
+39 0464 808845

tomasoni@cosbi.eu<ma...@cosbi.eu>

www.cosbi.eu<http://www.cosbi.eu/>


[cid:64c1ddf0-8a13-4580-9d19-4e6fd667dcf7]<https://twitter.com/FoundationCosbi/>[cid:0db14bbd-e71d-48c6-ac3e-26da55b16b15]<https://www.linkedin.com/company/cosbi/>

________________________________
Da: Mikhail Khludnev <mk...@apache.org>
Inviato: mercoledì 8 ottobre 2025 11:17
A: users@solr.apache.org <us...@solr.apache.org>
Oggetto: Re: Explain of explainOther

[CAUTION: EXTERNAL SENDER]
[Please check correspondence between Sender Display Name and Sender Email Address before clicking on any link or opening attachments]

At glance, AND requires both subqueries to match and OR accepts even only one of them.
So, the part of the query, which you *don't* see in expalinOther, kicks out the doc from the AND query results.

On Wed, Oct 8, 2025 at 11:49 AM Danilo Tomasoni <to...@cosbi.eu>> wrote:
Thank you Mikhail,
your changes made a lot of sense.

I removed the extra df parameter, and nothing changed w.r.t. the query results (but I saved some bytes)
I changed the main AND with an OR and now I get the response I was looking for,
you can see it attached , it's the output of

$ jq -r '.debug.explainOther.PUBMEDPMID35868042' explain_response.json

So the question now is, why if it is an AND I don't get the same answer?

With the OR query, this document is in the result set, while it's not with the original AND query.

Thank you very much for your help.
Danilo

[cid:ii_199c319b2124a7a2e9e1]<https://www.cosbi.eu/>

Danilo Tomasoni

Data Scientist & Software Engineer

Intelligent systems for Computational Biology
+39 0464 808845

tomasoni@cosbi.eu<ma...@cosbi.eu>

www.cosbi.eu<http://www.cosbi.eu/>


[cid:ii_199c319b213342cbc4d2]<https://twitter.com/FoundationCosbi/>[cid:ii_199c319b213dd8350793]<https://www.linkedin.com/company/cosbi/>

________________________________
Da: Mikhail Khludnev <mk...@apache.org>>
Inviato: martedì 7 ottobre 2025 19:06
A: users@solr.apache.org<ma...@solr.apache.org> <us...@solr.apache.org>>
Oggetto: Re: Explain of explainOther

[CAUTION: EXTERNAL SENDER]
[Please check correspondence between Sender Display Name and Sender Email Address before clicking on any link or opening attachments]

Hello Danilo
It's really long to analyze. A few thoughts:
 - it seems like the query consist of two main subqueries combined by AND. Just for experiment, can you change it to OR? Providing the response "No matching clauses" neither of them matches. If it's true, you may drill down them one by one.
 - I spotted many fields under df param. But it's qf syntax, df accepts single field and handled by standard parser.
--
Mikhail

On Tue, Oct 7, 2025 at 11:01 AM Danilo Tomasoni <to...@cosbi.eu>> wrote:
I have a complex query with edismax parser, involving several subqueries.
I attach a readable version of it.

I want to use the debugQuery=on and explainOther parameters to understand why a given id didn't match.
I expect to see something like "CTSS was in title, but you required also other conditions that are not met"
and I like to know which one of the conditions was not met for my document.

To debug, I performed this query with curl like this

curl  -X POST --data @payload.txt "https://mysolr/jupiter/select?wt=json&rows=0&indent=off&debugQuery=on&explainOther=id%3APUBMEDPMID35868042"

where payload.txt is attached (the urlencoded version of readable query basically)

If I look at the response (explain_response.json attached) I see:
...
"PUBMEDPMID35868042": "\n0.0 = No matching clauses\n"
...

Even if I run this other query:

id:PUBMEDPMID35868042 AND titles:ctss

returns the document, and this is a partial match in subquery9, so I should have at least a matching clause.

Can you tell me what's wrong in my reasoning?
thank you very much.

Danilo


[X]<https://www.cosbi.eu/>

Danilo Tomasoni

Data Scientist & Software Engineer

Intelligent systems for Computational Biology
+39 0464 808845

tomasoni@cosbi.eu<ma...@cosbi.eu>

www.cosbi.eu<http://www.cosbi.eu/>


[X]<https://twitter.com/FoundationCosbi/>[X]<https://www.linkedin.com/company/cosbi/>



--
Sincerely yours
Mikhail Khludnev


--
Sincerely yours
Mikhail Khludnev

Re: Explain of explainOther

Posted by Mikhail Khludnev <mk...@apache.org>.
At glance, AND requires both subqueries to match and OR accepts even only
one of them.
So, the part of the query, which you *don't* see in expalinOther, kicks out
the doc from the AND query results.

On Wed, Oct 8, 2025 at 11:49 AM Danilo Tomasoni <to...@cosbi.eu> wrote:

> Thank you Mikhail,
> your changes made a lot of sense.
>
> I removed the extra df parameter, and nothing changed w.r.t. the query
> results (but I saved some bytes)
> I changed the main AND with an OR and now I get the response I was looking
> for,
> you can see it attached , it's the output of
>
> $ jq -r '.debug.explainOther.PUBMEDPMID35868042' explain_response.json
>
> So the question now is, *why if it is an AND I don't get the same answer*?
>
> With the OR query, this document is in the result set, while it's not with
> the original AND query.
>
> Thank you very much for your help.
> Danilo
>
> <https://www.cosbi.eu/>
>
> Danilo Tomasoni
>
> Data Scientist & Software Engineer
> Intelligent systems for Computational Biology
> +39 0464 808845
>
> tomasoni@cosbi.eu
>
> www.cosbi.eu
>
> <https://twitter.com/FoundationCosbi/>
> <https://www.linkedin.com/company/cosbi/>
>
> ------------------------------
> *Da:* Mikhail Khludnev <mk...@apache.org>
> *Inviato:* martedì 7 ottobre 2025 19:06
> *A:* users@solr.apache.org <us...@solr.apache.org>
> *Oggetto:* Re: Explain of explainOther
>
> [CAUTION: EXTERNAL SENDER]
> [Please check correspondence between Sender Display Name and Sender Email
> Address before clicking on any link or opening attachments]
>
> Hello Danilo
> It's really long to analyze. A few thoughts:
>  - it seems like the query consist of two main subqueries combined by AND.
> Just for experiment, can you change it to OR? Providing the response "No
> matching clauses" neither of them matches. If it's true, you may drill down
> them one by one.
>  - I spotted many fields under df param. But it's qf syntax, df accepts
> single field and handled by standard parser.
> --
> Mikhail
>
> On Tue, Oct 7, 2025 at 11:01 AM Danilo Tomasoni <to...@cosbi.eu> wrote:
>
> I have a complex query with edismax parser, involving several subqueries.
> I attach a readable version of it.
>
> I want to use the debugQuery=on and explainOther parameters to understand
> why a given id didn't match.
> I expect to see something like "CTSS was in title, but you required also
> other conditions that are not met"
> and I like to know which one of the conditions was not met for my document.
>
> To debug, I performed this query with curl like this
>
> curl  -X POST --data @payload.txt "
> https://mysolr/jupiter/select?wt=json&rows=0&indent=off&debugQuery=on&explainOther=id%3APUBMEDPMID35868042
> "
>
> where payload.txt is attached (the urlencoded version of readable query
> basically)
>
> If I look at the response (explain_response.json attached) I see:
> ...
> "PUBMEDPMID35868042": "\n0.0 = No matching clauses\n"
> ...
>
> Even if I run this other query:
>
> id:PUBMEDPMID35868042 AND titles:ctss
>
> returns the document, and this is a partial match in subquery9, so I
> should have at least a matching clause.
>
> Can you tell me what's wrong in my reasoning?
> thank you very much.
>
> Danilo
>
>
> <https://www.cosbi.eu/>
>
> Danilo Tomasoni
>
> Data Scientist & Software Engineer
> Intelligent systems for Computational Biology
> +39 0464 808845
>
> tomasoni@cosbi.eu
>
> www.cosbi.eu
>
> <https://twitter.com/FoundationCosbi/>
> <https://www.linkedin.com/company/cosbi/>
>
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>


-- 
Sincerely yours
Mikhail Khludnev

R: Explain of explainOther

Posted by Danilo Tomasoni <to...@cosbi.eu>.
Thank you Mikhail,
your changes made a lot of sense.

I removed the extra df parameter, and nothing changed w.r.t. the query results (but I saved some bytes)
I changed the main AND with an OR and now I get the response I was looking for,
you can see it attached , it's the output of

$ jq -r '.debug.explainOther.PUBMEDPMID35868042' explain_response.json

So the question now is, why if it is an AND I don't get the same answer?

With the OR query, this document is in the result set, while it's not with the original AND query.

Thank you very much for your help.
Danilo

[cid:98614089-a78a-443b-8202-ceedc7e343aa]<https://www.cosbi.eu/>

Danilo Tomasoni

Data Scientist & Software Engineer

Intelligent systems for Computational Biology
+39 0464 808845

tomasoni@cosbi.eu<ma...@cosbi.eu>

www.cosbi.eu<http://www.cosbi.eu/>


[cid:3a0a6356-0b46-44c9-a024-2fe136ac3854]<https://twitter.com/FoundationCosbi/>[cid:2620f6c6-2371-40c6-951a-91869f312b46]<https://www.linkedin.com/company/cosbi/>

________________________________
Da: Mikhail Khludnev <mk...@apache.org>
Inviato: martedì 7 ottobre 2025 19:06
A: users@solr.apache.org <us...@solr.apache.org>
Oggetto: Re: Explain of explainOther

[CAUTION: EXTERNAL SENDER]
[Please check correspondence between Sender Display Name and Sender Email Address before clicking on any link or opening attachments]

Hello Danilo
It's really long to analyze. A few thoughts:
 - it seems like the query consist of two main subqueries combined by AND. Just for experiment, can you change it to OR? Providing the response "No matching clauses" neither of them matches. If it's true, you may drill down them one by one.
 - I spotted many fields under df param. But it's qf syntax, df accepts single field and handled by standard parser.
--
Mikhail

On Tue, Oct 7, 2025 at 11:01 AM Danilo Tomasoni <to...@cosbi.eu>> wrote:
I have a complex query with edismax parser, involving several subqueries.
I attach a readable version of it.

I want to use the debugQuery=on and explainOther parameters to understand why a given id didn't match.
I expect to see something like "CTSS was in title, but you required also other conditions that are not met"
and I like to know which one of the conditions was not met for my document.

To debug, I performed this query with curl like this

curl  -X POST --data @payload.txt "https://mysolr/jupiter/select?wt=json&rows=0&indent=off&debugQuery=on&explainOther=id%3APUBMEDPMID35868042"

where payload.txt is attached (the urlencoded version of readable query basically)

If I look at the response (explain_response.json attached) I see:
...
"PUBMEDPMID35868042": "\n0.0 = No matching clauses\n"
...

Even if I run this other query:

id:PUBMEDPMID35868042 AND titles:ctss

returns the document, and this is a partial match in subquery9, so I should have at least a matching clause.

Can you tell me what's wrong in my reasoning?
thank you very much.

Danilo


[cid:ii_199bfa033526d4b27131]<https://www.cosbi.eu/>

Danilo Tomasoni

Data Scientist & Software Engineer

Intelligent systems for Computational Biology
+39 0464 808845

tomasoni@cosbi.eu<ma...@cosbi.eu>

www.cosbi.eu<http://www.cosbi.eu/>


[cid:ii_199bfa03353fa78734e2]<https://twitter.com/FoundationCosbi/>[cid:ii_199bfa0335382ae04ca3]<https://www.linkedin.com/company/cosbi/>



--
Sincerely yours
Mikhail Khludnev

Re: Explain of explainOther

Posted by Mikhail Khludnev <mk...@apache.org>.
Hello Danilo
It's really long to analyze. A few thoughts:
 - it seems like the query consist of two main subqueries combined by AND.
Just for experiment, can you change it to OR? Providing the response "No
matching clauses" neither of them matches. If it's true, you may drill down
them one by one.
 - I spotted many fields under df param. But it's qf syntax, df accepts
single field and handled by standard parser.
--
Mikhail

On Tue, Oct 7, 2025 at 11:01 AM Danilo Tomasoni <to...@cosbi.eu> wrote:

> I have a complex query with edismax parser, involving several subqueries.
> I attach a readable version of it.
>
> I want to use the debugQuery=on and explainOther parameters to understand
> why a given id didn't match.
> I expect to see something like "CTSS was in title, but you required also
> other conditions that are not met"
> and I like to know which one of the conditions was not met for my document.
>
> To debug, I performed this query with curl like this
>
> curl  -X POST --data @payload.txt "
> https://mysolr/jupiter/select?wt=json&rows=0&indent=off&debugQuery=on&explainOther=id%3APUBMEDPMID35868042
> "
>
> where payload.txt is attached (the urlencoded version of readable query
> basically)
>
> If I look at the response (explain_response.json attached) I see:
> ...
> "PUBMEDPMID35868042": "\n0.0 = No matching clauses\n"
> ...
>
> Even if I run this other query:
>
> id:PUBMEDPMID35868042 AND titles:ctss
>
> returns the document, and this is a partial match in subquery9, so I
> should have at least a matching clause.
>
> Can you tell me what's wrong in my reasoning?
> thank you very much.
>
> Danilo
>
>
> <https://www.cosbi.eu/>
>
> Danilo Tomasoni
>
> Data Scientist & Software Engineer
> Intelligent systems for Computational Biology
> +39 0464 808845
>
> tomasoni@cosbi.eu
>
> www.cosbi.eu
>
> <https://twitter.com/FoundationCosbi/>
> <https://www.linkedin.com/company/cosbi/>
>
>

-- 
Sincerely yours
Mikhail Khludnev