How to view a documents content from Full Text Search Query

I have created a full text index on a bucket and have implemented FTS with my Python app using the following documentation:

http://developer.couchbase.com/documentation/server/current/sdk/python/full-text-searching-with-sdk.html

I am now able to search my index on my application and it returns the IDs of the documents. My question is, how can I know retrieve the rest of the content of each of those documents that have returned IDs?

What I am trying to achieve is similar to what is done here: http://blog.couchbase.com/2016/february/cbftjavapreview
Specifically this piece of code where they use the .content()

result = bucket.query(ftq);
System.out.println("totalHits: " + result.totalHits());
for (SearchQueryRow row : result) {
    System.out.println(row);
    System.out.println(bucket.get(row.id()).content());
}

Thank you.

Assuming you already know how to get the document IDs, simply use the Bucket.get() method: http://pythonhosted.org/couchbase/api/couchbase.html#couchbase.bucket.Bucket.get

1 Like