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 Mikhail Khludnev <mk...@apache.org> on 2018/02/06 11:11:02 UTC

Re: Querying on sum of child documents

exp=total seems strange it should be score.
Then, childquery  clauses might need to be appended with ^=0 to suppress
unnecessary scoring.
Check debugQuery output to make sure if query is parsed as expected.

On Tue, Jan 30, 2018 at 10:10 AM, Prath <pr...@gmail.com> wrote:

> Hi,
> I used following query
> {!parent which="isParent:1" exp=total}+description:JSON +exp:[4 TO 7]
> {!func}exp.
> It is considering only highest experience from matched descriptions but not
> sum of matched description experience.
> Can you please explain me in detail.
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>



-- 
Sincerely yours
Mikhail Khludnev

Re: Querying on sum of child documents

Posted by Prath <pr...@gmail.com>.
We need  sum of experiences from each child documents. Using this expression
"exp:[4 TO 7]" we are directly querying the single child document with the
experience between 4 to 7 but not sum of experiences of all child
documents.For that we have to do something. Could you please help me out
with that logic.



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: Querying on sum of child documents

Posted by flatmind <fl...@gmail.com>.
Hello Mikhail - Thanks for your help with the query and I was able to get the
result. But when I am trying to add another condition to that, it is not
showing any results, though there are matching records in the index. But
when I execute those queries individually, I am getting the response.

This is the index that we have and it has 2 parent records with few children

 "response":{"numFound":2,"start":0,"docs":[ { "id":"one",
"th_content":["this resume belongs to php developer"], "th_is_parent":1,
"_version_":1626065661717381120, "_childDocuments_":[ { "id":"doc1***one",
"th_recent_exp":["Wokred as java developer"], "th_experience":2,
"th_is_parent":2, "_version_":1626065661717381120}, { "id":"doc2***one",
"th_recent_exp":["experience in java"], "th_experience":2, "th_is_parent":2,
"_version_":1626065661717381120}, { "id":"doc3***one",
"th_recent_exp":["junior software developer"], "th_experience":1,
"th_is_parent":2, "_version_":1626065661717381120}]}, { "id":"two",
"th_content":["this resume belongs to php developer"], "th_is_parent":1,
"_version_":1626065856446332928, "_childDocuments_":[ { "id":"doc1***two",
"th_recent_exp":["Wokred as php developer"], "th_experience":2,
"th_is_parent":2, "_version_":1626065856446332928}, { "id":"doc2***two",
"th_recent_exp":["experience in php"], "th_experience":2, "th_is_parent":2,
"_version_":1626065856446332928}, { "id":"doc3***two",
"th_recent_exp":["junior software developer"], "th_experience":1,
"th_is_parent":2, "_version_":1626065856446332928}]}] }}

When I use the below query either in the Q or FQ, I am able to see 1 record
in the search results. But when I try to add another condition, it is not
giving anything. Please find the below working query and the other one with
one more clause added. Seems that I might be missing a small syntactical
thing that combines both queries to get the results. Appreciate if you could
help here.

*Working Query
=======================*
{!frange l=4}{!parent which=th_is_parent:1 score=total 
v=$chq}&chq=+th_is_parent:2^=0 AND th_recent_exp:php^=0 AND
{!func}th_experience 

*Adding another condition to the above query like below
===========================================*
{!frange l=4}{!parent which=th_is_parent:1 score=total 
v=$chq}&chq=+th_is_parent:2^=0 AND th_recent_exp:*php*^=0 AND
{!func}th_experience *AND* {!frange l=4}{!parent which=th_is_parent:1
score=total 
v=$chq}&chq=+th_is_parent:2^=0 AND th_recent_exp:*java*^=0 AND
{!func}th_experience 

Thank You




--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: Querying on sum of child documents

Posted by Mikhail Khludnev <mk...@apache.org>.
q={!frange l=8}{!parent which=isParent:1 score=total
v=$chq}&chq=+isParent:2^=0 AND description:payroll^=0 AND {!func}exp


On Wed, Feb 20, 2019 at 7:39 PM flatmind <fl...@gmail.com> wrote:

> Hi
> I tried with the below query
>
> q={!frange l=8}{!parent which=isParent:1 score=total v=$chq} AND chq=+
> isParent:2 AND description:payroll AND {!func}exp
>
> I applied lower limit as 8 still the record is coming in the results.Where
> sum of the child documents matching with "payroll" description is 7.
> So what's wrong with my function query ?Please help me.
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>


-- 
Sincerely yours
Mikhail Khludnev

Re: Querying on sum of child documents

Posted by flatmind <fl...@gmail.com>.
Hi
I tried with the below query 

q={!frange l=8}{!parent which=isParent:1 score=total v=$chq} AND chq=+ 
isParent:2 AND description:payroll AND {!func}exp

I applied lower limit as 8 still the record is coming in the results.Where
sum of the child documents matching with "payroll" description is 7.
So what's wrong with my function query ?Please help me.



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html