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 Preeti Bhat <pr...@shoregrp.com> on 2016/10/21 11:40:51 UTC

Can we query across collections in SOLR?

Hi All,

I have an requirement where in SQL we have two different sets of data like Company and Contact in SQL.
We are planning to get this to SOLR, I wanted to know whether we can have two separate collections in SOLR and say have a link between them with say id of one collection or if there any better way to get this done. Can we query this data directly?

I am searching by say below fields.

? Company ID  -> Get all the contacts linked to this?

? Contact ID-> Get all details of the company linked to this contact along with contact details.

Could someone suggest if there is any expected impact on performance while indexing  or searching?

Thanks and Regards,
Preeti Bhat


NOTICE TO RECIPIENTS: This communication may contain confidential and/or privileged information. If you are not the intended recipient (or have received this communication in error) please notify the sender and it-support@shoregrp.com immediately, and destroy this communication. Any unauthorized copying, disclosure or distribution of the material in this communication is strictly forbidden. Any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.



Re: Can we query across collections in SOLR?

Posted by Erick Erickson <er...@gmail.com>.
Join queries don't work across sharded collections. Well,
there's a special case where the "from" collection can be hosted
in-toto on every replica the "to" collection is hosted on, but....

If you can denormalize the data, that's always the first option.

Whenever I find myself trying to
express search problems as "I have these two tables...", I try
to pull back and re-think the problem. For instance,
the JoinQueryParser does _not_ result in documents that
have fields from both "tables" (collections in your case). If you
require this (i.e. select table1.column1, table2.column3 from ...)
you'll be disappointed.

Now, with recent 6.x work there's the ParallelSQL work, but that's
also special purpose. Certain fields _can_ be returned from both
collections, and the streaming aggregation stuff in general is very
flexible.

I would _strongly_ advise you to spend some time thinking
about denormalizing and/or expressing this as a search problem rather
than trying to just push your database into Solr and use it the same way.
I admit there's a learning curve here.

Best,
Erick

On Fri, Oct 21, 2016 at 8:50 AM, Susheel Kumar <su...@gmail.com> wrote:
> You may wanna to checkout below these options as well
>
> https://cwiki.apache.org/confluence/display/solr/Advanced+Distributed+Request+Options
>
> https://cwiki.apache.org/confluence/display/solr/Streaming+Expressions#StreamingExpressions-innerJoin
>
>
> On Fri, Oct 21, 2016 at 7:49 AM, Adi <ad...@gmail.com> wrote:
>
>> Hi,
>> Check documentation on join parser,
>> https://cwiki.apache.org/confluence/display/solr/Other+
>> Parsers#OtherParsers-JoinQueryParser
>> Regards,
>> Adi
>>
>> On Fri, Oct 21, 2016, 5:11 PM Preeti Bhat <pr...@shoregrp.com>
>> wrote:
>>
>> > Hi All,
>> >
>> > I have an requirement where in SQL we have two different sets of data
>> like
>> > Company and Contact in SQL.
>> > We are planning to get this to SOLR, I wanted to know whether we can have
>> > two separate collections in SOLR and say have a link between them with
>> say
>> > id of one collection or if there any better way to get this done. Can we
>> > query this data directly?
>> >
>> > I am searching by say below fields.
>> >
>> > ? Company ID  -> Get all the contacts linked to this?
>> >
>> > ? Contact ID-> Get all details of the company linked to this contact
>> along
>> > with contact details.
>> >
>> > Could someone suggest if there is any expected impact on performance
>> while
>> > indexing  or searching?
>> >
>> > Thanks and Regards,
>> > Preeti Bhat
>> >
>> >
>> > NOTICE TO RECIPIENTS: This communication may contain confidential and/or
>> > privileged information. If you are not the intended recipient (or have
>> > received this communication in error) please notify the sender and
>> > it-support@shoregrp.com immediately, and destroy this communication. Any
>> > unauthorized copying, disclosure or distribution of the material in this
>> > communication is strictly forbidden. Any views or opinions presented in
>> > this email are solely those of the author and do not necessarily
>> represent
>> > those of the company. Finally, the recipient should check this email and
>> > any attachments for the presence of viruses. The company accepts no
>> > liability for any damage caused by any virus transmitted by this email.
>> >
>> >
>> >
>>

Re: Can we query across collections in SOLR?

Posted by Susheel Kumar <su...@gmail.com>.
You may wanna to checkout below these options as well

https://cwiki.apache.org/confluence/display/solr/Advanced+Distributed+Request+Options

https://cwiki.apache.org/confluence/display/solr/Streaming+Expressions#StreamingExpressions-innerJoin


On Fri, Oct 21, 2016 at 7:49 AM, Adi <ad...@gmail.com> wrote:

> Hi,
> Check documentation on join parser,
> https://cwiki.apache.org/confluence/display/solr/Other+
> Parsers#OtherParsers-JoinQueryParser
> Regards,
> Adi
>
> On Fri, Oct 21, 2016, 5:11 PM Preeti Bhat <pr...@shoregrp.com>
> wrote:
>
> > Hi All,
> >
> > I have an requirement where in SQL we have two different sets of data
> like
> > Company and Contact in SQL.
> > We are planning to get this to SOLR, I wanted to know whether we can have
> > two separate collections in SOLR and say have a link between them with
> say
> > id of one collection or if there any better way to get this done. Can we
> > query this data directly?
> >
> > I am searching by say below fields.
> >
> > ? Company ID  -> Get all the contacts linked to this?
> >
> > ? Contact ID-> Get all details of the company linked to this contact
> along
> > with contact details.
> >
> > Could someone suggest if there is any expected impact on performance
> while
> > indexing  or searching?
> >
> > Thanks and Regards,
> > Preeti Bhat
> >
> >
> > NOTICE TO RECIPIENTS: This communication may contain confidential and/or
> > privileged information. If you are not the intended recipient (or have
> > received this communication in error) please notify the sender and
> > it-support@shoregrp.com immediately, and destroy this communication. Any
> > unauthorized copying, disclosure or distribution of the material in this
> > communication is strictly forbidden. Any views or opinions presented in
> > this email are solely those of the author and do not necessarily
> represent
> > those of the company. Finally, the recipient should check this email and
> > any attachments for the presence of viruses. The company accepts no
> > liability for any damage caused by any virus transmitted by this email.
> >
> >
> >
>

Re: Can we query across collections in SOLR?

Posted by Adi <ad...@gmail.com>.
Hi,
Check documentation on join parser,
https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-JoinQueryParser
Regards,
Adi

On Fri, Oct 21, 2016, 5:11 PM Preeti Bhat <pr...@shoregrp.com> wrote:

> Hi All,
>
> I have an requirement where in SQL we have two different sets of data like
> Company and Contact in SQL.
> We are planning to get this to SOLR, I wanted to know whether we can have
> two separate collections in SOLR and say have a link between them with say
> id of one collection or if there any better way to get this done. Can we
> query this data directly?
>
> I am searching by say below fields.
>
> ? Company ID  -> Get all the contacts linked to this?
>
> ? Contact ID-> Get all details of the company linked to this contact along
> with contact details.
>
> Could someone suggest if there is any expected impact on performance while
> indexing  or searching?
>
> Thanks and Regards,
> Preeti Bhat
>
>
> NOTICE TO RECIPIENTS: This communication may contain confidential and/or
> privileged information. If you are not the intended recipient (or have
> received this communication in error) please notify the sender and
> it-support@shoregrp.com immediately, and destroy this communication. Any
> unauthorized copying, disclosure or distribution of the material in this
> communication is strictly forbidden. Any views or opinions presented in
> this email are solely those of the author and do not necessarily represent
> those of the company. Finally, the recipient should check this email and
> any attachments for the presence of viruses. The company accepts no
> liability for any damage caused by any virus transmitted by this email.
>
>
>