HomeDev GuideAPI Reference
Dev GuideAPI ReferenceLegal TermsDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

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 beginning with an unknown string, but this is no longer supported. Depending on the use case, you might achieve the same results using different solutions.

If you want to do wildcard prefix searches for a specific term field in your documents, 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 and enohpelibom; the 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 must use a different code design, like extracting the terms of interest and adding them to a field described above.