{"id":5764,"date":"2018-09-04T10:25:40","date_gmt":"2018-09-04T17:25:40","guid":{"rendered":"http:\/\/www.couchbase.com\/blog\/?p=5764"},"modified":"2025-06-13T20:27:48","modified_gmt":"2025-06-14T03:27:48","slug":"why-you-should-avoid-like-deep-dive-on-fts-part-1","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/why-you-should-avoid-like-deep-dive-on-fts-part-1\/","title":{"rendered":"Why you should avoid LIKE % | Deep Dive on FTS &#8211; Part 1"},"content":{"rendered":"<p>Search was probably one the most overlooked features in past applications. However, in recent years, it has really gotten all the attention it deserves as we have finally realized how it can increase sales or shape user\u2019s behavior and engagement.<\/p>\n<p>In this new blog series, I would like to go from zero to expert. As such, at the end of it, you will be able to implement searches \u201c<em>like a pro<\/em>\u201d.<\/p>\n<p>&nbsp;<\/p>\n<h2><strong>Why \u201cLike %\u201d isn\u2019t good enough?<\/strong><\/h2>\n<p>A well-implemented search should essentially be fast and relevant; &#8220;<strong>Like %<\/strong>&#8221; is neither of them. Let\u2019s see why:<\/p>\n<p>&nbsp;<\/p>\n<h3><strong>The problem with Speed<\/strong><\/h3>\n<p>Let\u2019s say we would like to implement a search for a movie according to its title. A naive SQL query looking for all \u201cStar Trek\u201d movies would look like the following:<\/p>\n<pre class=\"lang:plsql decode:true \">Select * from Movies where title like \u201cStar Trek%\u201d<\/pre>\n<p>By default, it will execute a full table scan trying to match this term to all rows. But it can be optimized with an index, which will create most likely a B-Tree structure. Therefore, even searches like the following would still partially leverage the index:<\/p>\n<pre class=\"lang:plsql decode:true\">Select * from Movies where title like \u201cStar%Trek\u201d\r\nSelect * from Movies where title like \u201cSt%Trek\u201d<\/pre>\n<p>But what if the user is a big fan of Batman and decides to search for the term \u201cDark Knight\u201d? According to the previous example, our query will look like the following:<\/p>\n<pre class=\"lang:plsql decode:true\">Select * from Movies where title like \u201cDark Knight%\u201d<\/pre>\n<p>The search above has the won\u2019t bring any results as the real name of the movie is \u201c<strong>The<\/strong> Dark Knight Rises\u201d.\u00a0 To fix this problem, let\u2019s add a wildcard at the beginning of our search term:<\/p>\n<pre class=\"lang:plsql decode:true\">Select * from Movies where title like \u201c%Dark Knight%\u201d<\/pre>\n<p>Fixed! Right!?\u00a0 Unfortunately, not really. The query above will fina a result like \u201c<strong>The<\/strong> Dark Knight Rises\u201d, but it won\u2019t leverage the index anymore and definitely won\u2019t perform well at scale. <strong>Like %<\/strong> does not \u201cunderstand\u201d the content of your field. Rather, it treats a text as a single thing, which makes it not the best choice to deal with anything that has some sort of underlying structure.<\/p>\n<p>A possible solution is to use MATCH, but it has also been <a href=\"https:\/\/hackernoon.com\/dont-waste-your-time-with-mysql-full-text-search-61f644a54dfa\">reported to be slow<\/a> in some databases.<\/p>\n<p>&nbsp;<\/p>\n<h3><strong>The problem with Relevancy<\/strong><\/h3>\n<p>What if we\u2019d like to also search for the movie\u2019s overview? A naive solution would be to just add a new field to the query:<\/p>\n<pre class=\"lang:plsql decode:true\">Select * from Movies where title like \u201c%Dark Knight%\u201d or overview like \u201c%Dark Knight%\u201d<\/pre>\n<p>This approach introduces a new problem: any movie with mentions &#8220;Dark Knight&#8221; in the overview has the same relevance as the ones with it in the title, and the order of the results are totally uncertain.<\/p>\n<p>A common mistake is to think that UNION DISTINCT could solve this problem. However, most of the query planners nowadays execute each block of the union in parallel, which will again mess up with the order\/relevancy.<\/p>\n<p>If you really want to implement some sort of relevancy using plain SQL, a simple solution is to execute two separate queries and append the result of one to the other. Of course, this strategy is far from optimal and you\u2019d still need to handle duplication manually.<\/p>\n<p>The examples above show one of the unspoken truths about search: <em><strong>The real challenge in search is not finding a match but how to sort them<\/strong><\/em>. After all, matching a text is a very straightforward task, but giving it the right score is something that should be carefully crafted.<\/p>\n<p>&nbsp;<\/p>\n<h2><strong>Full-Text<\/strong><strong> search comes to the rescue!<\/strong><\/h2>\n<p>There are many different ways to search for a term, each one focusing on a specific strategy. We will cover the majority of them in the upcoming articles, but for now, let\u2019s focus on why FTS is so much better than \u201c<strong>Like %<\/strong>\u201d:<\/p>\n<p>&nbsp;<\/p>\n<h3><strong>The solution for Speed<\/strong><\/h3>\n<p>In order to be able to query a database using FTS, you must create an inverted index first. This index, roughly speaking, is a map of words and their occurrences:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5765\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-01-at-1.13.21-PM-1024x743.png\" alt=\"inverted_index\" width=\"615\" height=\"446\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/09\/Screen-Shot-2018-09-01-at-1.13.21-PM-1024x743.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/09\/Screen-Shot-2018-09-01-at-1.13.21-PM-300x218.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/09\/Screen-Shot-2018-09-01-at-1.13.21-PM-768x557.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/09\/Screen-Shot-2018-09-01-at-1.13.21-PM-20x15.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/09\/Screen-Shot-2018-09-01-at-1.13.21-PM.png 1260w\" sizes=\"auto, (max-width: 615px) 100vw, 615px\" \/><\/p>\n<p>With the index above in place, searching for a word becomes a simple task, as you can easily get only the documents which contain the target term.<\/p>\n<p>Notice that during the creation of the inverted index, we have converted phrases to an array of words, so wildcards aren\u2019t necessary, as we can directly match the target terms against our inverted index. Nonetheless, even the use of wildcards here (Ex: *star*) will still run faster at scale, as you will only need to iterate through your index to find all matches instead of scanning all documents in your database.<\/p>\n<p>I haven\u2019t mentioned anything about dictionaries, stemming, analyzers, tokenizers and synonymous yet. I will get there in part 2 of this series.<\/p>\n<p>&nbsp;<\/p>\n<h3><strong>The solution for Relevance<\/strong><\/h3>\n<p>The strategy to implement a relevant search result might vary according to the domain you are working on. In general, the relevance can be manipulated in different multiple ways, the simplest one is called boosting. Roughly speaking, boosting is just a simple way to assign a weight for your field matches:<\/p>\n<p><strong>Query:<\/strong><\/p>\n<p><strong>Title:&#8221;<\/strong>Star Trek&#8221;^2 | <strong>Overview:&#8221;<\/strong>Star Trek&#8221;<\/p>\n<p>In the example above, the score of a match for \u201cStar Trek\u201d in the <strong>title<\/strong> will be worth twice as much as a match in the <strong>overview<\/strong> one. This is basically how you can suggest how your search results should be sorted.<\/p>\n<p>&nbsp;<\/p>\n<h2><strong>Why isn\u2019t everybody using Full-Text Search then?<\/strong><\/h2>\n<p>FTS usually demands you to set up a whole new infrastructure, add new dependencies, create multiple indexes, and then push all your document changes to an external system like <a href=\"https:\/\/github.com\/couchbaselabs\/couchbase-elasticsearch-connector\/releases\/tag\/4.0.0-dp.1\">Elastic Search<\/a> or Solr, even if you just want to implement a very simple search like our previous example. Thus, developers tend to avoid this huge amount of work until it becomes strictly necessary.<\/p>\n<p>That is one of the reasons why we have decided to incorporate an FTS Engine called <a href=\"https:\/\/blevesearch.com\/\">Bleve<\/a> into Couchbase, then all you need to do is to create a new index in the Web Console:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5767\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-04-at-5.18.00-PM.png\" alt=\"movie_index_creation\" width=\"697\" height=\"509\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/09\/Screen-Shot-2018-09-04-at-5.18.00-PM.png 922w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/09\/Screen-Shot-2018-09-04-at-5.18.00-PM-300x219.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/09\/Screen-Shot-2018-09-04-at-5.18.00-PM-768x561.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/09\/Screen-Shot-2018-09-04-at-5.18.00-PM-20x15.png 20w\" sizes=\"auto, (max-width: 697px) 100vw, 697px\" \/><\/p>\n<p>And you will automatically be able to make full-text searches using the default Couchbase SDK:<\/p>\n<pre class=\"lang:java decode:true\">String indexName = \"movies_index\";\r\nPhraseQuery query = SearchQuery.phrase(\"Star Trek\");\r\nSearchQueryResult result = movieRepository.getCouchbaseOperations().getCouchbaseBucket().query(\r\n    new SearchQuery(indexName, query).highlight().limit(20));<\/pre>\n<p>&nbsp;<\/p>\n<h3><strong>Most of the relational databases already have support for full-text search, why not just use them?<\/strong><\/h3>\n<p><strong>\u00a0<\/strong>Actually, it could be a nice choice for small use cases, and I have heard a few positive feedbacks from developers doing so. My personal recommendation is that you should consider a proper tool, such as Bleve, whenever you have a considerable volume of data, or whenever you will need to scale massively.<\/p>\n<p>There is another big plus of using a proper FTS engine: the query language. The majority of the relational databases try to reuse SQL for that, and it can get really messy if you try to write advanced searches. After all, SQL wasn\u2019t designed to deal with conjunction\/disjunction queries, facets, complex ranking factors, etc.<\/p>\n<p>&nbsp;<\/p>\n<h4><strong>Full-Text Search Series<\/strong><\/h4>\n<ul>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/how-analyzers-tokenizers-filters-work-fts-part-2\/\">Understanding analyzers and tokenizers<\/a>\u00a0&#8211; Part 2<\/li>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/fuzzy-matching\/\">Fuzzy Matching<\/a>\u00a0&#8211; Part 3<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Search was probably one the most overlooked features in past applications. However, in recent years, it has really gotten all the attention it deserves as we have finally realized how it can increase sales or shape user\u2019s behavior and engagement. [&hellip;]<\/p>\n","protected":false},"author":8754,"featured_media":5768,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[2165],"tags":[],"ppma_author":[9059],"class_list":["post-5764","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-full-text-search"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Why you should avoid LIKE % - The Couchbase Blog<\/title>\n<meta name=\"description\" content=\"This article focuses on why one should avoid using LIKE % for search and also check out why FTS is so much better than \u201cLike %.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/why-you-should-avoid-like-deep-dive-on-fts-part-1\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Why you should avoid LIKE % | Deep Dive on FTS - Part 1\" \/>\n<meta property=\"og:description\" content=\"This article focuses on why one should avoid using LIKE % for search and also check out why FTS is so much better than \u201cLike %.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/why-you-should-avoid-like-deep-dive-on-fts-part-1\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-09-04T17:25:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T03:27:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/09\/fts-part-1-header-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"728\" \/>\n\t<meta property=\"og:image:height\" content=\"210\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Denis Rosa, Developer Advocate, Couchbase\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@deniswsrosa\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Denis Rosa, Developer Advocate, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/why-you-should-avoid-like-deep-dive-on-fts-part-1\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/why-you-should-avoid-like-deep-dive-on-fts-part-1\\\/\"},\"author\":{\"name\":\"Denis Rosa, Developer Advocate, Couchbase\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/fe3c5273e805e72a5294611a48f62257\"},\"headline\":\"Why you should avoid LIKE % | Deep Dive on FTS &#8211; Part 1\",\"datePublished\":\"2018-09-04T17:25:40+00:00\",\"dateModified\":\"2025-06-14T03:27:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/why-you-should-avoid-like-deep-dive-on-fts-part-1\\\/\"},\"wordCount\":1123,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/why-you-should-avoid-like-deep-dive-on-fts-part-1\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2018\\\/09\\\/fts-part-1-header-2.png\",\"articleSection\":[\"Full-Text Search\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/why-you-should-avoid-like-deep-dive-on-fts-part-1\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/why-you-should-avoid-like-deep-dive-on-fts-part-1\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/why-you-should-avoid-like-deep-dive-on-fts-part-1\\\/\",\"name\":\"Why you should avoid LIKE % - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/why-you-should-avoid-like-deep-dive-on-fts-part-1\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/why-you-should-avoid-like-deep-dive-on-fts-part-1\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2018\\\/09\\\/fts-part-1-header-2.png\",\"datePublished\":\"2018-09-04T17:25:40+00:00\",\"dateModified\":\"2025-06-14T03:27:48+00:00\",\"description\":\"This article focuses on why one should avoid using LIKE % for search and also check out why FTS is so much better than \u201cLike %.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/why-you-should-avoid-like-deep-dive-on-fts-part-1\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/why-you-should-avoid-like-deep-dive-on-fts-part-1\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/why-you-should-avoid-like-deep-dive-on-fts-part-1\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2018\\\/09\\\/fts-part-1-header-2.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2018\\\/09\\\/fts-part-1-header-2.png\",\"width\":728,\"height\":210},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/why-you-should-avoid-like-deep-dive-on-fts-part-1\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Why you should avoid LIKE % | Deep Dive on FTS &#8211; Part 1\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/admin-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/fe3c5273e805e72a5294611a48f62257\",\"name\":\"Denis Rosa, Developer Advocate, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f8d1f5c13115122cab89d0f229b904480bfe20d3dfbb093fe9734cda5235d419?s=96&d=mm&r=gbe0716f6199cfb09417c92cf7a8fa8d6\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f8d1f5c13115122cab89d0f229b904480bfe20d3dfbb093fe9734cda5235d419?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f8d1f5c13115122cab89d0f229b904480bfe20d3dfbb093fe9734cda5235d419?s=96&d=mm&r=g\",\"caption\":\"Denis Rosa, Developer Advocate, Couchbase\"},\"description\":\"Denis Rosa is a Developer Advocate for Couchbase and lives in Munich - Germany. He has a solid experience as a software engineer and speaks fluently Java, Python, Scala and Javascript. Denis likes to write about search, Big Data, AI, Microservices and everything else that would help developers to make a beautiful, faster, stable and scalable app.\",\"sameAs\":[\"https:\\\/\\\/x.com\\\/deniswsrosa\"],\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/author\\\/denis-rosa\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Why you should avoid LIKE % - The Couchbase Blog","description":"This article focuses on why one should avoid using LIKE % for search and also check out why FTS is so much better than \u201cLike %.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/why-you-should-avoid-like-deep-dive-on-fts-part-1\/","og_locale":"en_US","og_type":"article","og_title":"Why you should avoid LIKE % | Deep Dive on FTS - Part 1","og_description":"This article focuses on why one should avoid using LIKE % for search and also check out why FTS is so much better than \u201cLike %.","og_url":"https:\/\/www.couchbase.com\/blog\/why-you-should-avoid-like-deep-dive-on-fts-part-1\/","og_site_name":"The Couchbase Blog","article_published_time":"2018-09-04T17:25:40+00:00","article_modified_time":"2025-06-14T03:27:48+00:00","og_image":[{"width":728,"height":210,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/09\/fts-part-1-header-2.png","type":"image\/png"}],"author":"Denis Rosa, Developer Advocate, Couchbase","twitter_card":"summary_large_image","twitter_creator":"@deniswsrosa","twitter_misc":{"Written by":"Denis Rosa, Developer Advocate, Couchbase","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/why-you-should-avoid-like-deep-dive-on-fts-part-1\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/why-you-should-avoid-like-deep-dive-on-fts-part-1\/"},"author":{"name":"Denis Rosa, Developer Advocate, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/fe3c5273e805e72a5294611a48f62257"},"headline":"Why you should avoid LIKE % | Deep Dive on FTS &#8211; Part 1","datePublished":"2018-09-04T17:25:40+00:00","dateModified":"2025-06-14T03:27:48+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/why-you-should-avoid-like-deep-dive-on-fts-part-1\/"},"wordCount":1123,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/why-you-should-avoid-like-deep-dive-on-fts-part-1\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/09\/fts-part-1-header-2.png","articleSection":["Full-Text Search"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/why-you-should-avoid-like-deep-dive-on-fts-part-1\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/why-you-should-avoid-like-deep-dive-on-fts-part-1\/","url":"https:\/\/www.couchbase.com\/blog\/why-you-should-avoid-like-deep-dive-on-fts-part-1\/","name":"Why you should avoid LIKE % - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/why-you-should-avoid-like-deep-dive-on-fts-part-1\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/why-you-should-avoid-like-deep-dive-on-fts-part-1\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/09\/fts-part-1-header-2.png","datePublished":"2018-09-04T17:25:40+00:00","dateModified":"2025-06-14T03:27:48+00:00","description":"This article focuses on why one should avoid using LIKE % for search and also check out why FTS is so much better than \u201cLike %.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/why-you-should-avoid-like-deep-dive-on-fts-part-1\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/why-you-should-avoid-like-deep-dive-on-fts-part-1\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/why-you-should-avoid-like-deep-dive-on-fts-part-1\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/09\/fts-part-1-header-2.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/09\/fts-part-1-header-2.png","width":728,"height":210},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/why-you-should-avoid-like-deep-dive-on-fts-part-1\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Why you should avoid LIKE % | Deep Dive on FTS &#8211; Part 1"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/fe3c5273e805e72a5294611a48f62257","name":"Denis Rosa, Developer Advocate, Couchbase","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f8d1f5c13115122cab89d0f229b904480bfe20d3dfbb093fe9734cda5235d419?s=96&d=mm&r=gbe0716f6199cfb09417c92cf7a8fa8d6","url":"https:\/\/secure.gravatar.com\/avatar\/f8d1f5c13115122cab89d0f229b904480bfe20d3dfbb093fe9734cda5235d419?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f8d1f5c13115122cab89d0f229b904480bfe20d3dfbb093fe9734cda5235d419?s=96&d=mm&r=g","caption":"Denis Rosa, Developer Advocate, Couchbase"},"description":"Denis Rosa is a Developer Advocate for Couchbase and lives in Munich - Germany. He has a solid experience as a software engineer and speaks fluently Java, Python, Scala and Javascript. Denis likes to write about search, Big Data, AI, Microservices and everything else that would help developers to make a beautiful, faster, stable and scalable app.","sameAs":["https:\/\/x.com\/deniswsrosa"],"url":"https:\/\/www.couchbase.com\/blog\/author\/denis-rosa\/"}]}},"acf":[],"authors":[{"term_id":9059,"user_id":8754,"is_guest":0,"slug":"denis-rosa","display_name":"Denis Rosa, Developer Advocate, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/f8d1f5c13115122cab89d0f229b904480bfe20d3dfbb093fe9734cda5235d419?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/5764","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/users\/8754"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=5764"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/5764\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/5768"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=5764"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=5764"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=5764"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=5764"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}