As a temporary workaround until that issue is fixed one could wrap the right stream with a select that renames the field:
intersect( cartesianProduct(tuple(fieldA=array(a,b,c,c)), fieldA, productSort="fieldA asc"), select(cartesianProduct(tuple(fieldB=array(a,c)), fieldB, productSort="fieldB asc"), fieldB as fieldA), on=fieldA ) > Am 08.06.2018 um 14:42 schrieb Joel Bernstein <joels...@gmail.com>: > > You're correct, after testing again the only way that this works correctly > appears to be: > > intersect( > cartesianProduct(tuple(fieldA=array(a,b,c,c)), fieldA, productSort="fieldA > asc"), > cartesianProduct(tuple(fieldA=array(a,c)), fieldA, productSort="fieldA > asc"), > on="fieldA" > ) > > I suspect that there are only test cases that cover this scenario as well. > I'll create a jira issue for this. > > > > > Joel Bernstein > http://joelsolr.blogspot.com/ > > On Fri, Jun 8, 2018 at 3:41 AM, Christian Spitzlay < > christian.spitz...@biologis.com> wrote: > >> Hi, >> >> >>> Am 08.06.2018 um 03:42 schrieb Joel Bernstein <joels...@gmail.com>: >>> >>> And when you transpose the "on" fields like this: >>> >>> intersect( >>> cartesianProduct(tuple(fieldA=array(a,b,c,c)), fieldA, >> productSort="fieldA >>> asc"), >>> cartesianProduct(tuple(fieldB=array(a,c)), fieldB, productSort="fieldB >>> asc"), >>> on="fieldB=fieldA" >>> ) >>> >>> It also works. >> >> >> No, IIUC this does not work correctly. >> >> I had tried this before posting my original question. >> That version emits the documents from the left stream >> but does not filter out the document with fieldA == b. >> >> This might be due to the fact that fieldB is not present in the left stream >> and fieldA is not present in the right stream; it compares two >> empty values (null?) and comes to the conclusion that they are equal. >> Could that be the reason? >> >> >> >>> So, yes there is a bug where the fields are being transposed with >> intersect >>> function's "on" fields. The same issue was happening with joins and may >>> have been resolved. I'll do little more research into this. >> >> Thanks for your work on this! >> >> >> Best regards >> Christian Spitzlay >> >> >> >> >> >>> Joel Bernstein >>> http://joelsolr.blogspot.com/ >>> >>> On Thu, Jun 7, 2018 at 9:29 AM, Christian Spitzlay < >>> christian.spitz...@biologis.com> wrote: >>> >>>> >>>> >>>>> Am 07.06.2018 um 11:34 schrieb Christian Spitzlay < >>>> christian.spitz...@biologis.com>: >>>>> >>>>> intersect( >>>>> cartesianProduct(tuple(fieldA=array(a,b,c,c)), fieldA, >>>> productSort="fieldA asc"), >>>>> cartesianProduct(tuple(fieldB=array(a,c)), fieldB, productSort="fieldB >>>> asc"), >>>>> on="fieldA=fieldB" >>>>> ) >>>>> >>>>> I simplified it a bit, too. I still get one document with fieldA == a. >>>>> I would have expected three documents in the output, one with fieldA == >>>> a and two with fieldB == c. >>>> >>>> That should have read ā⦠and two with fieldA == cā of course. >>>> >>>> >>>> >>>> >> >>