Copied to clipboard

Flag this post as spam?

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


  • Mus'ab 158 posts 387 karma points notactivated
    Jan 13, 2020 @ 14:56
    Mus'ab
    0

    How to search inside multi node tree picker using umbraco 8 examine search ?

    Hi all i am using umbraco 8.4 and i am trying to use examine to fine a news that don't has a specific widgets in their addToSection MNTP property i tried this

    var widgetUdi = Udi.Create(Constants.UdiEntityType.Document,Umbraco.Content(156098).Key).ToString();
                if (ExamineManager.Instance.TryGetIndex("ExternalIndex", out var index))
                {
                    var searcher = index.GetSearcher();
                    ISearchResults results = null;
                    IBooleanOperation queryOperations = searcher.CreateQuery().Field("__IndexType", "content").And().Field("__NodeTypeAlias", "newsItem");
                    queryOperations = queryOperations.And().Field("path", newsSource.Path.ToString().MultipleCharacterWildcard());
                    if(getPage.Value<IPublishedContent>("widget").Id!= 156098)
                    {//here i'am trying to tell examine search in MNTP
                        queryOperations = queryOperations.Not().Field("addToSection",widgetUdi);
                    }
                    results = queryOperations
                                    .OrderByDescending(new SortableField[]
                                    {new SortableField("year",SortType.Int)
                                    ,new SortableField("month",SortType.Int)
                                    ,new SortableField("day",SortType.Int)
                                    ,new SortableField("hour",SortType.Int)
                                    ,new SortableField("minute",SortType.Int) })
                                    .Execute(numberOfNewsToBeShown); 
    

    and its work just if the multi node tree picker have one value but if its have more its not working so how can i tell the examine to search inside the mntp not compere whole of it ?

Please Sign in or register to post replies

Write your reply to:

Draft