-// If we ever decide we need to be able to specify multiple settings directories,
-// the two calls to read_settings must be split -- so the dictionary is prepared
-// for the contents of every directory before the databases are updated.
-void settings_read(const char *path)
+// Read any settings names introduced in service definition (config) and add to dictionary
+// This is done now to avoid errors if user settings are declared in session overrides
+void initialize_soft_settings(struct conf_service *service)
+{
+ int i;
+ for (i = 0; i < service->num_metadata; i++)
+ {
+ struct conf_metadata *md = &service->metadata[i];
+
+ if (md->setting != Metadata_setting_no)
+ settings_create_offset(service, md->name);
+
+ // Also create setting for some metadata attributes.
+ if (md->limitmap) {
+ int index;
+ WRBUF wrbuf = wrbuf_alloc();
+ yaz_log(YLOG_DEBUG, "Metadata %s has limitmap: %s ",md->name, md->limitmap);
+ wrbuf_printf(wrbuf, "pz:limitmap:%s", md->name);
+ index = settings_create_offset(service, wrbuf_cstr(wrbuf));
+ if (index >= 0) {
+ struct setting new;
+ int offset;
+ yaz_log(YLOG_DEBUG, "Service %s default %s=%s",
+ (service->id ? service->id: "unknown"), wrbuf_cstr(wrbuf), md->limitmap);
+ new.name = (char *) wrbuf_cstr(wrbuf);
+ new.value = md->limitmap;
+ new.next = 0;
+ new.target = 0;
+ new.precedence = 0;
+ offset = settings_create_offset(service, new.name);
+ update_settings(&new, service->settings, offset, service->nmem);
+ }
+ wrbuf_destroy(wrbuf);
+ // TODO same for facetmap
+ }
+ }
+}
+
+static void prepare_target_dictionary(void *client_data, struct setting *set)