[PATCH v2 2/3] lib: Add support for automatically excluding tags from queries
Jameson Graef Rollins
jrollins at finestructure.net
Sat Jan 14 15:38:44 PST 2012
It looks like something in this patch is causing the following build
warning:
CXX -O2 lib/query.o
lib/query.cc:26:8: warning: ‘_notmuch_query’ declared with greater visibility than the type of its field
‘_notmuch_query::exclude_terms’ [-Wattributes]
However, I can't quite figure out what's causing it.
> +void
> +notmuch_query_add_tag_exclude (notmuch_query_t *query, const char *tag)
> +{
> + char *term = talloc_asprintf (query, "%s%s", _find_prefix ("tag"), tag);
> + _notmuch_string_list_append (query->exclude_terms, term);
> +}
This is really not an issue with this patch at all, and it should NOT
prevent it from being applied, but this came up briefly on IRC and I'm
curious, so I'll ask about it here.
Are terms ALWAYS lower cased? If not, it seems to me it's possible to
have an indexed term 'Kspam' that would get confused with the term
'spam' prefixed with the keyword prefix 'K' (which we use for tags).
Maybe this degeneracy is broken by the query parser somehow (or maybe by
the fact that tags are boolean terms?), but I wonder if it's not safer
to use the built-in xapian prefix separator ':', ie:
... talloc_asprintf (query, "%s:%s", _find_prefix ("tag"), tag);
I guess fixing that globally would require a database rebuild...
Ok, that's totally just an aside, and should not be a blocker for this
patch.
jamie.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20120114/acc758bf/attachment.pgp>
More information about the notmuch
mailing list