Cleanup
This commit is contained in:
		
							parent
							
								
									a3a14e9e17
								
							
						
					
					
						commit
						cfc50b82bb
					
				
					 1 changed files with 9 additions and 9 deletions
				
			
		| 
						 | 
					@ -376,20 +376,19 @@ class FindQuery:
 | 
				
			||||||
        container_type = get_origin(field_type)
 | 
					        container_type = get_origin(field_type)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if is_supported_container_type(container_type):
 | 
					        if is_supported_container_type(container_type):
 | 
				
			||||||
            # NOTE: A list of integers, like:
 | 
					            # NOTE: A list of strings, like:
 | 
				
			||||||
            #
 | 
					            #
 | 
				
			||||||
            #     luck_numbers: List[int] = field(index=True)
 | 
					            #     tarot_cards: List[str] = field(index=True)
 | 
				
			||||||
            #
 | 
					            #
 | 
				
			||||||
            # becomes a TAG field, which means that users cannot perform range
 | 
					            # becomes a TAG field, which means that users can run equality and
 | 
				
			||||||
            # queries on the values within the multi-value field, only equality
 | 
					            # membership queries on values.
 | 
				
			||||||
            # and membership queries.
 | 
					 | 
				
			||||||
            #
 | 
					            #
 | 
				
			||||||
            # Meanwhile, a list of RedisModels, like:
 | 
					            # Meanwhile, a list of RedisModels, like:
 | 
				
			||||||
            #
 | 
					            #
 | 
				
			||||||
            #     friends: List[Friend] = field(index=True)
 | 
					            #     friends: List[Friend] = field(index=True)
 | 
				
			||||||
            #
 | 
					            #
 | 
				
			||||||
            # is not itself directly indexed, but instead, we index any fields
 | 
					            # is not itself directly indexed, but instead, we index any fields
 | 
				
			||||||
            # within the model marked as `index=True`.
 | 
					            # within the model inside the list marked as `index=True`.
 | 
				
			||||||
            return RediSearchFieldTypes.TAG
 | 
					            return RediSearchFieldTypes.TAG
 | 
				
			||||||
        elif container_type is not None:
 | 
					        elif container_type is not None:
 | 
				
			||||||
            raise QuerySyntaxError("Only lists and tuples are supported for multi-value fields. "
 | 
					            raise QuerySyntaxError("Only lists and tuples are supported for multi-value fields. "
 | 
				
			||||||
| 
						 | 
					@ -399,9 +398,10 @@ class FindQuery:
 | 
				
			||||||
            # range queries.
 | 
					            # range queries.
 | 
				
			||||||
            return RediSearchFieldTypes.NUMERIC
 | 
					            return RediSearchFieldTypes.NUMERIC
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            # TAG fields are the default field type and support equality and membership queries,
 | 
					            # TAG fields are the default field type and support equality and
 | 
				
			||||||
            # though membership (and the multi-value nature of the field) are hidden from
 | 
					            # membership queries, though membership (and the multi-value nature
 | 
				
			||||||
            # users unless they explicitly index multiple values, with either a list or tuple,
 | 
					            # of the field) are hidden from users unless they explicitly index
 | 
				
			||||||
 | 
					            # multiple values, with either a list or tuple,
 | 
				
			||||||
            # e.g.,
 | 
					            # e.g.,
 | 
				
			||||||
            #    favorite_foods: List[str] = field(index=True)
 | 
					            #    favorite_foods: List[str] = field(index=True)
 | 
				
			||||||
            return RediSearchFieldTypes.TAG
 | 
					            return RediSearchFieldTypes.TAG
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue