2424#include < variant>
2525#include < array>
2626#include < type_traits>
27- #include < iostream>
2827
2928#include " utils/mu-option.hh"
3029#include < glib.h>
@@ -162,7 +161,7 @@ range(const Field& field, Sexp&& s)
162161 " unsupported range field {}" , field.name );
163162
164163 if (r0->empty () && r1->empty ())
165- return Xapian::Query::MatchAll;
164+ return Xapian::Query::MatchNothing; // empty range matches nothing.
166165 else if (r0->empty () && !r1->empty ())
167166 return Xapian::Query (Xapian::Query::OP_VALUE_LE,
168167 field.value_no (), *r1);
@@ -428,6 +427,21 @@ test_xapian()
428427 auto && dbpath{runtime_path (RuntimePath::XapianDb, testhome)};
429428 auto && store{unwrap (Store::make_new (dbpath, join_paths (testhome, " test-maildir" )))};
430429
430+ // Xapian internal format (get_description()) is _not_ guaranteed
431+ // to be the same between versions
432+ auto && zz{make_xapian_query (store, R"( subject:"hello world")" )};
433+ assert_valid_result (zz);
434+ if (zz->get_description () != R"( Query((Shello PHRASE 2 Sworld)))" ) {
435+ if (mu_test_mu_hacker ()) {
436+ // in the mu hacker case, we want to be warned if Xapian changed.
437+ g_critical (" xapian version mismatch" );
438+ g_assert_true (false );
439+ } else {
440+ g_test_skip (" incompatible xapian descriptions" );
441+ return ;
442+ }
443+ }
444+
431445 std::vector<TestCase> cases = {
432446
433447@@ -442,7 +456,7 @@ test_xapian()
442456 TestCase{R"( size:10..")" , R"( Query(VALUE_GE 17 ga))" },
443457 TestCase{R"( size:..10")" , R"( Query(VALUE_LE 17 ga))" },
444458 TestCase{R"( size:10")" , R"( Query(VALUE_RANGE 17 ga ga))" }, // change?
445- TestCase{R"( size:..")" , R"( Query(<alldocuments> ))" },
459+ TestCase{R"( size:..")" , R"( Query())" },
446460 };
447461
448462 for (auto && test: cases) {
0 commit comments