X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Flogic.c;h=e7f2941deaf461d058ba111665816ba259c7750e;hb=c7e28063b2365987df7adc35db6786732b8e233f;hp=e131fb37d17592c0f05720395011b601726b0fce;hpb=5bc1e4ca9d3e25d15cc0434fa6ab6d6083593ed8;p=pazpar2-moved-to-github.git diff --git a/src/logic.c b/src/logic.c index e131fb3..e7f2941 100644 --- a/src/logic.c +++ b/src/logic.c @@ -1,4 +1,4 @@ -/* $Id: logic.c,v 1.47 2007-06-28 09:36:10 adam Exp $ +/* $Id: logic.c,v 1.48 2007-07-04 12:07:49 adam Exp $ Copyright (c) 2006-2007, Index Data. This file is part of Pazpar2. @@ -497,6 +497,8 @@ enum pazpar2_error_code search(struct session *se, const char **addinfo) { int live_channels = 0; + int no_working = 0; + int no_failed = 0; struct client *cl; struct database_criterion *criteria; @@ -528,17 +530,22 @@ enum pazpar2_error_code search(struct session *se, *addinfo = client_get_database(cl)->database->url; return PAZPAR2_CONFIG_TARGET; } - // Query must parse for all targets + // Parse query for target if (client_parse_query(cl, query) < 0) + no_failed++; + else { - *addinfo = "query"; - return PAZPAR2_MALFORMED_PARAMETER_VALUE; + no_working++; + client_prep_connection(cl); } } - for (cl = se->clients; cl; cl = client_next_in_session(cl)) - client_prep_connection(cl); - + // If no queries could be mapped, we signal an error + if (no_working == 0) + { + *addinfo = "query"; + return PAZPAR2_MALFORMED_PARAMETER_VALUE; + } return PAZPAR2_NO_ERROR; }