コード例 #1
0
        public GroupedField(bool negate, List <string> names, List <object> values) : base(negate)
        {
            if (values.Count != 1 && values.Count != names.Count)
            {
                throw new FieldException(
                          "Invalid usage of multi value search. Size of values should be one or equal to size of names.");
            }

            Names      = names;
            FieldTypes = new List <EntityFieldType>();
            foreach (var x in values)
            {
                if (x is ITermValue)
                {
                    ITermValue termValue = (ITermValue)x;
                    TermValues.Add(termValue);
                }
                else
                {
                    Values.Add(x);
                }
                FieldTypes.Add(FieldUtils.DetectFieldType(x));
            }

            if (TermValues.Count > 0 && Values.Count > 0)
            {
                throw new FieldException("Invalid usage of multi value search. All values should be either term values or not.");
            }
        }
コード例 #2
0
 public IBooleanOperation Field(string fieldName, ITermValue fieldValue) => ApplyBinaryNode(SearchNode.FieldSearchNode(new SingleField(NegateNext, fieldName, fieldValue)));
コード例 #3
0
 public SingleField(bool negate, string name, ITermValue term) : base(negate)
 {
     Name      = name;
     TermValue = term;
     FieldType = FieldUtils.DetectFieldType(term.Value);
 }