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
public class Indexer | |
{ | |
private Dictionary<string, List<string>> terms = | |
new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase); | |
private Dictionary<string, List<string>> itemsByTerm = | |
new Dictionary<string, List<string>>(); | |
public void Index(string docId, string text) | |
{ | |
// First check to see if we already have anything for this docId |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
public class Swictionary<TKey, TValue> | |
{ | |
readonly Dictionary<Predicate<TKey>, TValue> Cases; | |
TValue Default; | |
public Swictionary(TValue @default) |