@@ -263,12 +263,11 @@ def __ror__(self, other):
263
263
class SearchExpression (SearchCombinable , Expression ):
264
264
output_field = FloatField ()
265
265
266
- def get_source_expressions (self ):
267
- return []
268
-
269
266
def __str__ (self ):
270
- args = ", " .join (map (str , self .get_source_expressions ()))
271
- return f"{ self .search_type } ({ args } )"
267
+ cls = self .identity [0 ]
268
+ kwargs = dict (self .identity [1 :])
269
+ arg_str = ", " .join (f"{ k } ={ v !r} " for k , v in kwargs .items ())
270
+ return f"{ cls .__name__ } ({ arg_str } )"
272
271
273
272
def __repr__ (self ):
274
273
return str (self )
@@ -316,8 +315,6 @@ def search_operator(self, compiler, connection):
316
315
317
316
318
317
class SearchEquals (SearchExpression ):
319
- search_type = "equals"
320
-
321
318
def __init__ (self , path , value , score = None ):
322
319
self .path = path
323
320
self .value = value
@@ -570,8 +567,6 @@ def get_search_fields(self):
570
567
571
568
572
569
class SearchMoreLikeThis (SearchExpression ):
573
- search_type = "more_like_this"
574
-
575
570
def __init__ (self , documents , score = None ):
576
571
self .documents = documents
577
572
self .score = score
@@ -648,8 +643,6 @@ def as_mql(self, compiler, connection):
648
643
649
644
650
645
class CompoundExpression (SearchExpression ):
651
- search_type = "compound"
652
-
653
646
def __init__ (
654
647
self ,
655
648
must = None ,
@@ -698,8 +691,6 @@ def negate(self):
698
691
699
692
700
693
class CombinedSearchExpression (SearchExpression ):
701
- search_type = "combined"
702
-
703
694
def __init__ (self , lhs , operator , rhs ):
704
695
self .lhs = lhs
705
696
self .operator = operator
0 commit comments