예제 #1
0
        public static int GetStoredValue <TObj>(
            this Document document,
            Expression <Func <TObj, int> > expression)
        {
            string name  = ExpressionExtensions.GetIndexName(expression);
            string value = document.GetField(name)?.StringValue ?? "0";

            return(int.Parse(value));
        }
예제 #2
0
        public static string GetStoredValue <TObj>(
            this Document document,
            Expression <Func <TObj, string> > expression)
        {
            string name  = ExpressionExtensions.GetIndexName(expression);
            string value = document.GetField(name)?.StringValue;

            return(value);
        }
예제 #3
0
        public static BooleanQuery AddPhraseQuery <TObj>(
            this BooleanQuery instance,
            Expression <Func <TObj, string> > expression,
            string value,
            Occur occur)
        {
            string indexName = ExpressionExtensions.GetIndexName(expression);

            return(instance.AddPhraseQuery(indexName, value, occur));
        }
예제 #4
0
        public static BooleanQuery AddNumericRangeQuery <TObj>(
            this BooleanQuery instance,
            Expression <Func <TObj, int?> > expression,
            int lowerInclusive,
            int upperInclusive,
            Occur occur)
        {
            string indexName = ExpressionExtensions.GetIndexName(expression);
            var    query     = NumericRangeQuery.NewIntRange(indexName, lowerInclusive, upperInclusive, true, true);

            instance.Add(query, occur);
            return(instance);
        }