This file contains 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
public class Indexer | |
{ | |
private Dictionary<string, HashSet<string>> terms = new Dictionary<string, HashSet<string>>(StringComparer.OrdinalIgnoreCase); | |
private Dictionary<string, HashSet<string>> docTerms = new Dictionary<string, HashSet<string>>(StringComparer.OrdinalIgnoreCase); | |
public void Index(string docId, string text) | |
{ | |
var words = new HashSet<string>(text.Split(), StringComparer.OrdinalIgnoreCase); | |
HashSet<string> toRemove; | |
if (docTerms.TryGetValue(docId, out toRemove)) |
This file contains 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
/// <summary> | |
/// Extensions class with enumerable extensions targeted at code generation | |
/// </summary> | |
public static class EnumerableExtensions | |
{ | |
/// <summary> | |
/// Yields a single value | |
/// </summary> | |
/// <typeparam name="T"></typeparam> | |
/// <param name="instance"></param> |