Opened 7 years ago
Last modified 7 years ago
#755 new enhancement
propose fixes for syntax errors for queries
Reported by: | Daniel Kahn Gillmor | Owned by: | Olly Betts |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Other | Version: | |
Severity: | normal | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Operating System: | All |
Description
sometimes xapian throws an error when a specific syntax is bad, like:
Didn't understand date specification '1wek..'
it might be friendly to be able to propose candidates that would be acceptable queries, similar to how git does when a subcommand is mis-written:
0 dkg@alice:~$ git comit git: 'comit' is not a git command. See 'git --help'. The most similar command is commit 1 dkg@alice:~$
For the example above, it could say something like:
Didn't understand date specification '1wek..' Perhaps you meant '1week..' ?
Change History (2)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
Sorry if my example was notmuch-specific, i'm not sure of the boundaries between xapian and notmuch here.
But yes, i'd be happy with any lower-hanging fruit that xapian could handle. helping users get better search results is often an iterative process, particularly if they're still struggling with basic syntax.
Notmuch should be able to raise the concerns about any mistakes made at the notmuch layer, but if xapian could report or suggestion fixes at its own syntax errors, that would be a great model for notmuch to build on top of.
thanks for considering this!
The specific example you give looks like a trickier case to deal with since xapian doesn't know anything about "1week" as a format.
I'm guessing that error is coming from notmuch's date handling. We could perhaps provide a mechanism so that notmuch could provide a correction for
1wek
which would get fitted into the query string to give a full correction, but there are probably lower hanging fruit - e.g. when the parser currently reports a syntax error.