about summary refs log tree commit diff
path: root/xapian
diff options
context:
space:
mode:
authorArun Isaac2026-09-21 15:08:05 +0100
committerArun Isaac2026-09-23 02:00:51 +0100
commit2690fd58e871f09a8ad5e43ce5a1fe89539aaad5 (patch)
treeb1d4299a607055e6499e78dfa577a52ab5fb6ea5 /xapian
parentfd596deb7137afe0f08bc3d990ca3470fc23c15b (diff)
downloadguile-xapian-2690fd58e871f09a8ad5e43ce5a1fe89539aaad5.tar.gz
guile-xapian-2690fd58e871f09a8ad5e43ce5a1fe89539aaad5.tar.lz
guile-xapian-2690fd58e871f09a8ad5e43ce5a1fe89539aaad5.zip
Add query-phrase.
Diffstat (limited to 'xapian')
-rw-r--r--xapian/xapian.scm14
1 files changed, 14 insertions, 0 deletions
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}.