@@ -268,12 +268,11 @@ def __ror__(self, other):
268268class SearchExpression (SearchCombinable , Expression ):
269269 output_field = FloatField ()
270270
271- def get_source_expressions (self ):
272- return []
273-
274271 def __str__ (self ):
275- args = ", " .join (map (str , self .get_source_expressions ()))
276- return f"{ self .search_type } ({ args } )"
272+ cls = self .identity [0 ]
273+ kwargs = dict (self .identity [1 :])
274+ arg_str = ", " .join (f"{ k } ={ v !r} " for k , v in kwargs .items ())
275+ return f"{ cls .__name__ } ({ arg_str } )"
277276
278277 def __repr__ (self ):
279278 return str (self )
@@ -321,8 +320,6 @@ def search_operator(self, compiler, connection):
321320
322321
323322class SearchEquals (SearchExpression ):
324- search_type = "equals"
325-
326323 def __init__ (self , path , value , score = None ):
327324 self .path = path
328325 self .value = value
@@ -575,8 +572,6 @@ def get_search_fields(self):
575572
576573
577574class SearchMoreLikeThis (SearchExpression ):
578- search_type = "more_like_this"
579-
580575 def __init__ (self , documents , score = None ):
581576 self .documents = documents
582577 self .score = score
@@ -653,8 +648,6 @@ def as_mql(self, compiler, connection):
653648
654649
655650class CompoundExpression (SearchExpression ):
656- search_type = "compound"
657-
658651 def __init__ (
659652 self ,
660653 must = None ,
@@ -703,8 +696,6 @@ def negate(self):
703696
704697
705698class CombinedSearchExpression (SearchExpression ):
706- search_type = "combined"
707-
708699 def __init__ (self , lhs , operator , rhs ):
709700 self .lhs = lhs
710701 self .operator = operator
0 commit comments