Re: how to search for hyphenated words? (was: how to search for Morse code?)
Matt Armstrong writes: > Carl Worth writes: > >> Hi Gregor, >> >> The trick here is that when notmuch is indexing body text it feeds it >> into a Xapian function that parses the text by finding "terms" in the >> text. And this parser considers both punctuation and whitespace as >> separators between terms. > > I notice that Xapian supports something called "phrase searches", > documented as: > > "A phrase surrounded with double quotes ("") matches documents > containing that exact phrase. Hyphenated words are also treated as > phrases, as are cases such as filenames and email addresses > (e.g. /etc/passwd or presid...@whitehouse.gov)." > > I assume that this particular Xapian feature is unavailable in notmuch? > If so, I wonder if enabling has ever been considered? It is enabled, and documented in notmuch-search-terms(7). Unfortunately I don't think it's related to the original request. The mention of hyphenated words is about the input to the query parser, not the (necessarily) the retrieved text. d ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 1/2] test/T030-config: Separate stdout and stderr output
POSIX doesn't specify the flushing behaviour of the STDOUT stream, so it's invalid to assume a particular order between the stdout and stderr output. The current test breaks on musl due to this. --- test/T030-config.sh | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/T030-config.sh b/test/T030-config.sh index f36695c6..eba2e0e7 100755 --- a/test/T030-config.sh +++ b/test/T030-config.sh @@ -43,7 +43,8 @@ notmuch config set foo.nonexistent test_expect_equal "$(notmuch config get foo.nonexistent)" "" test_begin_subtest "List all items" -notmuch config list 2>&1 | notmuch_config_sanitize > OUTPUT +notmuch config list > STDOUT 2> STDERR +printf "%s\n\n%s\n" "$(< STDOUT)" "$(< STDERR)" | notmuch_config_sanitize > OUTPUT if [ "${NOTMUCH_GMIME_MAJOR}" -lt 3 ]; then config_gpg_path="crypto.gpg_path=gpg @@ -51,7 +52,6 @@ if [ "${NOTMUCH_GMIME_MAJOR}" -lt 3 ]; then fi cat < EXPECTED -Error opening database at MAIL_DIR/.notmuch: No such file or directory database.path=MAIL_DIR user.name=Notmuch Test Suite user.primary_email=test_su...@notmuchmail.org @@ -65,6 +65,8 @@ foo.list=this;is another;list value; built_with.compact=something built_with.field_processor=something built_with.retry_lock=something + +Error opening database at MAIL_DIR/.notmuch: No such file or directory EOF test_expect_equal_file EXPECTED OUTPUT -- 2.21.0 ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 2/2] Prepend regerror() messages with "regexp error: "
The exact error messages returned by regerror() aren't standardized; relying on them isn't portable. Thus, add a a prefix to make clear that the subsequent message is a regexp parsing error, and only look for this prefix in the test suite, ignoring the rest of the message. --- lib/regexp-fields.cc | 4 ++-- test/T650-regexp-query.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/regexp-fields.cc b/lib/regexp-fields.cc index 084bc8c0..f50da9a3 100644 --- a/lib/regexp-fields.cc +++ b/lib/regexp-fields.cc @@ -35,9 +35,9 @@ compile_regex (regex_t ®exp, const char *str) if (err != 0) { size_t len = regerror (err, ®exp, NULL, 0); char *buffer = new char[len]; - std::string msg; + std::string msg = "Regexp error: "; (void) regerror (err, ®exp, buffer, len); - msg.assign (buffer, len); + msg.append (buffer, len); delete[] buffer; throw Xapian::QueryParserError (msg); diff --git a/test/T650-regexp-query.sh b/test/T650-regexp-query.sh index 4085340f..31b3d036 100755 --- a/test/T650-regexp-query.sh +++ b/test/T650-regexp-query.sh @@ -137,10 +137,10 @@ EOF test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "regexp error reporting" -notmuch search 'from:/unbalanced[/' 1>OUTPUT 2>&1 +notmuch search 'from:/unbalanced[/' 2>&1 | sed -e '/^A Xapian/ s/[^:]*$//' > OUTPUT cat < EXPECTED notmuch search: A Xapian exception occurred -A Xapian exception occurred parsing query: Invalid regular expression +A Xapian exception occurred parsing query: Regexp error: Query string was: from:/unbalanced[/ EOF test_expect_equal_file EXPECTED OUTPUT -- 2.21.0 ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] test: Ignore subtly different behaviour of the musl libc
Luis Ressel writes: > If you really consider it important to convey the info that there was a > regex parsing error, I can submit a patch to make compile_regex() prefix > the regerror output with "regex error: " or sth like that. That sounds good. The exception loses all location information at the C boundary, so the message is all we have. The test was originally added to make sure the regexp error checking (such as it is) was working, and I'd like to preserve that if possible. d ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: how to search for hyphenated words? (was: how to search for Morse code?)
Gregor Zattler writes: > Hi David, notmuch developers, > * David Bremner [2019-03-10; 20:22]: >> Gregor Zattler writes: >>> How would one search for hyphenated words with notmuch? >>> >> >> In special cases, explained in notmuch-search-terms(7), one can use >> regexp searches, which are slower, but don't drop punctuation. > > thanks, this works for the subject: field, which helps a lot. > > Regexes do not work on the body of messages and I assume they > will not work with the upcoming "body:" field? That's correct. d ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: how to search for hyphenated words? (was: how to search for Morse code?)
Hi David, notmuch developers, * David Bremner [2019-03-10; 20:22]: > Gregor Zattler writes: >> How would one search for hyphenated words with notmuch? >> > > In special cases, explained in notmuch-search-terms(7), one can use > regexp searches, which are slower, but don't drop punctuation. thanks, this works for the subject: field, which helps a lot. Regexes do not work on the body of messages and I assume they will not work with the upcoming "body:" field? Thanks for your attention, Gregor ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch