public void ExecuteQueryTest() { _alphaEngine = new AlphaEngine(_map); AlphaEngine alphaEngine = _alphaEngine.AddMustIncludes("The", "WitcheR", "A").AddLeastIncludes("HunTeR", "Bank"); AlphaEngine copyAlphaEngine = alphaEngine.Clone(); Assert.Equal(new List <string>() { "1.txt", "2.txt", "3.txt" }, alphaEngine.ExecuteQuery()); Assert.Equal(new List <string>() { "2.txt" }, copyAlphaEngine.AddExcludes("role-playing").ExecuteQuery()); }
private void AddWord(string word) { char starter = word[0]; switch (starter) { case '+': _alphaEngine = _alphaEngine.AddLeastIncludes(word.Substring(1)); break; case '-': _alphaEngine = _alphaEngine.AddExcludes(word.Substring(1)); break; default: _alphaEngine = _alphaEngine.AddMustIncludes(word); break; } }
public void AddKeyword() { _alphaEngine = new AlphaEngine(_map); AlphaEngine alphaEngine = _alphaEngine .AddMustIncludes("hello", "hi", "hMM") .AddExcludes("he", "She", "mEn", "WOmen") .AddMustIncludes("AhA") .AddLeastIncludes("Ok", "There") .AddExcludes("How", "wheRe", "some"); SearchQuery query = (SearchQuery)GetInstanceField(typeof(AlphaEngine), alphaEngine, "_query"); Assert.Equal(new HashSet <string>() { "hello", "hi", "hmm", "aha" }, query.norms); Assert.Equal(new HashSet <string>() { "ok", "there" }, query.poss); Assert.Equal(new HashSet <string>() { "he", "she", "men", "women", "how", "where", "some" }, query.negs); }