I'm unable to negate a join query using the Spring Java interface to Solr

2018-02-05 Thread Todd Stevenson
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 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 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



Best practices to return total records vs total filtered records in query?

2020-03-24 Thread Todd Stevenson
I have a use case that I would think is a common one but I cannot find any help 
with this use case.

I am wanting to do a query that returns a list of records that I will display 
in an html table in an app.  This table only displays n records of the complete 
data set, but is able to page through the data set.   This use case is handled 
wonderfully by Solr, by specifying the offset and limit of the records in the 
data set and repeatedly rerunning the query.

Another facet of this use case is to be able to filter the records returned, 
typically by typing filter text in a search box.  This should filter the 
records and only display those that match the filter string.  This works fine 
in Solr with one exception.  I would like to be able to display with the table 
the total number of record in the data set (which I can) and the total filtered 
records in the data set (which I cannot).

Is there a way for Solr to return the total record count and the total filtered 
record count (possibly based on the q and fq queries) ?

The only way I can see to do this is to run the query twice,  once with the 
filter string included and once without.  This seems to e terribly inefficient. 
 Is there a better way?

Todd Stevenson
Care Transformation Application Developer
Intermountain Healthcare
3930 Parkway Blvd |Salt Lake City, UT 84120
Office: 801-442-5112 | Cell: 801-589-1115
todd.steven...@imail.org<mailto:todd.steven...@imail.org>
[cid:image003.jpg@01D601FD.EACE4A70]

NOTICE: This e-mail is for the sole use of the intended recipient and may 
contain confidential and privileged information. If you are not the intended 
recipient, you are prohibited from reviewing, using, disclosing or distributing 
this e-mail or its contents. If you have received this e-mail in error, please 
contact the sender by reply e-mail and destroy all copies of this e-mail and 
its contents.