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 Steve Pruitt <bp...@opentext.com> on 2018/09/14 18:22:11 UTC

join query in same collection

I see nothing in the documentation suggesting a query with a join filter doesn't work when a single collection is involved.  There is the special deployment instructions when joining across two distinct collections, but this is not my case.

I have a single collection:
I have two VM's, both running Solrcloud.
My collection has 2 shards on two different nodes.  Max shards per node is set to 1 and replication factor is set to 1.

The join filter is: {!join from=expctr-label-memberIds to=expctr-id}expctr-id:4b6f7d34-a58b-3399-b077-685951d06738

When I run the query, I get back only the document with expctr-id: 2087d22a-6157-306f-8386-8352e7d8e4d4
This looks, maybe, like it only finds a document on the replica handling the query.  Shouldn't it search and filter across the entire collection?

The documents:
       {
        "expctr-name":"online account opening",
        "expctr-description":["Journey for online customers"],
        "expctr-created":1536947719132,
        "expctr-to-date":1546232400000,
        "expctr-from-date":1538366400000,
        "expctr-id":"89ec679b-24df-3559-8428-124640c96230",
        "expctr-creator":"SP",
        "expctr-type":"journey",
        "_version_":1611606406752894976},
      {
        "expctr-name":"drop-in account opening",
        "expctr-description":["Journey for dropin customers"],
        "expctr-created":1536947827643,
        "expctr-to-date":1546232400000,
        "expctr-from-date":1538366400000,
        "expctr-id":"2087d22a-6157-306f-8386-8352e7d8e4d4",
        "expctr-creator":"SP",
        "expctr-type":"journey",
        "_version_":1611606520475156480},
      {
        "expctr-name":"placeholder",
        "expctr-label":"customers",
        "expctr-created":1536947679984,
        "expctr-to-date":0,
        "expctr-from-date":0,
        "expctr-id":"4b6f7d34-a58b-3399-b077-685951d06738",
        "expctr-creator":"SP",
        "expctr-type":"label",
        "expctr-label-memberIds":["89ec679b-24df-3559-8428-124640c96230", "2087d22a-6157-306f-8386-8352e7d8e4d4"],
        "_version_":1611606544788488192}]
  }

RE: join query in same collection

Posted by Vadim Ivanov <va...@spb.ntk-intourist.ru>.
Hi,
AFAIK Solr can  join only local indexes. No matter whether you join the same collection or two different ones.
So, in your case shard1 will be joined to shard1  and shard2 to shard2.
Unfortunately it's hard to say from your data  which document resides in which shard, but you can test using &distrib=false
-- 
BR, Vadim



-----Original Message-----
From: Steve Pruitt [mailto:bpruitt@opentext.com] 
Sent: Friday, September 14, 2018 9:22 PM
To: solr-user@lucene.apache.org
Subject: join query in same collection

I see nothing in the documentation suggesting a query with a join filter doesn't work when a single collection is involved.  There is the special deployment instructions when joining across two distinct collections, but this is not my case.

I have a single collection:
I have two VM's, both running Solrcloud.
My collection has 2 shards on two different nodes.  Max shards per node is set to 1 and replication factor is set to 1.

The join filter is: {!join from=expctr-label-memberIds to=expctr-id}expctr-id:4b6f7d34-a58b-3399-b077-685951d06738

When I run the query, I get back only the document with expctr-id: 2087d22a-6157-306f-8386-8352e7d8e4d4
This looks, maybe, like it only finds a document on the replica handling the query.  Shouldn't it search and filter across the entire collection?

The documents:
       {
        "expctr-name":"online account opening",
        "expctr-description":["Journey for online customers"],
        "expctr-created":1536947719132,
        "expctr-to-date":1546232400000,
        "expctr-from-date":1538366400000,
        "expctr-id":"89ec679b-24df-3559-8428-124640c96230",
        "expctr-creator":"SP",
        "expctr-type":"journey",
        "_version_":1611606406752894976},
      {
        "expctr-name":"drop-in account opening",
        "expctr-description":["Journey for dropin customers"],
        "expctr-created":1536947827643,
        "expctr-to-date":1546232400000,
        "expctr-from-date":1538366400000,
        "expctr-id":"2087d22a-6157-306f-8386-8352e7d8e4d4",
        "expctr-creator":"SP",
        "expctr-type":"journey",
        "_version_":1611606520475156480},
      {
        "expctr-name":"placeholder",
        "expctr-label":"customers",
        "expctr-created":1536947679984,
        "expctr-to-date":0,
        "expctr-from-date":0,
        "expctr-id":"4b6f7d34-a58b-3399-b077-685951d06738",
        "expctr-creator":"SP",
        "expctr-type":"label",
        "expctr-label-memberIds":["89ec679b-24df-3559-8428-124640c96230", "2087d22a-6157-306f-8386-8352e7d8e4d4"],
        "_version_":1611606544788488192}]
  }