VOL-3190 throw error message when filter or order on struct

Change-Id: If15983350d3f1a6fd21e5bfcec33ae57808cc31f
diff --git a/pkg/filter/filter.go b/pkg/filter/filter.go
index 2498fa2..ffab11e 100644
--- a/pkg/filter/filter.go
+++ b/pkg/filter/filter.go
@@ -166,7 +166,7 @@
 	}
 
 	if val.Kind() != reflect.Struct {
-		return false, fmt.Errorf("Dotted field name specified in filter did not resolve to a valid field")
+		return false, fmt.Errorf("Field name specified in filter did not resolve to a valid field")
 	}
 
 	field := val.FieldByName(k)
@@ -174,6 +174,15 @@
 		return false, fmt.Errorf("Failed to find field %s while filtering", k)
 	}
 
+	// we might have a pointer to a struct at this time, so dereference it
+	if field.Kind() == reflect.Ptr {
+		field = reflect.Indirect(field)
+	}
+
+	if field.Kind() == reflect.Struct {
+		return false, fmt.Errorf("Cannot filter on a field that is a struct")
+	}
+
 	if (field.Kind() == reflect.Slice) || (field.Kind() == reflect.Array) {
 		// For an array, check to see if any item matches
 		someMatch := false