Full Text Search - Returning Document Content

Firstly I would like to say how brilliant Full Text Search (FTS) is. Many thanks Couchbase and the community.

Is it possible for the FTS API to return the contents of the matching documents rather than just the document id?

The API at http://developer.couchbase.com/documentation/server/4.5/rest-api/rest-fts-indexing.html#topic_hpd_2y4_1v__p-api-index-name-query doesn’t appear to list all the possible options.

Are there any plans to allow FTS to be accessed via the Sync Gateway?

Thank you.

1 Like

Worked it out! The ‘fields’ property can be an array of the document fields you want to return with FTS. However it only returns matching document fields which are part of the FTS index.

Is there to return document fields which are not part of the FTS index?

Hi Alfie,
FTS supports stored fields, which is one easy way to get what you’re after. When you create a full text index, you can optionally copy the actual data from the document into the index itself if you want to. Normally, you don’t need to because you still have the documents themselves in Couchbase, and you can always do a get in your application to retrieve them. Below is a picture that’ll help you find the setting to enable “store” when you create an index. It’s a setting at the field level, and you can even enable it for the whole index if you go to “advanced”. Obviously, doing this takes up more space in the index but it’s the only way in this version to get result snippets and highlighting back.

This is covered in more detail in the documentation. Here’s the part about creating full text indexes. Let me know if that helps.

Hi Will

Thank you so much for detailed information on the store feature. This is great and just what I need.