From 2690fd58e871f09a8ad5e43ce5a1fe89539aaad5 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Mon, 21 Sep 2026 15:08:05 +0100 Subject: Add query-phrase. --- xapian/xapian.scm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'xapian/xapian.scm') diff --git a/xapian/xapian.scm b/xapian/xapian.scm index e83fae0..caa84b4 100644 --- a/xapian/xapian.scm +++ b/xapian/xapian.scm @@ -57,6 +57,7 @@ query-or query-xor query-filter + query-phrase prefixed-range-processor suffixed-range-processor prefixed-date-range-processor @@ -325,6 +326,19 @@ In a non-weighted context, @code{query-filter} and @code{query-and} are equivalent." (apply query-combine (Query-OP-FILTER) (Query-MatchAll) 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}. + +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))) + + (define* (prefixed-range-processor slot proc #:key (prefix "") repeated?) "Return a @code{RangeProcessor} object that calls @var{proc} to process its range over @var{slot}. -- cgit 1.4.1