about summary refs log tree commit homepage
path: root/lib/PublicInbox/xh_mset.h
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-12-08 03:54:33 +0000
committerEric Wong <e@80x24.org>2023-12-09 02:03:47 +0000
commit305e237b9e22ffed1b009f8f2b12bf99e8856748 (patch)
treeed5f2b4e3beb4d0d048088dc99483ac332f3841a /lib/PublicInbox/xh_mset.h
parentc5515401eb4f51998c8444afee9e8f6db1e8d514 (diff)
downloadpublic-inbox-305e237b9e22ffed1b009f8f2b12bf99e8856748.tar.gz
Xapian has always sorted termlist iterators, so we now:

1) break out of the iterator loop early on non-matches
2) avoid doing sorting ourselves

As a result, we'll also favor the wantarray forms of xap_terms
and all_terms to preserve sort order in most cases.

Confirmed by the Xapian maintainer: <20231201184844.GO4059@survex.com>

Link: https://lists.xapian.org/pipermail/xapian-discuss/2023-December/010013.html
Diffstat (limited to 'lib/PublicInbox/xh_mset.h')
-rw-r--r--lib/PublicInbox/xh_mset.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/PublicInbox/xh_mset.h b/lib/PublicInbox/xh_mset.h
index 056fe22b..4e97a284 100644
--- a/lib/PublicInbox/xh_mset.h
+++ b/lib/PublicInbox/xh_mset.h
@@ -11,7 +11,7 @@ static void emit_doc_term(FILE *fp, const char *pfx, Xapian::Document *doc)
 
         for (cur.skip_to(pfx); cur != end; cur++) {
                 std::string tn = *cur;
-                if (!starts_with(&tn, pfx, pfx_len)) continue;
+                if (!starts_with(&tn, pfx, pfx_len)) break;
                 fputc(0, fp);
                 fwrite(tn.data(), tn.size(), 1, fp);
         }