I'd like to be able to implement search for items in the foo array in documents that look like this:
{
"_id":"...",
"_rev":"...",
"foo":
[
"This is some text",
"Another lot of text",
"In fact there are lots and lots of these",
...
]
...
}
The foo array may contain up to several thousand items. There are several thousand documents.
I understand how to index and search items in the foo array (as per the question here) but ideally I'd like a search to be able to return only the matched items in foo – not the whole of each document that contains a matched item.
I can process (whole-document) results to remove unmatched foo items, but is there a better way?