private static IEnumerable <DocumentInfo> GetTermDocuments(IReadOnlyIndex index, string term) { if (term.EndsWith("*")) { return(index.GetWordsStartWith(term.TrimEnd('*')).SelectMany(wordDocuments => wordDocuments)); } if (term.StartsWith("*")) { term = term.TrimStart('*'); return(index.GetWordsMatching(word => word.EndsWith(term, index.WordComparison)).SelectMany(wordDocuments => wordDocuments)); } return(index.GetExactWord(term)); }