returns false positive results finding size in the first sub-object and color in the second sub-object.
I guess it is due to the fact that tshirts.size and tshirts.color are indexed independently.
Is there any way of coupling size and color either at the indexing time or at query time?
As you have observed FTS currently does not have a query type that requires child queries elements to all be satisfied by the same array elements. The index has the required information, we just don’t yet offer a way to express the query. I’ll pass this feature along for future consideration.
Thank you for the proposed solution.
It is definitely possible to use N1QL for the presented example.
Nevertheless , sometimes FTS is the only option.
Consider, for example, theaters with array of playing movies when each movie element has a title and playing times. To find a theater by movie title (potentially partial) and playing time is definitely a task for FTS.
Thank you for the reply.
I think it is an essential feature to have.
Without it search within arrays of objects is very limited.
Solr does it by block joins. DataStax Enterprise by tuple query parser.
Is there any way to plug in a custom FTS indexing code?
This is not yet prioritised for a particular release, And thanks for bringing this back on radar,
Certainly more such user queries helps us in prioritising this over the backlog.
Meantime, you may also share more insight into your exact use case, else we may presume that its precisely similar to above mentioned thread.
Here’s somewhat useful idea for you to consider. It’s not perfect, but you can use FTS index as the first round of filter (like a bloom filter), and then apply the filters you need to apply in N1QL. The version below works in 6.5 (beta shortly), in prior versions, you’ll have to use CURL() function.
SELECT *
FROM s
INNER JOIN s s1 ON (META(s).id = META(s1).id)
UNNEST s1.tshirts AS s2
WHERE search(s, "+tshirts.color:blue +tshirts.size:large")
AND s2.color = "blue"
AND s2.size = "large" ;