protected override List <ID> GetReference(PlayList entity, Item accountItem) { if (entity.PlayListSearch == null || entity.PlayListSearch.FilterTags == null || entity.PlayListSearch.FilterTags.Count == 0) { return(new List <ID>(0)); } Expression <Func <TagSearchResult, bool> > ancestorFilter = ContentSearchUtil.GetAncestorFilter <TagSearchResult>(accountItem, TemplateIDs.Tag); Expression <Func <TagSearchResult, bool> > second = Enumerable.Aggregate <string, Expression <Func <TagSearchResult, bool> > >((IEnumerable <string>)entity.PlayListSearch.FilterTags, PredicateBuilder.False <TagSearchResult>(), (Func <Expression <Func <TagSearchResult, bool> >, string, Expression <Func <TagSearchResult, bool> > >)((current, tmp) => PredicateBuilder.Or <TagSearchResult>(current, (Expression <Func <TagSearchResult, bool> >)(i => i.TagName == tmp)))); List <TagSearchResult> all = ContentSearchUtil.FindAll <TagSearchResult>(Configuration.Settings.IndexName, PredicateBuilder.And <TagSearchResult>(ancestorFilter, second)); if (all.Count < entity.PlayListSearch.FilterTags.Count) { IItemSynchronizer itemSynchronizer = MediaFrameworkContext.GetItemSynchronizer(typeof(Entities.Tag)); if (itemSynchronizer != null) { foreach (string str in entity.PlayListSearch.FilterTags) { string tagName = str; if (!Enumerable.Any <TagSearchResult>((IEnumerable <TagSearchResult>)all, (Func <TagSearchResult, bool>)(i => i.Name == tagName))) { TagSearchResult tagSearchResult = itemSynchronizer.Fallback((object)new Entities.Tag() { Name = tagName }, accountItem) as TagSearchResult; if (tagSearchResult != null) { all.Add(tagSearchResult); } } } } } return(Enumerable.ToList <ID>(Enumerable.Select <TagSearchResult, ID>((IEnumerable <TagSearchResult>)all, (Func <TagSearchResult, ID>)(i => i.ItemId)))); }
protected override MediaServiceSearchResult GetSearchResult(Item item) { var tagSearchResult = new TagSearchResult { Name = item[Templates.Tag.Name] }; return(tagSearchResult); }
public TagSearchResult Search(string q) { var list = _tagRepositry.Search(q).Take(10).ToList(); var result = new TagSearchResult { Items = list }; return(result); }
protected virtual bool IsValidSuggestion(TagSearchResult result) => true;
protected override bool IsValidSuggestion(TagSearchResult result) => IsValidEditorTag(result.SearchTag);