You can try to make such "pure negative" query how it works underneath (but
it's not how it's actually executed).
*:* -{!join ..}.. ie Create boolean query with two legs: MatchAll and NOT
Join. Unfortunately, I have no idea about those Java wrappers.

On Tue, Feb 6, 2018 at 12:11 AM, Todd Stevenson <todd.steven...@imail.org>
wrote:

> I have the following query:
>
>     {!join from=conceptNcid to=ncid fromIndex=hdd_rel_tst}
> relationshipNcid:364
>
> which I implemented in Spring:
>
>        Criteria criteria = new Criteria("relationshipNcid").is("364");
>
>         SimpleQuery search = new SimpleQuery(criteria, pageable);
>         search.setJoin(Join.from("conceptNcid").fromIndex("hdd_
> rel_tst").to("ncid"));
>
>         Page<T> results = solrTemplate.queryForPage(search, myclass);
>
> This query works great.
>
> However, when I attempt to negate the query (using the minus sign at the
> beginning):
>
>     -{!join from=conceptNcid to=ncid fromIndex=hdd_rel_tst}
> relationshipNcid:364
>
> with this code:
>
>        Criteria criteria = new Criteria("relationshipNcid").
> is("364").not();
>
>         SimpleQuery search = new SimpleQuery(criteria, pageable);
>         search.setJoin(Join.from("conceptNcid").fromIndex("hdd_
> rel_tst").to("ncid"));
>
>         Page<T> results = solrTemplate.queryForPage(search, myclass);
>
> it does not work.  Notice where I put the 'not()' on the first line.  This
> actual executes this query:
>
>     {!join from=conceptNcid to=ncid fromIndex=hdd_rel_tst}-
> relationshipNcid:364
>
>
> I know this is the wrong place, but I can't see how to negate the entire
> query in the java code.   It seems to need a 'not()' method for the
> SimpleQuery class since the join is placed on the query,  but I can't see
> anything in the documentation.
>
> Any ideas?
>
> Todd Stevenson
>
>


-- 
Sincerely yours
Mikhail Khludnev

Reply via email to