[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#60410] [PATCH 2/7] xapian: Declare some prefixes as boolean.
From: |
Arun Isaac |
Subject: |
[bug#60410] [PATCH 2/7] xapian: Declare some prefixes as boolean. |
Date: |
Thu, 29 Dec 2022 20:23:55 +0000 |
Some prefixes will only ever be used to filter the rest of the query
and not for matching approximately using relevance weighting
schemes. Such prefixes should be indexed as boolean prefixes.
* mumi/xapian.scm (parse-query*): Support boolean prefixes.
(search): Declare author, msgid, owner, severity, status, submitter
and tag as boolean prefixes.
---
mumi/xapian.scm | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/mumi/xapian.scm b/mumi/xapian.scm
index 06a54cd..7bf84d3 100644
--- a/mumi/xapian.scm
+++ b/mumi/xapian.scm
@@ -249,7 +249,7 @@ messages and index their contents in the Xapian database at
DBPATH."
(invalid (pk invalid "")))
token))
-(define* (parse-query* querystring #:key stemmer stemming-strategy (prefixes
'()))
+(define* (parse-query* querystring #:key stemmer stemming-strategy (prefixes
'()) (boolean-prefixes '()))
(let ((queryparser (new-QueryParser))
(date-range-processor (new-DateRangeProcessor 0 "date:" 0))
(mdate-range-processor (new-DateRangeProcessor 1 "mdate:" 0)))
@@ -261,6 +261,10 @@ messages and index their contents in the Xapian database
at DBPATH."
((field . prefix)
(QueryParser-add-prefix queryparser field prefix)))
prefixes)
+ (for-each (match-lambda
+ ((field . prefix)
+ (QueryParser-add-boolean-prefix queryparser field prefix)))
+ boolean-prefixes)
(QueryParser-add-rangeprocessor queryparser date-range-processor)
(QueryParser-add-rangeprocessor queryparser mdate-range-processor)
(let ((query (QueryParser-parse-query queryparser querystring
@@ -324,14 +328,14 @@ intact."
;; prefixes for field search.
(query (parse-query* querystring*
#:stemmer (make-stem "en")
- #:prefixes '(("submitter" . "A")
- ("author" . "XA")
- ("subject" . "S")
- ("owner" . "XO")
- ("severity" . "XS")
- ("tag" . "XT")
- ("status" . "XSTATUS")
- ("msgid" . "XU"))))
+ #:prefixes '(("subject" . "S"))
+ #:boolean-prefixes '(("author" . "XA")
+ ("msgid" . "XU")
+ ("owner" . "XO")
+ ("severity" . "XS")
+ ("status" .
"XSTATUS")
+ ("submitter" . "A")
+ ("tag" . "XT"))))
(enq (enquire db query)))
;; Collapse on mergedwith value
(Enquire-set-collapse-key enq 2 1)
--
2.38.1
- [bug#60410] [PATCH 0/7] mumi: Boolean prefixes in xapian indexing and others, Arun Isaac, 2022/12/29
- [bug#60410] [PATCH 1/7] xapian: Index several terms as boolean and without positions., Arun Isaac, 2022/12/29
- [bug#60410] [PATCH 4/7] messages: Remove unused set intersection feature in search-bugs., Arun Isaac, 2022/12/29
- [bug#60410] [PATCH 5/7] messages: Offload limiting search results to xapian., Arun Isaac, 2022/12/29
- [bug#60410] [PATCH 7/7] xapian: Preserve order of search results., Arun Isaac, 2022/12/29
- [bug#60410] [PATCH 3/7] xapian: Do not override the default OR implicit query operator., Arun Isaac, 2022/12/29
- [bug#60410] [PATCH 2/7] xapian: Declare some prefixes as boolean.,
Arun Isaac <=
- [bug#60410] [PATCH 6/7] cache: Specify that cache! returns the cached value., Arun Isaac, 2022/12/29