From: Adam Dickmeiss Date: Mon, 1 Sep 2014 09:48:08 +0000 (+0200) Subject: Fix regression X-Git-Tag: v1.7.4~8 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=4cb8095aecdf00660275a005235ec45b613c7bb6;p=pazpar2-moved-to-github.git Fix regression Func insert_settings_values only called for initial non-cached xdoc. --- diff --git a/src/client.c b/src/client.c index 772da62..6585f65 100644 --- a/src/client.c +++ b/src/client.c @@ -627,7 +627,7 @@ static void client_record_ingest(struct client *cl) if (cl->session) { NMEM nmem = nmem_create(); - int rc = ingest_xml_record(cl, xdoc, offset, nmem); + int rc = ingest_xml_record(cl, xdoc, offset, nmem, 1); if (rc == -1) session_log(se, YLOG_WARN, "Failed to ingest xdoc from %s #%d", diff --git a/src/session.c b/src/session.c index 52fea13..b132824 100644 --- a/src/session.c +++ b/src/session.c @@ -1687,9 +1687,6 @@ static int ingest_sub_record(struct client *cl, xmlDoc *xdoc, xmlNode *root, { int ret = 0; struct session *se = client_get_session(cl); - struct conf_service *service = se->service; - - insert_settings_values(sdb, xdoc, root, service); if (!check_record_filter(root, sdb)) { @@ -1706,9 +1703,6 @@ static int ingest_sub_record(struct client *cl, xmlDoc *xdoc, xmlNode *root, return ret; } -int ingest_xml_record(struct client *cl, xmlDoc *xdoc, - int record_no, NMEM nmem); - /** \brief ingest XML record \param cl client holds the result set for record \param rec record buffer (0 terminated) @@ -1725,13 +1719,13 @@ int ingest_record(struct client *cl, const char *rec, struct session_database *sdb = client_get_database(cl); struct conf_service *service = se->service; xmlDoc *xdoc = normalize_record(se, sdb, service, rec, nmem); - int r = ingest_xml_record(cl, xdoc, record_no, nmem); + int r = ingest_xml_record(cl, xdoc, record_no, nmem, 0); client_store_xdoc(cl, record_no, xdoc); return r; } int ingest_xml_record(struct client *cl, xmlDoc *xdoc, - int record_no, NMEM nmem) + int record_no, NMEM nmem, int cached_copy) { struct session *se = client_get_session(cl); struct session_database *sdb = client_get_database(cl); @@ -1794,6 +1788,8 @@ int ingest_xml_record(struct client *cl, xmlDoc *xdoc, if (sroot->type == XML_ELEMENT_NODE && !strcmp((const char *) sroot->name, "record")) { + if (!cached_copy) + insert_settings_values(sdb, xdoc, root, service); r = ingest_sub_record(cl, xdoc, sroot, record_no, nmem, sdb, mk); } @@ -1811,6 +1807,8 @@ int ingest_xml_record(struct client *cl, xmlDoc *xdoc, mk->value = nmem_strdup(nmem, mergekey_norm); mk->next = 0; + if (!cached_copy) + insert_settings_values(sdb, xdoc, root, service); r = ingest_sub_record(cl, xdoc, root, record_no, nmem, sdb, mk); } } diff --git a/src/session.h b/src/session.h index dcdce0c..32243de 100644 --- a/src/session.h +++ b/src/session.h @@ -187,7 +187,7 @@ const char *session_setting_oneval(struct session_database *db, int offset); int ingest_record(struct client *cl, const char *rec, int record_no, NMEM nmem); int ingest_xml_record(struct client *cl, xmlDoc *xdoc, - int record_no, NMEM nmem); + int record_no, NMEM nmem, int cached_copy); void session_alert_watch(struct session *s, int what); void add_facet(struct session *s, const char *type, const char *value, int count);