From fa52f59d75969fe91ffe46abb8dd8f7ae5ea0f6a Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Wed, 19 Oct 2016 20:33:17 +1300 Subject: [PATCH] Fix allterms with prefix on glass with uncommitted changes Glass aims to flush just the relevant postlist changes in this case but the end of the range to flush was wrong, so we'd only actually flush changes for a term exactly matching the prefix. Fixes #721 (cherry picked from commit 4a12d37f3b9dedfed36cc76eefd0f31dc9cc3b9b) --- xapian-core/backends/glass/glass_inverter.cc | 14 +++++++++++++- xapian-core/tests/api_queryparser.cc | 1 - 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/xapian-core/backends/glass/glass_inverter.cc b/xapian-core/backends/glass/glass_inverter.cc index 027611232..f8fe29f8a 100644 --- a/xapian-core/backends/glass/glass_inverter.cc +++ b/xapian-core/backends/glass/glass_inverter.cc @@ -187,7 +187,19 @@ Inverter::flush_post_lists(GlassPostListTable & table, const string & pfx) map::iterator i, begin, end; begin = postlist_changes.lower_bound(pfx); - end = postlist_changes.upper_bound(pfx); + string pfxinc = pfx; + while (true) { + if (pfxinc.back() != '\xff') { + ++pfxinc.back(); + end = postlist_changes.lower_bound(pfxinc); + break; + } + pfxinc.resize(pfxinc.size() - 1); + if (pfxinc.empty()) { + end = postlist_changes.end(); + break; + } + } for (i = begin; i != end; ++i) { table.merge_changes(i->first, i->second); diff --git a/xapian-core/tests/api_queryparser.cc b/xapian-core/tests/api_queryparser.cc index 37d7b803a..6b896c605 100644 --- a/xapian-core/tests/api_queryparser.cc +++ b/xapian-core/tests/api_queryparser.cc @@ -1056,7 +1056,6 @@ DEFINE_TESTCASE(qp_flag_wildcard3, writable) { doc.add_term("muscular"); doc.add_term("mutton"); db.add_document(doc); - db.commit(); // Test that a max of 0 doesn't set a limit. test_qp_flag_wildcard1_helper(db, 0, "z*"); -- 2.11.4.GIT