public void AddExisted() { IndexableItem item3 = new IndexableItem(); item3.ID = 2; item3.Strings = new string[] { "good1" }; index.Add(item3); Assert.AreEqual("bad0 bad1 good0 good1", String.Join(" ", index.SortedKeys)); Assert.AreEqual("1 2", String.Join(" ", index.GetMatchedIDs("good1"))); }
public void Init() { index = new InvertedWordIndex(); IndexableItem item1 = new IndexableItem(); IndexableItem item2 = new IndexableItem(); item1.ID = 0; item2.ID = 1; item1.Strings = new string[] { "good0", "bad0", "bad1" }; item2.Strings = new string[] { "good1", "bad1" }; index.Add(item1); index.Add(item2); }
public static void Init(TestContext context) { indexableItems = new IndexableItem[5]; for (int i = 0; i < 5; i++) { indexableItems[i] = new IndexableItem() { ID = (uint)i }; } index = new InvertedWordIndex(); indexableItems[0].Strings = new string[] { "000", "001" }; indexableItems[1].Strings = new string[] { "011", "110" }; indexableItems[2].Strings = new string[] { "12111", "12555" }; indexableItems[3].Strings = new string[] { "01156", "12666" }; indexableItems[4].Strings = new string[] { "12e8", "0" }; foreach (IndexableItem item in indexableItems) { index.Add(item); } corrector = new SuffixCorrector(index.SortedKeys); }