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 Christoph <ch...@project-mayhem.org> on 2018/10/15 16:56:41 UTC

Correct join syntax

I have two cores.  

One core has the following fields:

Type
Id

The other core has 

Type
Id
UserId
Access

How can I join where core1.Type = core2.Type, core1.Id = core2.id,
core2.UserId = <VALUE>, and core2.Access = <VALUE>?

When querying core1, I've tried variations of 

{!join from=Type to=Type fromIndex=core2)(UserId:<VALUE> AND Access:<VALUE>)
{!join from=Id to=Id fromIndex=core2)(UserId:<VALUE> AND Access:<VALUE>)

{!join from=Type to=Type fromIndex=core2)UserId:<VALUE>
{!join from=Id to=Id fromIndex=core2)UserId:<VALUE>
{!join from=Type to=Type fromIndex=core2)Access:<VALUE>
{!join from=Id to=Id fromIndex=core2)Access:<VALUE>

et. al.

How can I get done what I'm trying to do?

thnx,
Christoph



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

RE: Correct join syntax

Posted by Vadim Ivanov <va...@spb.ntk-intourist.ru>.
Hi
You cannot join on two fields in SOLR as you do using SQL.
Having the same situations I add new string field in collections(to concatenate Type and Id fields) and fill it at index time)
Then join two collections on that field at query time
-- 
Vadim

-----Original Message-----
From: damienk@gmail.com [mailto:damienk@gmail.com] 
Sent: Tuesday, October 16, 2018 1:24 AM
To: solr-user@lucene.apache.org
Subject: Re: Correct join syntax

Hi Christoph,

The closest I can get is:

{!join from=id to=id v="+UserId=<VALUE> +Access=<VALUE>"}

If there was a combined id/type field then you could join on that.

Regards,
Damien.

On Tue, 16 Oct 2018 at 04:10, Christoph <
christoph+developer@project-mayhem.org> wrote:

> I have two cores.
>
> One core has the following fields:
>
> Type
> Id
>
> The other core has
>
> Type
> Id
> UserId
> Access
>
> How can I join where core1.Type = core2.Type, core1.Id = core2.id,
> core2.UserId = <VALUE>, and core2.Access = <VALUE>?
>
> When querying core1, I've tried variations of
>
> {!join from=Type to=Type fromIndex=core2)(UserId:<VALUE> AND
> Access:<VALUE>)
> {!join from=Id to=Id fromIndex=core2)(UserId:<VALUE> AND Access:<VALUE>)
>
> {!join from=Type to=Type fromIndex=core2)UserId:<VALUE>
> {!join from=Id to=Id fromIndex=core2)UserId:<VALUE>
> {!join from=Type to=Type fromIndex=core2)Access:<VALUE>
> {!join from=Id to=Id fromIndex=core2)Access:<VALUE>
>
> et. al.
>
> How can I get done what I'm trying to do?
>
> thnx,
> Christoph
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>


Re: Correct join syntax

Posted by da...@gmail.com.
Hi Christoph,

The closest I can get is:

{!join from=id to=id v="+UserId=<VALUE> +Access=<VALUE>"}

If there was a combined id/type field then you could join on that.

Regards,
Damien.

On Tue, 16 Oct 2018 at 04:10, Christoph <
christoph+developer@project-mayhem.org> wrote:

> I have two cores.
>
> One core has the following fields:
>
> Type
> Id
>
> The other core has
>
> Type
> Id
> UserId
> Access
>
> How can I join where core1.Type = core2.Type, core1.Id = core2.id,
> core2.UserId = <VALUE>, and core2.Access = <VALUE>?
>
> When querying core1, I've tried variations of
>
> {!join from=Type to=Type fromIndex=core2)(UserId:<VALUE> AND
> Access:<VALUE>)
> {!join from=Id to=Id fromIndex=core2)(UserId:<VALUE> AND Access:<VALUE>)
>
> {!join from=Type to=Type fromIndex=core2)UserId:<VALUE>
> {!join from=Id to=Id fromIndex=core2)UserId:<VALUE>
> {!join from=Type to=Type fromIndex=core2)Access:<VALUE>
> {!join from=Id to=Id fromIndex=core2)Access:<VALUE>
>
> et. al.
>
> How can I get done what I'm trying to do?
>
> thnx,
> Christoph
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>