Copied to clipboard

Flag this post as spam?

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


  • John Churchley 272 posts 1258 karma points c-trib
    Oct 12, 2018 @ 13:44
    John Churchley
    0

    How to use ISearchableTree for Custom Section search

               public class CustomTreeController : TreeController, ISearchableTree
                {
                    public IEnumerable<SearchResultItem> Search(string query, int pageSize, long pageIndex, out long totalFound, string searchFrom = null)
                    { var results = GetMyResult(); totalFound = results.Count(); return  ????
    }
            }
    
  • John Churchley 272 posts 1258 karma points c-trib
    Oct 15, 2018 @ 10:48
    John Churchley
    100
     public IEnumerable<SearchResultItem> Search(string query, int pageSize, long pageIndex, out long totalFound, string searchFrom = null)
            {
                List<CustomObject> customList = GetCustomSearchResults();
                if (customList != null)
                {
                    List<CustomResultItem> customResultList = new List<CustomResultItem>();
    
                    int count = 0;
                    foreach (var c in customList )
                    {
                        customResultList.Add(new CustomResultItem
                        {
                            Score = count,
                            Icon = "icon-store",
                            Alias = c.Id,
                            Name = c.Name,
                            Id = c.Id
                        });
                        count++;
                    }
    
                    totalFound = customList .Count();
    
    
                    Mapper.CreateMap<CustomResultItem, SearchResultItem>();
                    return  Mapper.Map<List<CustomResultItem>, IEnumerable<SearchResultItem>>(customResultList).ToArray();
                }
                totalFound = 0;
                return Enumerable.Empty<SearchResultItem>();
            }
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies