Dynamics 365 Business Central: adding fields to the new Modern Search engine via AL code.

Some weeks ago I wrote a post explaining, with some technical details, the new Modern Search feature introduced with Dynamics 365 Business Central 2024 Wave 2 release (version 25).

After that post, I promised a second post with details about how AL developers can control the indexed fields, and here it is…

The new Modern Search feature uses full text search from Azure SQL and it applies when searching on standard list pages, on lookup pages and on company data search.

You can enable your fields for the new full-text search by using the new field’s OptimizeForTextSearch property:

You can use this property also on tableextension‘s objects, but you cannot change the property on af exsting field via extensions:

The BC Synchronization engine will be responsible to generate the full-text search index accordingly (one index per table). This index will be regenerated if you change the indexed fields.

The new property should not be used everywhere (it’s mainly used for optimizing record searches) so the best field types that should be considered to be added in a full-text index are primary keys and Text-based fields that identifies a record.

Please remember that if in the search string you will use fields that are not in the full-text index or if you use the * wildcard, the search will be converted in the old legacy search (slowest).

The SetFilter method has a new syntax for calling full-text search from AL:

FieldRef.SetFilter(‘&&’ + SearchString + ‘*’);

This can be useful if you want to implement a code-based data search like the standard Microsoft’s one.

Original Post https://demiliani.com/2024/10/08/dynamics-365-business-central-adding-fields-to-the-new-modern-search-engine-via-al-code/

0 Votes: 0 Upvotes, 0 Downvotes (0 Points)

Leave a reply

Follow
Sign In/Sign Up Sidebar Search
Popular Now
Loading

Signing-in 3 seconds...

Signing-up 3 seconds...