Incorporate category limit into searches.
authorMike Taylor <mike@indexdata.com>
Thu, 24 Apr 2014 11:41:48 +0000 (12:41 +0100)
committerMike Taylor <mike@indexdata.com>
Thu, 24 Apr 2014 11:41:48 +0000 (12:41 +0100)
Instead of making a new filterSet on a new search, delete all
non-category filters from the old one.

src/mkws-team.js

index 5a2563b..8d33d9e 100644 (file)
@@ -249,7 +249,7 @@ function team($, teamName) {
            return;
        }
 
-       m_filterSet = filterSet(that);
+       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
        m_submitted = true;
@@ -269,9 +269,11 @@ function team($, teamName) {
 
        var pp2filter = m_filterSet.pp2filter();
        var pp2limit = m_filterSet.pp2limit(limit);
+        var pp2catLimit = m_filterSet.pp2catLimit();
 
        var params = {};
        if (pp2limit) params.limit = pp2limit;
+       if (pp2catLimit) params.categoryfilter = pp2catLimit;
        if (maxrecs) params.maxrecs = maxrecs;
        if (torusquery) {
            if (!mkws.config.use_service_proxy)