This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This seems way too difficult for what you would expect to be a pretty common task; | |
// taking a search string from the user and finding documents which contain some or all of the terms | |
// in the search string. | |
// This function naively splits a search string into terms and finds documents | |
// which contain some or all of the terms. Does not handle quoted terms as or ignore case as it should. | |
public IEnumerable<SearchResult> Search(string searchString, string[] fields) | |
{ | |
// Spit the search string and return an empty list if no search string was provided. | |
if (string.IsNullOrEmpty(searchString)) return new List<SearchResult>(); |