all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Arun Isaac <arunisaac@systemreboot.net>
To: 60410@debbugs.gnu.org, Ricardo Wurmus <rekado@elephly.net>
Cc: Arun Isaac <arunisaac@systemreboot.net>
Subject: [bug#60410] [PATCH 2/7] xapian: Declare some prefixes as boolean.
Date: Thu, 29 Dec 2022 20:23:55 +0000	[thread overview]
Message-ID: <20221229202400.28565-2-arunisaac@systemreboot.net> (raw)
In-Reply-To: <20221229201809.27997-1-arunisaac@systemreboot.net>

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





  parent reply	other threads:[~2022-12-29 20:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-29 20:18 [bug#60410] [PATCH 0/7] mumi: Boolean prefixes in xapian indexing and others Arun Isaac
2022-12-29 20:23 ` [bug#60410] [PATCH 1/7] xapian: Index several terms as boolean and without positions Arun Isaac
2022-12-31 18:09   ` Ricardo Wurmus
2022-12-31 23:02     ` Arun Isaac
2023-01-01 12:14       ` bug#60410: " Ricardo Wurmus
2022-12-29 20:23 ` Arun Isaac [this message]
2023-01-01 23:19   ` [bug#60410] [PATCH 2/7] xapian: Declare some prefixes as boolean Ricardo Wurmus
2023-01-02 17:01     ` Arun Isaac
2022-12-29 20:23 ` [bug#60410] [PATCH 3/7] xapian: Do not override the default OR implicit query operator Arun Isaac
2022-12-29 20:23 ` [bug#60410] [PATCH 4/7] messages: Remove unused set intersection feature in search-bugs Arun Isaac
2022-12-29 20:23 ` [bug#60410] [PATCH 5/7] messages: Offload limiting search results to xapian Arun Isaac
2022-12-29 20:23 ` [bug#60410] [PATCH 6/7] cache: Specify that cache! returns the cached value Arun Isaac
2022-12-29 20:24 ` [bug#60410] [PATCH 7/7] xapian: Preserve order of search results Arun Isaac

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221229202400.28565-2-arunisaac@systemreboot.net \
    --to=arunisaac@systemreboot.net \
    --cc=60410@debbugs.gnu.org \
    --cc=rekado@elephly.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.