@@ -268,12 +268,11 @@ def __ror__(self, other):
268
268
class SearchExpression (SearchCombinable , Expression ):
269
269
output_field = FloatField ()
270
270
271
- def get_source_expressions (self ):
272
- return []
273
-
274
271
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 } )"
277
276
278
277
def __repr__ (self ):
279
278
return str (self )
@@ -321,8 +320,6 @@ def search_operator(self, compiler, connection):
321
320
322
321
323
322
class SearchEquals (SearchExpression ):
324
- search_type = "equals"
325
-
326
323
def __init__ (self , path , value , score = None ):
327
324
self .path = path
328
325
self .value = value
@@ -575,8 +572,6 @@ def get_search_fields(self):
575
572
576
573
577
574
class SearchMoreLikeThis (SearchExpression ):
578
- search_type = "more_like_this"
579
-
580
575
def __init__ (self , documents , score = None ):
581
576
self .documents = documents
582
577
self .score = score
@@ -653,8 +648,6 @@ def as_mql(self, compiler, connection):
653
648
654
649
655
650
class CompoundExpression (SearchExpression ):
656
- search_type = "compound"
657
-
658
651
def __init__ (
659
652
self ,
660
653
must = None ,
@@ -703,8 +696,6 @@ def negate(self):
703
696
704
697
705
698
class CombinedSearchExpression (SearchExpression ):
706
- search_type = "combined"
707
-
708
699
def __init__ (self , lhs , operator , rhs ):
709
700
self .lhs = lhs
710
701
self .operator = operator
0 commit comments