Yes, i tried building up expression piece by piece but looks like there is
an issue with how complement expects / behave for sort.

if i use below g and h expr inside complement which are already sorted
(sort) then it doesn't work

e=select(get(c),id,email),
f=select(get(d),id,email),
g=sort(get(e),by="id asc,email asc"),
h=sort(get(f),by="id asc,email asc"),
i=complement(get(g),get(h),on="id,email"),

while below worked when i use e and f expr and sort them within complement
function instead of using g and h directly

e=select(get(c),id,email),
f=select(get(d),id,email),
g=sort(get(e),by="id asc,email asc"),
h=sort(get(f),by="id asc,email asc"),
i=complement(
sort(get(e),by="id asc,email asc"),sort(get(f),by="id asc,email asc")
,on="id,email"),

So I am good for now with above approach but running into another issue
with empty/null/"Index 0, Size 0" set and will start another thread for
that (Need your help there :-)).

Appreciate and thanks for all your help while I try to solve my use case
using streaming expressions.


On Thu, Jun 22, 2017 at 11:10 AM, Joel Bernstein <joels...@gmail.com> wrote:

> I suspect something is wrong in the syntax but I'm not seeing it.
>
> Have you tried building up the expression piece by piece until you get the
> syntax error?
>
> Joel Bernstein
> http://joelsolr.blogspot.com/
>
> On Wed, Jun 21, 2017 at 3:20 PM, Susheel Kumar <susheel2...@gmail.com>
> wrote:
>
> > While simple complement works in this way
> >
> > ===
> > complement(merge(sort(select(echo("A"),echo as email),by="email asc"),
> > sort(select(echo("B"),echo as email),by="email asc"),
> > on="email asc"),
> > merge(sort(select(echo("A"),echo as email),by="email asc"),
> > sort(select(echo("D"),echo as email),by="email asc"),on="email asc"),
> > on="email")
> >
> > BUT below it doesn't work when used in similar way
> >
> > ===
> > let(a=fetch(collection1,having(rollup(over=email,
> >                  count(email),
> >                 select(search(collection1,
> >                         q=*:*,
> >                         fl="id,business_email",
> >                         sort="business_email asc"),
> >    id,
> >    business_email as email)),
> >     eq(count(email),1)),
> > fl="id,business_email as email",
> > on="email=business_email"),
> > b=fetch(collection1,having(rollup(over=email,
> >                  count(email),
> >                 select(search(collection1,
> >                         q=*:*,
> >                         fl="id,personal_email",
> >                         sort="personal_email asc"),
> >    id,
> >    personal_email as email)),
> >     eq(count(email),1)),
> > fl="id,personal_email as email",
> > on="email=personal_email"),
> > c=hashJoin(get(a),hashed=get(b),on="email"),
> > d=hashJoin(get(b),hashed=get(a),on="email"),
> > e=select(get(c),id,email),
> > f=select(get(d),id,email),
> > g=sort(get(e),by="id asc,email asc"),
> > h=sort(get(f),by="id asc,email asc"),
> > i=complement(get(g),get(h),on="id,email"),
> > get(i)
> > )
> >
> >
> > On Wed, Jun 21, 2017 at 11:29 AM, Susheel Kumar <susheel2...@gmail.com>
> > wrote:
> >
> > > Hi,
> > >
> > > Two issues with complement function (solr 6.6)
> > >
> > > 1)  When i execute below streaming expression,
> > >
> > > ==
> > >
> > > let(a=fetch(collection1,having(rollup(over=email,
> > >                  count(email),
> > >                 select(search(collection1,
> > >                         q=*:*,
> > >                         fl="id,business_email",
> > >                         sort="business_email asc"),
> > >    id,
> > >    business_email as email)),
> > >     eq(count(email),1)),
> > > fl="id,business_email as email",
> > > on="email=business_email"),
> > > b=fetch(collection1,having(rollup(over=email,
> > >                  count(email),
> > >                 select(search(collection1,
> > >                         q=*:*,
> > >                         fl="id,personal_email",
> > >                         sort="personal_email asc"),
> > >    id,
> > >    personal_email as email)),
> > >     eq(count(email),1)),
> > > fl="id,personal_email as email",
> > > on="email=personal_email"),
> > > c=hashJoin(get(a),hashed=get(b),on="email"),
> > > d=hashJoin(get(b),hashed=get(a),on="email"),
> > > e=select(get(c),id,email),
> > > f=select(get(d),id,email),
> > > g=sort(get(e),by="id asc,email asc"),
> > > h=sort(get(f),by="id asc,email asc"),
> > > i=complement(get(g),get(h),on="id,email"),
> > > get(i)
> > > )
> > >
> > >
> > > getting response as
> > >
> > > { "result-set": { "docs": [ { "EXCEPTION": "Invalid ReducerStream -
> > > substream comparator (sort) must be a superset of this stream's
> > > comparator.", "EOF": true } ] } }
> > >
> > > 2) when i execute below
> > >
> > >
> > > complement(
> > >   select(search(collection1, q=*:*, fl="id,business_email", sort="id
> > asc, business_email asc"),id,business_email as email),
> > >   select(search(collection1, q=*:*, fl="id,personal_email", sort="id
> > asc, personal_email asc"),id,personal_email as email),
> > >   on="id,email"
> > > )
> > >
> > > getting response as
> > >
> > > {
> > >   "result-set": {
> > >     "docs": [
> > >       {
> > >         "EXCEPTION": "Invalid expression complement(
> > select(search(collection1, q=*:*, fl=\"id,business_email\", sort=\"id
> asc,
> > business_email asc\"),id,business_email as email),
> > select(search(collection1, q=*:*, fl=\"id,personal_email\", sort=\"id
> asc,
> > personal_email asc\"),id,personal_email as email),  on=\"id,email\") -
> > unknown operands found",
> > >         "EOF": true
> > >       }
> > >     ]
> > >   }
> > > }
> > >
> > >
> >
>

Reply via email to