private void VisitOrderBy(LambdaExpression expression, bool descending) { var propertyInfo = ((MemberExpression)expression.Body).Member as PropertyInfo; var fieldInfo = ((MemberExpression)expression.Body).Member as FieldInfo; var expressionMemberInfo = GetMember(expression.Body); var type = propertyInfo != null ? propertyInfo.PropertyType : (fieldInfo != null ? fieldInfo.FieldType : typeof(object)); luceneQuery.AddOrder(expressionMemberInfo.Path, descending, type); }