{"id":2478,"date":"2024-12-31T20:22:33","date_gmt":"2024-12-31T20:22:33","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/fixed-magento-2-full-text-search-not-working-in-admin-grid\/"},"modified":"2025-07-16T15:15:58","modified_gmt":"2025-07-16T09:45:58","slug":"magento-2-full-text-search-not-working-in-admin-grid","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/magento-2-full-text-search-not-working-in-admin-grid\/","title":{"rendered":"Fixed: Magento 2 Full Text Search Not Working in Admin Grid"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A full-text search, also known as keyword search, is a functionality that can produce more relevant results by scanning a huge number of fields in the&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/create-admin-grid-magento-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 admin grid<\/a>. Adding the full-text search in Magento 2 grid can help the admin search more efficiently and faster.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you are developing a custom\u00a0<a href=\"https:\/\/meetanshi.com\/magento-2-extensions.html\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 extension<\/a>\u00a0or functionality, you may require to add search functionality to the grids to help the admin find specific data. However, sometimes, the\u00a0Magento 2\u00a0full-text search functionality fails to work and may not produce proper results.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here, in this blog post, I have provided a complete programmatic solution for the&nbsp;<em><strong>Magento 2 full-text search not working<\/strong><\/em>&nbsp;in the custom admin grid issue. You can use the code provided here to enable full-text search in Magento 2 admin grid.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Magento 2 Full Text Search Not Working in Admin Grid \u2013 How to Fix?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In order to add the full-text search functionality in Magento 2 admin grid, you need to create and add an index of the table.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It can be done by calling the&nbsp;<strong>addIndex()<\/strong>&nbsp;function in the&nbsp;<strong><strong>\\app\\code\\Vendor\\Extension\\Setup\\InstallSchema.php<\/strong>&nbsp;<\/strong>file. Provided below is the complete code to make an index of the table and add the full-text search functionality in Magento 2 Admin grid:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$connection->addIndex(\n                    'testtable', \/\/table name'title',    \/\/ index name\n                    [\n                        'title'   \/\/ filed or column name \n                    ],\n                    \\Magento\\Framework\\DB\\Adapter\\AdapterInterface::INDEX_TYPE_FULLTEXT \/\/type of index\n                );<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the table name and column name in the above code to add full-text search in Magento 2 admin grid.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it!  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I hope this Magento 2 solution will help you. Feel free to comment down below if you have any queries or doubts. I would be happy to help you.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also, do not forget to share this amazing solution with your Magento friends.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks for reading!  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>A full-text search, also known as keyword search, is a functionality that can produce more relevant results by scanning a huge number of fields in&#8230;<\/p>\n","protected":false},"author":19,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-2478","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2478","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=2478"}],"version-history":[{"count":4,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2478\/revisions"}],"predecessor-version":[{"id":17968,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2478\/revisions\/17968"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=2478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=2478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=2478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}