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)); }
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); }
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)); }
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); }