* mu-query: don't try to print fields which are not in xapian

This commit is contained in:
Dirk-Jan C. Binnema 2009-12-09 00:05:23 +02:00
parent 0dc999ffb2
commit 42a9414242
1 changed files with 8 additions and 7 deletions

View File

@ -136,12 +136,12 @@ print_rows (MuQueryXapian *xapian, const gchar *query, MuConfigOptions *opts)
while (*fields) { while (*fields) {
const MuMsgField* field = const MuMsgField* field =
mu_msg_field_from_shortcut (*fields); mu_msg_field_from_shortcut (*fields);
if (!field) if (!field ||
!mu_msg_field_is_xapian_enabled (field))
printlen += printf ("%c", *fields); printlen += printf ("%c", *fields);
else else
printlen += printf ("%s", printlen += printf ("%s",
display_field(row, field)); display_field(row, field));
++fields; ++fields;
} }
if (printlen >0) if (printlen >0)
@ -161,8 +161,8 @@ do_output (MuQueryXapian *xapian, GSList *args, MuConfigOptions* opts)
gchar *query; gchar *query;
gboolean retval = TRUE; gboolean retval = TRUE;
query = mu_query_xapian_combine (args, FALSE); query = mu_query_xapian_combine (args, FALSE);
/* if xquery is set, we print the xapian query instead of the /* if xquery is set, we print the xapian query instead of the
* output; this is for debugging purposes */ * output; this is for debugging purposes */
if (opts->xquery) if (opts->xquery)
@ -186,12 +186,13 @@ mu_query_run (MuConfigOptions *opts, GSList *args)
rv = MU_OK; rv = MU_OK;
handle_options (opts); handle_options (opts);
xapian = mu_query_xapian_new (opts->muhome); xapian = mu_query_xapian_new (opts->muhome);
if (!xapian) if (!xapian)
return MU_ERROR; return MU_ERROR;
rv = do_output (xapian, args, opts) ? 0 : 1; rv = do_output (xapian, args, opts) ? 0 : 1;
mu_query_xapian_destroy (xapian); mu_query_xapian_destroy (xapian);
return rv; return rv;