London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Can someone explain why I can't search on the "Ancestors&&String" property?

Vote:
0

So I have a simple method that uses a "dummy"-interface to get the "Ancestors" name so the underlaying FInd API can target the correct property, like this ->

    public interface ITracable
    {
        string[] Ancestors { get; set; }
        string CreatedBy { get; set; }    
    }

    mySearchClient.Search<IContent>().Filter(x => ((ITraceable)x).Ancestors.Match("100"))...

But it refuses to return results based on the search on that property. The document in Find looks like this (excerpt) ->

    "CreatedBy$$string": "andre",
    "Ancestors$$string": [
        "102486",
        "102485",
        "102481",
        "55",
        "1"
    ],

But with the same "Dummy interface" method I can target the "CreatedBy" property and I get search results. How can I correctly target the "Ancestors&&string" property?
Thanks for pointing out what I do wrong!
#207033
Edited, Sep 06, 2019 15:20
Vote:
1

Try following the method at the bottom of this doc page https://world.episerver.com/documentation/developer-guides/find/NET-Client-API/searching/Filtering/Complex-objects/

I think you need to use a filter expression such as the MatchContained

#207034
Edited, Sep 06, 2019 15:25
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.