public async Task add_entry_to_index_beyond_maximum_length_does_not_get_indexed_beyond_maximum_if_exceptions_are_disabled() { var customer = new Customer { Email = "*****@*****.**", FirstName = "Bill", LastName = "Gates", Id = "2000" }; var index = new TrieSearch <Customer>("trieUnitTestsMaxLenTest", "UseDevelopmentStorage=true", c => c.Id, options: new TrieSearchOptions { MaximumIndexLength = 3 }); try { await index.IndexAsync(customer, "Gates"); var results = await index.FindAsync("gat"); Assert.AreEqual(1, results.Count()); results = await index.FindAsync("gates"); Assert.AreEqual(0, results.Count()); } finally { await index.DropIndexAsync(); } }
public async Task search_index_with_minimum_of_one_character_returns_expected_results() { var results = await _fullNameIndex.FindAsync("j"); Assert.AreEqual(2, results.Count()); Assert.IsTrue(results.Any(c => c.Id == "42")); Assert.IsTrue(results.Any(c => c.Id == "43")); Assert.IsFalse(results.Any(c => c.Id == "44")); }
public async Task add_entry_to_multi_index_adds_to_all_indexes() { var customer = new Customer { FirstName = "Benjamin", LastName = "Franklin", Id = "22", Email = "*****@*****.**", Phone = "111-111-1111" }; await _multiIndexSearch.IndexAsync(customer); var results1 = await _fullNameIndex.FindAsync("Benjamin Franklin"); var results2 = await _lastNameIndex.FindAsync("Franklin"); var results3 = await _emailIndex.FindAsync("*****@*****.**"); Assert.AreEqual(1, results1.Count()); Assert.AreEqual(1, results2.Count()); Assert.AreEqual(1, results3.Count()); }
public async Task search_index_with_minimum_of_three_characters_returns_no_results_when_searching_less_than_three_characters() { var results = await _emailIndex.FindAsync("j"); Assert.AreEqual(0, results.Count()); }