about summary refs log tree commit diff
path: root/xapian
diff options
context:
space:
mode:
Diffstat (limited to 'xapian')
-rw-r--r--xapian/xapian.scm27
1 files changed, 10 insertions, 17 deletions
diff --git a/xapian/xapian.scm b/xapian/xapian.scm
index d71bbe1..00a4896 100644
--- a/xapian/xapian.scm
+++ b/xapian/xapian.scm
@@ -299,17 +299,12 @@ on the database object."
   "Return a @code{Query} object for @var{term}."
   (new-Query term))
 
-(define (query-combine combine-operator default . queries)
-  (reduce-right (cut new-Query combine-operator <> <>)
-                default
-                queries))
-
 (define (query-and . queries)
   "Return a query matching only documents matching all @var{queries}.
 
 In a weighted context, the weight is the sum of the weights for all
 queries."
-  (apply query-combine (Query-OP-AND) (Query-MatchAll) queries))
+  (guile-xapian-build-query (Query-OP-AND) queries))
 
 (define (query-or . queries)
   "Return a query matching documents which at least one of @var{queries}
@@ -317,7 +312,7 @@ match.
 
 In a weighted context, the weight is the sum of the weights for
 matching queries."
-  (apply query-combine (Query-OP-OR) (Query-MatchNothing) queries))
+  (guile-xapian-build-query (Query-OP-OR) queries))
 
 (define (query-xor . queries)
   "Return a query matching documents which an odd number of @var{queries}
@@ -325,7 +320,7 @@ match.
 
 In a weighted context, the weight is the sum of the weights for
 matching queries."
-  (apply query-combine (Query-OP-XOR) (Query-MatchNothing) queries))
+  (guile-xapian-build-query (Query-OP-XOR) queries))
 
 (define (query-filter . queries)
   "Return a query matching only documents matching all @var{queries},
@@ -333,19 +328,17 @@ but only take weight from the first of @var{queries}.
 
 In a non-weighted context, @code{query-filter} and @code{query-and}
 are equivalent."
-  (apply query-combine (Query-OP-FILTER) (Query-MatchAll) queries))
+  (guile-xapian-build-query (Query-OP-FILTER) queries))
 
-(define (query-phrase first-query . other-queries)
-  "Return a query matching only documents where @var{first-query} and all
-of @var{other-queries} match near and in order. All queries must be
-single-term queries (constructed using @code{query}) or single-term
-queries composed with @code{query-or}.
+(define (query-phrase . queries)
+  "Return a query matching only documents where all @var{queries} match
+near and in order. All queries must be single-term
+queries (constructed using @code{query}) or single-term queries
+composed with @code{query-or}.
 
 In a weighted context, the weight is the sum of the weights for all
 queries."
-  (new-Query (Query-OP-PHRASE)
-             first-query
-             (apply query-or other-queries)))
+  (guile-xapian-build-query (Query-OP-PHRASE) queries))
 
 
 (define* (prefixed-range-processor slot proc #:key (prefix "") repeated?)