Searching for string in string (LIKE query)

I’m using the GO SDK to search my Couchbase database. I have this exact match query working:

qp.And(cbft.NewConjunctionQuery(cbft.NewMatchQuery(“garden”).Field(“Features”)))

But I want to do use a ‘LIKE’ query instead (using FTS). For example, find “garden” in this string “driveway, garden, shed”.

How do I do that in Go?

Hi @benrolfe,

I think that this is partially going to depend on what indexes you have.

cbft.NewMatchQuery(“garden”).Field(“Features”)

On its own this query should search for the term “garden” in the “Features” property of a document.

There’s an example, and brief description, of different types of search query at https://docs.couchbase.com/go-sdk/1.5/full-text-searching-with-sdk.html (you’ll need the indexes from https://docs.couchbase.com/server/6.0/fts/fts-demonstration-indexes.html and the travel-sample bucket loaded to run these). For example if you take the simpleTextQuery from that page, the query will search all fields of documents for the term “swanky”. If you were to change that query to cbft.NewMatchQuery("swanky").Field("description") then it would search only on the description fields.