var m_template = {}; // compiled templates, from any source
var m_widgets = {}; // Maps widget-type to array of widget objects
var m_gotRecords = false;
- var m_targetMap = {}; // Maps target ID to human-readable name
var config = mkws.objectInheritingFrom(mkws.config);
that.config = config;
that.resetPage = resetPage;
- function newSearch(query, sortOrder, maxrecs, perpage, limit, targets, torusquery) {
+ function newSearch(widget, query, sortOrder, maxrecs, perpage, limit, targets, torusquery) {
that.info("newSearch: " + query);
if (config.use_service_proxy && !mkws.authenticated) {
return;
}
+ {
+ if (!sortOrder) sortOrder = widget.config.sort;
+ if (!maxrecs) maxrecs = widget.config.maxrecs;
+ if (!perpage) perpage = widget.config.perpage;
+ if (!limit) limit = widget.config.limit;
+ if (!targets) targets = widget.config.targets;
+ if (!torusquery) torusquery = widget.config.targetfilter;
+ var target = widget.config.target;
+ if (target) torusquery = 'udb=="' + target + '"';
+
+ var s = "running search: '" + query + "'";
+ if (sortOrder) s += " sorted by '" + sortOrder + "'";
+ if (maxrecs) s += " restricted to " + maxrecs + " records";
+ if (perpage) s += " with " + perpage + " per page";
+ if (limit) s += " limited by '" + limit + "'";
+ if (targets) s += " in targets '" + targets + "'";
+ if (torusquery) s += " constrained by torusquery '" + torusquery + "'";
+ that.info(s);
+ }
+
m_filterSet.removeMatching(function(f) { return f.type !== 'category' });
triggerSearch(query, sortOrder, maxrecs, perpage, limit, targets, torusquery);
switchView('records'); // In case it's configured to start off as hidden
return undefined;
};
- that.mapTarget = function(id, name) {
- var old = m_targetMap[id];
- m_targetMap[id] = name;
- if (old && name !== old) {
- that.warn("targetMap for id '" + id + "' changed from '" + old + "' to '" + name + "'");
- }
- };
-
- that.targetName = function(id) {
- return m_targetMap[id] || id;
- }
-
return that;
};