about summary refs log tree commit diff
path: root/xapian
diff options
context:
space:
mode:
authorArun Isaac2026-09-21 14:58:08 +0100
committerArun Isaac2026-09-23 02:00:51 +0100
commitfd596deb7137afe0f08bc3d990ca3470fc23c15b (patch)
treeb13b2a8a1a04b8c2f96dd9c8365db5932bd3130e /xapian
parentf103ebe68d30b37a6138c273085f3b25d1876162 (diff)
downloadguile-xapian-fd596deb7137afe0f08bc3d990ca3470fc23c15b.tar.gz
guile-xapian-fd596deb7137afe0f08bc3d990ca3470fc23c15b.tar.lz
guile-xapian-fd596deb7137afe0f08bc3d990ca3470fc23c15b.zip
Add query-xor.
Diffstat (limited to 'xapian')
-rw-r--r--xapian/xapian.scm11
1 files changed, 10 insertions, 1 deletions
diff --git a/xapian/xapian.scm b/xapian/xapian.scm
index c769a98..e83fae0 100644
--- a/xapian/xapian.scm
+++ b/xapian/xapian.scm
@@ -1,5 +1,5 @@
 ;;; guile-xapian --- Guile bindings for Xapian
-;;; Copyright © 2020, 2022, 2024, 2025 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2020, 2022, 2024–2026 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2021 Bob131 <bob@bob131.so>
 ;;;
 ;;; This file is part of guile-xapian.
@@ -55,6 +55,7 @@
             query
             query-and
             query-or
+            query-xor
             query-filter
             prefixed-range-processor
             suffixed-range-processor
@@ -308,6 +309,14 @@ In a weighted context, the weight is the sum of the weights for
 matching queries."
   (apply query-combine (Query-OP-OR) (Query-MatchNothing) queries))
 
+(define (query-xor . queries)
+  "Return a query matching documents which an odd number of @var{queries}
+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))
+
 (define (query-filter . queries)
   "Return a query matching only documents matching all @var{queries},
 but only take weight from the first of @var{queries}.