I am looking at using Flex FTS and doing some testing.
Query #1.
SELECT meta(t).id FROM s t USE INDEX (USING FTS) WHERE t.type='task' and t.lid = 'blah' AND t.atid = "abc"
Here is the plan
{
“#operator”: “Sequence”,
“~children”: [
{
“#operator”: “IndexFtsSearch”,
“as”: “t”,
“covers”: [
“cover (((((t
.type
) = "task") and ((t
.lid
) = "blah")) and ((t
.atid
) = "abc")))”,
“cover ((meta(t
).id
))”
],
“index”: “s”,
“index_id”: “53905fdd24fda752”,
“keyspace”: “s”,
“namespace”: “default”,
“search_info”: {
“field”: “""”,
“options”: “{"index": "shadows"}”,
“outname”: “out”,
“query”: “{"query": {"conjuncts": [{"field": "lid", "term": "blah"}, {"field": "atid", "term": "abc"}]}, "score": "none"}”
},
“using”: “fts”
},
{
“#operator”: “Parallel”,
“~child”: {
“#operator”: “Sequence”,
“~children”: [
{
“#operator”: “Filter”,
“condition”: “cover (((((t
.type
) = "task") and ((t
.lid
) = "blah")) and ((t
.atid
) = "abc")))”
},
{
“#operator”: “InitialProject”,
“result_terms”: [
{
“expr”: “cover ((meta(t
).id
))”
}
]
},
{
“#operator”: “FinalProject”
}
]
}
}
]
}
Query #2 (Using IN)
SELECT meta(t).id FROM shadows t USE INDEX (USING FTS)
WHERE t.type=‘task’ and t.lid = ‘blah’
AND t.atid in [“abc”]
PLAN
{
“#operator”: “Sequence”,
“~children”: [
{
“#operator”: “IndexFtsSearch”,
“as”: “t”,
“index”: “s”,
“index_id”: “53905fdd24fda752”,
“keyspace”: “s”,
“namespace”: “default”,
“search_info”: {
“field”: “""”,
“options”: “{"index": "shadows"}”,
“outname”: “out”,
“query”: “{"query": {"field": "lid", "term": "blah"}, "score": "none"}”
},
“using”: “fts”
},
{
“#operator”: “Fetch”,
“as”: “t”,
“keyspace”: “shadows”,
“namespace”: “default”
},
{
“#operator”: “Parallel”,
“~child”: {
“#operator”: “Sequence”,
“~children”: [
{
“#operator”: “Filter”,
“condition”: “((((t
.type
) = "task") and ((t
.lid
) = "blah")) and ((t
.atid
) in ["abc"]))”
},
{
“#operator”: “InitialProject”,
“result_terms”: [
{
“expr”: “(meta(t
).id
)”
}
]
},
{
“#operator”: “FinalProject”
}
]
}
}
]
}
If I use IN clause in Query 2, it does a fetch, while Query #1 does not.