@@ -83,26 +83,29 @@ private FilterQuery ParseFilterOperation(AttrAttribute attribute, string value)
8383 if ( value . Length < 3 )
8484 return new FilterQuery ( attribute , value , FilterOperations . eq ) ;
8585
86- var prefix = value . Substring ( 0 , 3 ) ;
86+ var operation = value . Split ( ':' ) ;
8787
88- if ( prefix [ 2 ] != ':' )
88+ if ( operation . Length == 1 )
8989 return new FilterQuery ( attribute , value , FilterOperations . eq ) ;
9090
9191 // remove prefix from value
92- value = value . Substring ( 3 , value . Length - 3 ) ;
92+ var prefix = operation [ 0 ] ;
93+ value = operation [ 1 ] ;
9394
9495 switch ( prefix )
9596 {
96- case "eq: " :
97+ case "eq" :
9798 return new FilterQuery ( attribute , value , FilterOperations . eq ) ;
98- case "lt: " :
99+ case "lt" :
99100 return new FilterQuery ( attribute , value , FilterOperations . lt ) ;
100- case "gt: " :
101+ case "gt" :
101102 return new FilterQuery ( attribute , value , FilterOperations . gt ) ;
102- case "le: " :
103+ case "le" :
103104 return new FilterQuery ( attribute , value , FilterOperations . le ) ;
104- case "ge: " :
105+ case "ge" :
105106 return new FilterQuery ( attribute , value , FilterOperations . ge ) ;
107+ case "like" :
108+ return new FilterQuery ( attribute , value , FilterOperations . like ) ;
106109 }
107110
108111 throw new JsonApiException ( "400" , $ "Invalid filter prefix '{ prefix } '") ;
0 commit comments