public void NestedQueryTest()
        {
            var input   = " ( AND  (\tAND mir da) (NOT me) (OR tra (AND b c)))";
            var query   = (BooleanQueryOperationAnd)BooleanQueryLanguage.ParseQuery(input);
            var orQuery = (BooleanQueryOperationOr)query.Elements[2];

            AssertAnd(query.Elements[0], "mir da".Split());
            AssertNot(query.Elements[1], "me");
            AssertTerm(orQuery.Elements[0], "tra");
            AssertAnd(orQuery.Elements[1], "b c".Split());
        }
예제 #2
0
        private async Task <DocumentId[]> ExecuteQuery(string query)
        {
            var booleanQuery = BooleanQueryLanguage.ParseQuery(query);

            DocumentId[] documentId = await Task.Run(() =>
            {
                lock (engine)
                {
                    return(engine.Value.ExecuteQuery(booleanQuery).ToArray());
                }
            });

            return(documentId);
        }
        public void OperatorOrTakesAtLeastOneArgument(string input, string expected)
        {
            var query = BooleanQueryLanguage.ParseQuery(input);

            AssertOr(query, expected.Split());
        }
 public void OperatorNotThrowsExceptionInCaseOfInvalidNumberOfArguments(string input)
 {
     Assert.Throws <InvalidOperationException>(() => BooleanQueryLanguage.ParseQuery(input));
 }
        public void OperatorNotTakesExactlyOneArgument(string input, string word)
        {
            var query = BooleanQueryLanguage.ParseQuery(input);

            AssertNot(query, word);
        }
        public void TermIsASequenceOfAlphaNumericCharacters(string input, string word)
        {
            var term = BooleanQueryLanguage.ParseQuery(input);

            AssertTerm(term, word);
        }