{"title":"Enable optimized text search on table fields","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/devenv-table-field-text-search/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-table-field-text-search, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-table-field-text-search","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Learn how to allow text search on table fields.","date":"2024-10-01","meta":{"topic":"how-to"},"outline":[{"level":1,"title":"Enable optimized text search on table fields","slug":"enable-optimized-text-search-on-table-fields","at":0,"chars":5981},{"level":2,"title":"Enable optimized text search on fields","slug":"enable-optimized-text-search-on-fields","at":947,"chars":1245},{"level":2,"title":"Filter syntax for optimized text search","slug":"filter-syntax-for-optimized-text-search","at":2192,"chars":513},{"level":2,"title":"Optimized text search semantics","slug":"optimized-text-search-semantics","at":2705,"chars":1095},{"level":3,"title":"Example","slug":"example","at":3495,"chars":305},{"level":2,"title":"Install full-text search on the database (on-premises only)","slug":"install-full-text-search-on-the-database-on-premises-only","at":3800,"chars":1870},{"level":2,"title":"Related information","slug":"related-information","at":5670,"chars":311}],"text":"# Enable optimized text search on table fields\n> APPLIES TO: Business Central 2024 release wave 2 (v25) and later.\nBusiness Central includes an optimized text search feature on table fields, which uses the full-text search feature in SQL Server and Azure SQL Database databases. Optimized text search lets users and applications run full-text queries against character-based data in tables. This article explains how to allow optimized text search on table fields and how you can use it to filter data in AL.\nIn the client, optimized text search is used in various search functionalities, such as in the company-wide data search and on lists that include optimized text search fields, referred to as modern search. See Search for a record in company data</ui-search-data> and Search lists</ui-enter-criteria-filters#searching>. By enabling optimized text search on fields in extensions, you can significantly optimize data search in your AL code.\n## Enable optimized text search on fields\nTo allow optimized text search on field, set the properties/devenv-optimizefortextsearch-property to true. The following example shows how text search is allowed on the field level:\n```al\ntable 50100 Address\n{\n    Caption = 'Sample table';\n\n    fields\n    {\n        field(1; Address; Text[50])\n        {\n            Caption = 'Address retrieved by Service';\n            OptimizeForTextSearch = true;\n        }\n        field(2; Locality; Text[30])\n        {\n            Caption = 'Locality retrieved by Service';\n            OptimizeForTextSearch = true;\n        }\n        field(3; \"Town/City\"; Text[30])\n        {\n            Caption = 'Town/City retrieved by Service';\n            OptimizeForTextSearch = true;\n        }\n        field(4; County; Text[30])\n        {\n            Caption = 'County retrieved by Service';\n            OptimizeForTextSearch = true;\n        }\n        field(5; IsValidated; Boolean)\n        {\n            Caption = 'Address validated yet?';\n        }\n    }\n```\nYou can use the OptimizedForTextSearch property on the Field virtual table. You can also use the methods-auto/fieldref/fieldref-isoptimizedfortextsearch-method on FieldRef type variables of the FieldRef data type.\n## Filter syntax for optimized text search\nTo use optimized text search in AL, you can add the `&&` operator when setting a filter, as illustrated in the following example:\n```al\n// Optimized text search without wildcard\nRec.SetFilter(Rec.Field, '&&' + SearchString);\n```\nYou can also include wildcards in full-text search by adding the `*` symbol to the search clause as illustrated in the following example:\n```al\n// Optimized text search with wildcard\nRec.SetFilter(Rec.Field, '&&' + SearchString + '*' );\n```\n## Optimized text search semantics\nOptimized text search differs from the traditional wildcard search using the '*' symbol in the following ways:\n Optimized text search is always case insensitive, where wildcard search is case sensitive unless either the dataset collation is insensitive or the `@` operator is prefixed.\n Optimized text search is always accent insensitive, where wildcard search is accent sensitive unless either the dataset collation is insensitive or the `@` operator is prefixed.\n Optimized text search looks for words within fields, where wildcard search looks for letters within fields. That means full-text search can find words or prefixes of words within a field, but wildcard search can find arbitrary substrings within words. Learn more in the following example.\n### Example\nConsider a database that includes the item `london swivel chair`. The following table demonstrates different queries on the item and indicates whether there's a match.\nQuery|Match\n-|:-:\n`*swivel*`|Yes\n`&&swivel`|Yes\n`*swiv*`|Yes\n`&&swiv`|No\n`&&swiv*`|Yes\n`*hair*`|Yes\n`&&hair`|No\n`&&hair*`|No\n## Install full-text search on the database (on-premises only)\nTo support optimized text search in Business Central on-premises, the SQL Server instance must include the full-text search feature.\nThe SQL server instance that hosts your Business Central database must include the Full-text and Semantic Extractions for Search feature. The version 25 Microsoft base application requires this feature; however, it isn't installed by default.\n1. To verify whether full-text search is installed:\n  Using Transactional-SQL\n   Execute the following query on the SQL database instance:\n   ```tsql\n   SELECT FULLTEXTSERVICEPROPERTY('IsFullTextInstalled') AS IsFullTextInstalled;\n   ```\n   If the query returns `0`, then full-text search isn't installed; if `1`, then it's installed.\n  Using SQL Server Management Studio\n   In Object Explorer, right-click a server instance, select Properties, then select Advanced. If the Default Full-Text Language property is present, then full-text search is installed; otherwise, it isn't.\n See Viewing or Changing Server Properties for Full-Text Search<https://learn.microsoft.com/sql/relational-databases/search/manage-and-monitor-full-text-search-for-a-server-instance>\n2. To install full-text search, add it as a feature by using the SQL Server Installation Center.\n You need to access the installation media or folder for your SQL Server version, and then run set.exe to start the SQL Server Installation Center. Follow the instructions at https://learn.microsoft.com/sql/database-engine/install-windows/add-features-to-an-instance-of-sql-server-setup. When you get to the Feature Selection page, choose Full-text and Semantic Extractions for Search.\n> TIP\n> If you're using SQL Server 2019 Express, you can download the installation media from Microsoft Download Center<https://www.microsoft.com/en-US/download/details.aspx?id=101064>.\n## Related information\nproperties/devenv-optimizefortextsearch-property\nIsOptimizeForTextSearch method<methods-auto/fieldref/fieldref-isoptimizedfortextsearch-method>\ndevenv-table-object\ndevenv-tables-overview\nFull-text search in SQL<https://learn.microsoft.com/sql/relational-databases/search/full-text-search>"}