Trying to get count of cars based on different filters and within one collection. Even though we see multiple cars that meet the requirement, the query is returning count 0.
fn:count(cts:search(fn:collection("com.cars"), cts:and-query((
cts:element-word-query(xs:QName("exteriorColor"), "red", "wildcarded" ),
cts:element-word-query(xs:QName("interiorColor"), "gray", "wildcarded" )
cts:element-word-query(xs:QName("powerSteering"), json:null(), "wildcarded" )
))))
Test Data:
{
"id":1
"carName":"Toyoto",
"exteriorColor": "red",
"interiorColor": "gray",
"powerStreering": null
}
{
"id":2
"carName":"Toyoto",
"exteriorColor": "blue",
"interiorColor": "gray",
"powerStreering": null
}
{
"id":3
"carName":"Toyoto",
"exteriorColor": "red",
"interiorColor": "gray",
"powerStreering": "yes"
}
{
"id":4
"carName":"Toyoto",
"exteriorColor": "white",
"interiorColor": "gray",
"powerStreering": null
}
{
"id":5
"carName":"Toyoto",
"exteriorColor": "red",
"interiorColor": "gray",
"powerStreering": null
}
com.carscollection?json:null()evaluates to the empty sequence when passed this way - is that what you intended? - wstcom.carscollection. I'm trying to get count of cars that have exteriorColor red and interiorColor gray and powerStreering is null. - Mohammed Khan