HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Breaking changes for Optimizely Search & Navigation 15

Breaking changes for Optimizely Search & Navigation in relation to version 14, and the steps needed to update affected code.

Wildcard prefix searches are no longer supported.

Before Optimizely Search & Navigation Client API version 15, you could search for documents with terms with an unknown string beginning.

This is no longer supported, but depending on the use case, you might be able to achieve the same results using different solutions.

If there is a specific term field in your documents that you want to do wildcard prefix searches for, you can add a property on your class containing the regular field's reverse string, then use a wildcard search and search for the reverse substring.

For example, you have the terms "cellphone" and "mobilephone" in a specific field in your documents, and you want to search for documents containing "*phone":

Your class might then look like the following:

public class Phone {
    public string Name { get; set; }
    public string NameReverse
    {
        get => new(Name.Reverse().ToArray());
        set {; }
    }
}

Then index your data, and you can search in reverse using something like:

var search = "phone";
var searchReverse = new(search.Reverse().ToArray());

var result = client.Search<Phone>()
	.For(searchReverse + "*")
	.InField(x => x.NameReverse)
	.GetResult();

The indexed data in the field will then be:
enohpllec
enohpelibom

and search term will be :
enohp*

and will match both documents

If your use case is to search for wildcard prefixed words within a text, you have to use a different code design, like extracting the terms of interest and adding them to a field as described above.