Riak search queries via the java client
-
27-06-2021 - |
Pregunta
I am trying to perform queries using the OR operator as following:
MapReduceResult result = riakClient. mapReduce("some_bucket", "Name:c1 OR c2"). addMapPhase(new NamedJSFunction("Riak.mapValuesJson"), true). execute();
I only get the 1st object in the query (where name='c1'). If I change the order of the query (i.e. Name:c2 OR c1) again I get only the first object in query (where name='c2').
is the OR operator (and other query operators) supported in the java client?
Solución
I got this answer from Basho engeneer, Sean C.:
You either need to group the terms or qualify both of them. Without a field identifier, the search query assumes that the default field is being searched. You can determine how the query will be interpreted by using the 'search-cmd explain' command. Here's two alternate ways to express your query:
Name:c1 OR Name:c2
Name:(c1 OR c2)
both options worked for me!