I have been trying to get sql queries running, but having trouble while
dealing with the NOT queries.

Basically, the code looks like below


SolrQuery sqlQuery = new SolrQuery();
sqlQuery.setRequestHandler("/sql");
sqlQuery.set("stmt","select collection1.id as collection_1_id,
collection1.email as collection_1_mail from collection1 join collection2 on
collection1.email = collection2.email where collection1.email =
's...@email.com' limit 2");
System.out.println(solrClient.query("collection2",sqlQuery).getResponse());

Above code is working fine and returning a response like

{result-set={docs=[{collection_1_id=2, collection_1_mail=s...@email.com},
{collection_1_id=1, collection_1_mail=s...@email.com}, {EOF=true,
RESPONSE_TIME=1959}]}}

Then when I try to use a NOT clause as described on
https://lucene.apache.org/solr/guide/7_2/parallel-sql-interface.html


sqlQuery.set("stmt","select collection1.id as collection_1_id,
collection1.email as collection_1_mail from collection1 join collection2 on
collection1.email = collection2.email where NOT (collection1.email =
's...@email.com') limit 2");

or 

sqlQuery.set("stmt","select collection1.id as collection_1_id,
collection1.email as collection_1_mail from collection1 join collection2 on
collection1.email = collection2.email where collection1.email <>
's...@email.com' limit 2");

I am still getting 

{result-set={docs=[{collection_1_id=2, collection_1_mail=s...@email.com},
{collection_1_id=1, collection_1_mail=s...@email.com}, {EOF=true,
RESPONSE_TIME=1959}]}}

as response.

What is more, although the wiki page states '!=' is a valid operator, I am
getting 


parse failed: Bang equal '!=' is not allowed under the current SQL
conformance level

in the response.


Is there anything I am missing for using sql queries via SolrJ? 



-----
Zeki ama calismiyor... Calissa yapar...
--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Reply via email to