Beispiel #1
0
 public override void ConvertToTermValue(Parser.QueryFieldValue value)
 {
     if (value.InputObject == null)
     {
         value.Set(String.Empty);
     }
     else
     {
         value.Set(((string)value.InputObject).ToLower());
     }
 }
Beispiel #2
0
        public override bool TryParseAndSet(Parser.QueryFieldValue value)
        {
            int intValue;

            if (Int32.TryParse(value.StringValue, out intValue))
            {
                value.Set(intValue.ToString());
            }
            else
            {
                value.Set(LucQuery.NullReferenceValue);
            }
            return(true);
        }
Beispiel #3
0
 public override bool TryParseAndSet(Parser.QueryFieldValue value)
 {
     // Set the parsed value.
     value.Set(value.StringValue.ToLower());
     // Successful.
     return(true);
 }
Beispiel #4
0
 public override bool TryParseAndSet(Parser.QueryFieldValue value)
 {
     value.Set(value.StringValue.ToLower());
     if (value.StringValue.StartsWith("/root"))
     {
         return(true);
     }
     return(false);
 }
Beispiel #5
0
        public override void ConvertToTermValue(Parser.QueryFieldValue value)
        {
            var path = ((string)value.InputObject).ToLower();

            if (!path.StartsWith("/root"))
            {
                throw new ApplicationException(String.Concat("Invalid path: '", path, "'. It must be absolute: '/root' or '/root/...'."));
            }
            value.Set(path);
        }
Beispiel #6
0
        public override bool TryParseAndSet(Parser.QueryFieldValue value)
        {
            DateTime dateTimeValue;

            if (!DateTime.TryParse(value.StringValue, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTimeValue))
            {
                return(false);
            }
            value.Set(dateTimeValue.Ticks);
            return(true);
        }
Beispiel #7
0
        public override bool TryParseAndSet(Parser.QueryFieldValue value)
        {
            Double doubleValue;

            if (!Double.TryParse(value.StringValue, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.InvariantCulture, out doubleValue))
            {
                return(false);
            }
            value.Set(doubleValue);
            return(true);
        }
Beispiel #8
0
        public override bool TryParseAndSet(Parser.QueryFieldValue value)
        {
            Int32 intValue;

            if (!Int32.TryParse(value.StringValue, out intValue))
            {
                return(false);
            }
            value.Set(intValue);
            return(true);
        }
Beispiel #9
0
        public override void ConvertToTermValue(Parser.QueryFieldValue value)
        {
            if (value.InputObject == null)
            {
                value.Set(LucQuery.NullReferenceValue);
                return;
            }
            var node = value.InputObject as Node;

            if (node != null)
            {
                value.Set(node.Id.ToString());
                return;
            }
            var enumerable = value as System.Collections.IEnumerable;

            if (enumerable != null)
            {
                throw new NotImplementedException("ReferenceIndexHandler.ConvertToTermValue() isn't implemented when value is IEnumerable.");
            }
            throw new NotSupportedException(String.Format("Type {0} is not supported as value of ReferenceField", value.InputObject.GetType().ToString()));
        }
Beispiel #10
0
        public override bool TryParseAndSet(Parser.QueryFieldValue value)
        {
            var v = value.StringValue.ToLower();

            if (YesList.Contains(v))
            {
                value.Set(YES);
                return(true);
            }
            if (NoList.Contains(v))
            {
                value.Set(NO);
                return(true);
            }
            bool b;

            if (Boolean.TryParse(v, out b))
            {
                value.Set(b ? YES : NO);
                return(true);
            }
            return(false);
        }
Beispiel #11
0
 public override void ConvertToTermValue(Parser.QueryFieldValue value)
 {
     value.Set((string)value.InputObject);
 }
Beispiel #12
0
 public override bool TryParseAndSet(Parser.QueryFieldValue value)
 {
     value.Set(value.StringValue);
     return(true);
 }
Beispiel #13
0
 public override void ConvertToTermValue(Parser.QueryFieldValue value)
 {
     value.Set(((DateTime)value.InputObject).Ticks);
 }
Beispiel #14
0
        public override void ConvertToTermValue(Parser.QueryFieldValue value)
        {
            var doubleValue = Convert.ToDouble(value.InputObject);

            value.Set(doubleValue);
        }
Beispiel #15
0
 public override void ConvertToTermValue(Parser.QueryFieldValue value)
 {
     value.Set(((bool)value.InputObject) ? YES : NO);
 }
Beispiel #16
0
 public override void ConvertToTermValue(Parser.QueryFieldValue value)
 {
     value.Set(value.InputObject.ToString());
 }