Search code examples
lucenestratio

Stratio Lucene for Cassandra : 'contains' search returns '[['


I am using 'search()' to prepare lucene search criteria. I am using contains as here:

Search searchCondition = search().filter(match("customer_id", customerId))
    .filter(range("some_timestamp").lower(minTimestamp.toString()).upper(maxTimestamp.toString()))
    .filter(contains("types", getListOfTypes()))
    .sort(field("some_timestamp").reverse(false));

getListOfTypes() returns a List.

But when I search().build() then below is the query that I get:

{
   "filter":[
{"type":"match","field":"customer_id","value":1},
{"type":"range","field":"some_timestamp","lower":"2017-03-20 03:23:00.0","upper":"2017-03-30 03:23:00.0"},
{"type":"contains","field":"types","values":[["ABC over 90%","PQR","XYZ"]]}
],
"sort":[{"type":"simple","field":"some_timestamp","reverse":false}]
}

The problem here is '[[' and ']]'. This does not result in any rows been returned. I am for time being replacing these with single square brackets.

But what is solution for this.


Solution

  • I solved it by using java8:

     getListOfTypes().stream().toArray()