public override string SearchResultLabel(object item, string query) { if (item is Type) { return(TypeOption.SearchResultLabel((Type)item, query)); } else if (item is Member) { return(MemberOption.SearchResultLabel((Member)item, query, direction, expectingBoolean)); } throw new NotSupportedException(); }
public override IEnumerable <object> OrderedSearchResults(string query, CancellationToken cancellation) { // Exclude duplicate inherited members, like the high amount of "Destroy()" or "enabled", // if their declaring type is also available for search. foreach (var member in codebase.members .Cancellable(cancellation) .UnorderedSearchFilter(query, m => MemberOption.Haystack(m, direction, expectingBoolean)) .Where(m => !m.isPseudoInherited || !codebase.types.Contains(m.declaringType)) .OrderBy(m => LudiqCore.Configuration.groupInheritedMembers && m.isPseudoInherited) .ThenByDescending(m => SearchUtility.Relevance(query, MemberOption.Haystack(m, direction, expectingBoolean)))) { yield return(member); } foreach (var type in codebase.types .Cancellable(cancellation) .Where(t => !t.IsEnum) .OrderedSearchFilter(query, TypeOption.Haystack)) { yield return(type); } }