Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Danny dineen 17 posts 96 karma points
    Oct 26, 2020 @ 22:24
    Danny dineen
    0

    Umbraco 8 multiple wildcard examine is not working.

    string searchTerm = sr.SearchTerm;

    string searchTermStartsWith = sr.SearchTerm.MultipleCharacterWildcard().Value;

    IBooleanOperation term = query.Field("excludeFromSearchResults", "0").And() .GroupedOr(searchProperties, searchTerm).Or() .GroupedOr(searchProperties, searchTermStartsWith);

    I am trying to get the multiple wild card to return all items that start with the search term. In Umbraco 8 this is not working, Any clues?

    Thanks.

  • Søren Gregersen 441 posts 1884 karma points MVP 2x c-trib
    Jan 06, 2021 @ 15:49
    Søren Gregersen
    0

    Hi Danny,

    The reason it's not working is that your line

    string searchTermStartsWith = sr.SearchTerm.MultipleCharacterWildcard().Value;
    

    Result in a searchTermStartsWith with the same value as sr.SearchTerm. The .Value of the ExamineValue is just the string, but the other properties set on the ExamineValue, describes how the value should be treated.

    var searchTermStartsWith = sr.SearchTerm.MultipleCharacterWildcard();
    

    should be the solution

    HTH :)

Please Sign in or register to post replies

Write your reply to:

Draft