Scratch that, I found the answer in the documentation (crossCollection
joins require using a single value field).




On Tue, Jun 21, 2022 at 7:05 PM James Greene <ja...@jamesaustingreene.com>
wrote:

> Is it possible to join on multivalue fields using the crossCollection join
> method?
>
> v8.11
>
>
>
> Im getting back zero results when trying to join on a multivalue field:
>
>
> Setup Collection1{
>     object_id: plong (docvalues, not stored, indexed)
>     object_ids: plongs (docvalues, not stored, indexed, multivalued)
> }
>
> Docs [
>   {id:<uuid1>, object_id:1},  //shard1
>   {id:<uuid2>, object_id:2},  //shard2
>   {id:<uuid3>, object_id:3},  //shard2
>   {id:<uuid4>, object_ids:[1,3]}, //shard1
>   {id:<uuid5>, object_ids:[3,2]}, //shard2
> ]
>
> Query:
> &q=object_id:3
> &fl=*,related:[subquery]
> &related.q=
> {!join method=crossCollection from=object_ids to=object_id
> fromIndex=collection1}{!terms f=object_ids v=$row.object_id}
>
>
>
>
>
>
> I tried the same query using a single value field (everything else
> configured the same, created new single value fields for testing) and
> received the expected results:
>
> Setup Collection1{
>     object_id: plong (docvalues, not stored, indexed)
>     object_ids: plongs (docvalues, not stored, indexed, multivalued)
>     object_src_id: (same as object_id)
>     object_dest_id: (same as object_id)
> }
>
> Docs [
>   {id:<uuid1>, object_id:1},  //shard1
>   {id:<uuid2>, object_id:2},  //shard2
>   {id:<uuid3>, object_id:3},  //shard2
>   {id:<uuid4>, object_ids:[1,3], object_src_id:1, object_dest_id:3},
> //shard1
>   {id:<uuid5>, object_ids:[3,2], object_src_id:3, object_dest_id:2},
> //shard2
> ]
>
> &q=object_id:3
> &fl=*,related:[subquery]
> &related.q=
> {!join method=crossCollection from=object_id_src to=object_id
> fromIndex=collection1}{!terms f=object_ids v=$row.object_id}
>
>
>
>
>
>
>
>
> I'm using a single collection that has two shards and running in solrcloud
> mode.
>
>
>
>
>
> Collection1/query:
> &q=object_id:3
> &fl=*,related:[subquery]
> &related.q=
> {!join method=crossCollection from=object_ids to=object_id
> fromIndex=collection1}{!terms f=object_ids v=$row.object_id}
>
>
>

Reply via email to