lib: implement new query parser
mu's query parser is the piece of software that turns your queries
into something the Xapian database can understand. So, if you query
"maildir:/inbox and subject:bla" this must be translated into a
Xapian::Query object which will retrieve the sought after messages.
Since mu's beginning, almost a decade ago, this parser was based on
Xapian's default Xapian::QueryParser. It works okay, but wasn't really
designed for the mu use-case, and had a bit of trouble with anything
that's not A..Z (think: spaces, special characters, unicode etc.).
Over the years, mu added quite a bit of pre-processing trickery to
deal with that. Still, there were corner cases and bugs that were
practically unfixable.
The solution to all of this is to have a custom query processor that
replaces Xapian's, and write it from the ground up to deal with the
special characters etc. I wrote one, as part of my "future, post-1.0
mu" reseach project, and I have now backported it to the mu 0.9.19.
From a technical perspective, this is a major cleanup, and allows us
to get rid of much of the fragile preprocessing both for indexing and
querying. From and end-user perspective this (hopefully) means that
many of the little parsing issues are gone, and it opens the way for
some new features.
From an end-user perspective:
- better support for special characters.
- regexp search! yes, you can now search for regular expressions, e.g.
subject:/h.ll?o/
will find subjects with hallo, hello, halo, philosophy, ...
As you can imagine, this can be a _heavy_ operation on the database,
and might take quite a bit longer than a normal query; but it can be
quite useful.
This commit is contained in:
87
lib/parser/Makefile.am
Normal file
87
lib/parser/Makefile.am
Normal file
@ -0,0 +1,87 @@
|
||||
## Copyright (C) 2017 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation; either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software Foundation,
|
||||
## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
include $(top_srcdir)/gtest.mk
|
||||
|
||||
@VALGRIND_CHECK_RULES@
|
||||
|
||||
noinst_PROGRAMS= \
|
||||
tokenize \
|
||||
parse
|
||||
|
||||
tokenize_SOURCES= \
|
||||
tokenize.cc
|
||||
|
||||
tokenize_LDADD= \
|
||||
$(GCOV_LDADD) \
|
||||
libmuxparser.la
|
||||
|
||||
parse_SOURCES= \
|
||||
parse.cc
|
||||
|
||||
parse_LDADD= \
|
||||
$(GCOV_LDADD) \
|
||||
libmuxparser.la
|
||||
|
||||
AM_CXXFLAGS= \
|
||||
-I$(srcdir)/.. \
|
||||
-I$(top_srcdir)/lib \
|
||||
$(GLIB_CFLAGS) \
|
||||
$(XAPIAN_CXXFLAGS) \
|
||||
$(WARN_CXXFLAGS) \
|
||||
$(GCOV_CFLAGS) \
|
||||
-Wno-inline \
|
||||
-Wno-switch-enum
|
||||
|
||||
libmuxparser_la_LIBADD= \
|
||||
$(WARN_LDFLAGS) \
|
||||
$(GLIB_LIBS) \
|
||||
$(XAPIAN_LIBS) \
|
||||
$(GCOV_LDADD)
|
||||
|
||||
noinst_LTLIBRARIES= \
|
||||
libmuxparser.la
|
||||
|
||||
libmuxparser_la_SOURCES= \
|
||||
data.hh \
|
||||
parser.cc \
|
||||
parser.hh \
|
||||
proc-iface.hh \
|
||||
tokenizer.cc \
|
||||
tokenizer.hh \
|
||||
tree.hh \
|
||||
utils.cc \
|
||||
utils.hh \
|
||||
xapian.cc \
|
||||
xapian.hh
|
||||
|
||||
VALGRIND_SUPPRESSIONS_FILES= ${top_srcdir}/mux.supp
|
||||
|
||||
noinst_PROGRAMS+=$(TEST_PROGS)
|
||||
|
||||
TEST_PROGS += test-tokenizer
|
||||
test_tokenizer_SOURCES=test-tokenizer.cc
|
||||
test_tokenizer_LDADD=libmuxparser.la
|
||||
|
||||
TEST_PROGS += test-parser
|
||||
test_parser_SOURCES=test-parser.cc
|
||||
test_parser_LDADD=libmuxparser.la
|
||||
|
||||
TEST_PROGS += test-utils
|
||||
test_utils_SOURCES=test-utils.cc
|
||||
test_utils_LDADD=libmuxparser.la
|
||||
|
||||
TESTS=$(TEST_PROGS)
|
||||
Reference in New Issue
Block a user