Esempio n. 1
0
        //--- Methods ---
        public void And(string constraint)
        {
            if (string.IsNullOrEmpty(constraint))
            {
                return;
            }
            var clauses          = LuceneClauseParser.Parse(constraint);
            var unprefixedClause = new StringBuilder();
            var clauseCount      = 0;

            foreach (var unprefixed in clauses.Unprefixed)
            {
                if (clauseCount > 0)
                {
                    unprefixedClause.Append(" ");
                }
                unprefixedClause.Append(unprefixed);
                clauseCount++;
            }
            if (clauseCount > 0)
            {
                if (clauseCount > 1)
                {
                    PadAndAppend("+(" + unprefixedClause + ")");
                }
                else
                {
                    PadAndAppend("+" + unprefixedClause);
                }
            }
            AppendClauses(clauses.PlusPrefixed);
            AppendClauses(clauses.MinusPrefixed);
        }
        //--- Class Methods ---
        public static Clauses Parse(string clause)
        {
            var c = new LuceneClauseParser(clause);

            c.Parse();
            return(new Clauses(c._unprefixed, c._plusPrefixed, c._minusPrefixed));
        }
Esempio n. 3
0
 //--- Class Methods ---
 public static Clauses Parse(string clause) {
     var c = new LuceneClauseParser(clause);
     c.Parse();
     return new Clauses(c._unprefixed, c._plusPrefixed, c._minusPrefixed);
 }