From 5f1b473020fa82b0846905b3894ff3861bee260b Mon Sep 17 00:00:00 2001 From: Karl Hobley Date: Fri, 8 Jun 2018 15:48:24 +0100 Subject: [PATCH] Simplify combinator query definitions Happy to accept a little bit of repeated code here --- wagtail/search/query.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/wagtail/search/query.py b/wagtail/search/query.py index 6044bdf182..3c60345299 100644 --- a/wagtail/search/query.py +++ b/wagtail/search/query.py @@ -46,28 +46,21 @@ class Boost(SearchQuery): # -# Operators +# Combinators # -class SearchQueryOperator(SearchQuery): - pass - - -class MultiOperandsSearchQueryOperator(SearchQueryOperator): +class And(SearchQuery): def __init__(self, subqueries): self.subqueries = subqueries -class And(MultiOperandsSearchQueryOperator): - pass +class Or(SearchQuery): + def __init__(self, subqueries): + self.subqueries = subqueries -class Or(MultiOperandsSearchQueryOperator): - pass - - -class Not(SearchQueryOperator): +class Not(SearchQuery): def __init__(self, subquery: SearchQuery): self.subquery = subquery