We already discussed how the Like % clause is potentially harmful for your application at scale, and why you should consider using Couchbase Full-Text Search instead. One thing we haven’t mentioned yet is why you might prefer Couchbase FTS over any other FTS Engine in the market.
Apart from the fact that using Couchbase FTS is simpler in terms of setup, as you can leverage the infrastructure you already have for your database. You can combine the power of N1QL and FTS in a single statement:
1 |
SELECT META(t1).id FROM `travel-sample` AS t1 WHERE SEARCH(t1.country, "United States"); |
Check out the complete tutorial here. We will build a simpler version of the application built during this talk, which is a basic search engine for movies.