You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Akshay Vadher <ak...@synoverge.com> on 2016/12/06 11:04:18 UTC

Solr outer join / not join query

I have posted a stackoverflow question too -
http://stackoverflow.com/questions/40993515/solr-outer-join-not-join-query.

 

I may be asking too much but I want to do a left outer join between two
cores and get data from Aonly where B does not have related data.

Following is exactly my equivalent SQL query (for simplicity I have removed
other conditions),

1. SELECT  A.* FROM A AS A

WHERE A.ID NOT IN (SELECT B.A_ID FROM B AS B WHERE B.STATUS_ID != 1)

I understand that solr join is actually subquery, I need data from only A.

It would be very easy if the not was not there in where condition for sub
query.

For example,

2. SELECT  A.* FROM A AS A

WHERE A.ID IN (SELECT B.A_ID FROM B AS B WHERE B.STATUS_ID != 1)

I can have q={!join from=aId to=id fromIndex=b}(-statusId:1).

How can I do a nagete here, i.e. solr query for 1

 

 

Regards,

Akshay Vadher

Senior Software Engineer

Synoverge Technologies Pvt. Ltd.

 <javascript:void(0);> akshay.vadher@synoverge.com |
<http://tel:+91%2096620%2059401/> +91 96620 59401

 

"You know, sometimes all you need is twenty seconds of insane courage. Just
literally twenty seconds of just embarrassing bravery. And I promise you,
something great will come of it."
―  <http://www.goodreads.com/author/show/1350576.Benjamin_Mee> Benjamin Mee,
<http://www.goodreads.com/work/quotes/3805656> We Bought a Zoo

 












_______________________________________________

CONFIDENTIALITY NOTICE:

The contents of this email message and any attachments are intended solely for the addressee(s) and may contain confidential and/or privileged information and may be legally protected from disclosure. If you are not the intended recipient of this message, or if this message has been addressed to you in error, please immediately alert the sender by reply email and then delete this message and any attachments. If you are not the intended recipient, you are hereby notified that any use, dissemination, copying, or storage of this message or its attachments is strictly prohibited

RE: Solr outer join / not join query

Posted by Akshay Vadher <ak...@synoverge.com>.
With little modification, it worked.

 

fq=-{!join from=aId to=id fromIndex=b}-statusId:1

 

() wrapping –statusId:1 did not work.

 

 

Thanks

Akshay 

 

From: Mikhail Khludnev [mailto:mkhl@apache.org] 
Sent: Tuesday, December 06, 2016 5:12 PM
To: dev@lucene.apache.org
Subject: Re: Solr outer join / not join query

 

q=*:* -{!join from=aId to=id fromIndex=b}(-statusId:1)

 

On Tue, Dec 6, 2016 at 2:04 PM, Akshay Vadher <akshay.vadher@synoverge.com <ma...@synoverge.com> > wrote:

I have posted a stackoverflow question too - http://stackoverflow.com/questions/40993515/solr-outer-join-not-join-query.

 

I may be asking too much but I want to do a left outer join between two cores and get data from Aonly where B does not have related data.

Following is exactly my equivalent SQL query (for simplicity I have removed other conditions),

1. SELECT  A.* FROM A AS A

WHERE A.ID <http://A.ID>  NOT IN (SELECT B.A_ID FROM B AS B WHERE B.STATUS_ID != 1)

I understand that solr join is actually subquery, I need data from only A.

It would be very easy if the not was not there in where condition for sub query.

For example,

2. SELECT  A.* FROM A AS A

WHERE A.ID <http://A.ID>  IN (SELECT B.A_ID FROM B AS B WHERE B.STATUS_ID != 1)

I can have q={!join from=aId to=id fromIndex=b}(-statusId:1).

How can I do a nagete here, i.e. solr query for 1

 

 

Regards,

Akshay Vadher

Senior Software Engineer

Synoverge Technologies Pvt. Ltd.

akshay.vadher@synoverge.com <ma...@synoverge.com>  |  <http://tel:+91%2096620%2059401/> +91 96620 59401

 

“You know, sometimes all you need is twenty seconds of insane courage. Just literally twenty seconds of just embarrassing bravery. And I promise you, something great will come of it.”
―  <http://www.goodreads.com/author/show/1350576.Benjamin_Mee> Benjamin Mee,  <http://www.goodreads.com/work/quotes/3805656> We Bought a Zoo

 

 
 
 
 
 
 
 
 
_______________________________________________
 
CONFIDENTIALITY NOTICE:
 
The contents of this email message and any attachments are intended solely for the addressee(s) and may contain confidential and/or privileged information and may be legally protected from disclosure. If you are not the intended recipient of this message, or if this message has been addressed to you in error, please immediately alert the sender by reply email and then delete this message and any attachments. If you are not the intended recipient, you are hereby notified that any use, dissemination, copying, or storage of this message or its attachments is strictly prohibited




-- 

Sincerely yours
Mikhail Khludnev












_______________________________________________

CONFIDENTIALITY NOTICE:

The contents of this email message and any attachments are intended solely for the addressee(s) and may contain confidential and/or privileged information and may be legally protected from disclosure. If you are not the intended recipient of this message, or if this message has been addressed to you in error, please immediately alert the sender by reply email and then delete this message and any attachments. If you are not the intended recipient, you are hereby notified that any use, dissemination, copying, or storage of this message or its attachments is strictly prohibited

Re: Solr outer join / not join query

Posted by Mikhail Khludnev <mk...@apache.org>.
q=*:* -{!join from=aId to=id fromIndex=b}(-statusId:1)

On Tue, Dec 6, 2016 at 2:04 PM, Akshay Vadher <ak...@synoverge.com>
wrote:

> I have posted a stackoverflow question too - http://stackoverflow.com/
> questions/40993515/solr-outer-join-not-join-query.
>
>
>
> I may be asking too much but I want to do a left outer join between two
> cores and get data from Aonly where B does not have related data.
>
> Following is exactly my equivalent SQL query (for simplicity I have
> removed other conditions),
>
> 1. SELECT  A.* FROM A AS A
>
> WHERE A.ID NOT IN (SELECT B.A_ID FROM B AS B WHERE B.STATUS_ID != 1)
>
> I understand that solr join is actually subquery, I need data from only A.
>
> It would be very easy if the not was not there in where condition for sub
> query.
>
> For example,
>
> 2. SELECT  A.* FROM A AS A
>
> WHERE A.ID IN (SELECT B.A_ID FROM B AS B WHERE B.STATUS_ID != 1)
>
> I can have q={!join from=aId to=id fromIndex=b}(-statusId:1).
>
> How can I do a nagete here, i.e. solr query for *1*
>
>
>
>
>
> Regards,
>
> Akshay Vadher
>
> Senior Software Engineer
>
> Synoverge Technologies Pvt. Ltd.
>
> akshay.vadher@synoverge.com | +91 96620 59401
> <http://tel:+91%2096620%2059401/>
>
>
>
> “You know, sometimes all you need is twenty seconds of insane courage.
> Just literally twenty seconds of just embarrassing bravery. And I promise
> you, something great will come of it.”
> ― Benjamin Mee <http://www.goodreads.com/author/show/1350576.Benjamin_Mee>
> , *We Bought a Zoo <http://www.goodreads.com/work/quotes/3805656>*
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
>
> CONFIDENTIALITY NOTICE:
>
> The contents of this email message and any attachments are intended solely for the addressee(s) and may contain confidential and/or privileged information and may be legally protected from disclosure. If you are not the intended recipient of this message, or if this message has been addressed to you in error, please immediately alert the sender by reply email and then delete this message and any attachments. If you are not the intended recipient, you are hereby notified that any use, dissemination, copying, or storage of this message or its attachments is strictly prohibited
>
>


-- 
Sincerely yours
Mikhail Khludnev