[open-ils-commits] r18718 - trunk/Open-ILS/web/js/dojo/openils/widget (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Nov 12 15:37:42 EST 2010


Author: miker
Date: 2010-11-12 15:37:37 -0500 (Fri, 12 Nov 2010)
New Revision: 18718

Modified:
   trunk/Open-ILS/web/js/dojo/openils/widget/Searcher.js
Log:
Trim the set of classes and fields pulled in by Searcher; Cache the cmc data (cmf is too big)

Modified: trunk/Open-ILS/web/js/dojo/openils/widget/Searcher.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/Searcher.js	2010-11-12 19:51:26 UTC (rev 18717)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/Searcher.js	2010-11-12 20:37:37 UTC (rev 18718)
@@ -266,16 +266,27 @@
     openils.widget.Searcher._cache = {arr : {}, obj : {}, store : {}};
 
     dojo.forEach(
-        [ {ident:'name',classname:'cmc',label:'label'}, {ident:'id',classname:'cmf',label:'label'}, {ident:'alias',classname:'cmsa',label:'alias'} ],
+        [ {ident:'name',classname:'cmc',label:'label',fields:null,cookie:true}, {ident:'id',classname:'cmf',label:'label',fields:['id','field_class','name','search_field','facet_field','label']} ],
+        // [ {ident:'name',classname:'cmc',label:'label',fields:null}, {ident:'id',classname:'cmf',label:'label',fields:null}, {ident:'alias',classname:'cmsa',label:'alias',fields:null} ],
         function (c) {
 
-            var q = {};
-            q[c.ident] = { '!=' :  null };
+            var fielder_result = c.cookie ? dojo.cookie('SRCHR' + c.classname) : null;
+            if (fielder_result) {
+                fielder_result = dojo.fromJson(fielder_result);
+            } else {
+                var q = {};
+                q[c.ident] = { '!=' :  null };
 
-            var fielder_result = fieldmapper.standardRequest(
-                [ 'open-ils.fielder', 'open-ils.fielder.'+c.classname+'.atomic'],
-                [ { cache : 1, query : q } ]
-            );
+                fielder_result = fieldmapper.standardRequest(
+                    [ 'open-ils.fielder', 'open-ils.fielder.'+c.classname+'.atomic'],
+                    [ { cache : 1, query : q, fields: c.fields } ]
+                );
+                if (c.cookie) dojo.cookie(
+                    'SRCHR' + c.classname,
+                    dojo.toJson(fielder_result),
+                    { path : location.href.replace(/^https?:\/\/[^\/]+(\/.*\w{2}-\w{2}\/).*/, "$1") }
+                );
+            }
 
             var sorted_fielder_result = fielder_result.sort( function(a,b) {
                 if(a[c.label] > b[c.label]) return 1;



More information about the open-ils-commits mailing list