From: miker Date: Fri, 12 Nov 2010 20:37:37 +0000 (+0000) Subject: Trim the set of classes and fields pulled in by Searcher; Cache the cmc data (cmf... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=e4e74cf3e6561a5b7c3c624e91c7d43a87c143cf;p=evergreen%2Fmasslnc.git Trim the set of classes and fields pulled in by Searcher; Cache the cmc data (cmf is too big) git-svn-id: svn://svn.open-ils.org/ILS/trunk@18718 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/js/dojo/openils/widget/Searcher.js b/Open-ILS/web/js/dojo/openils/widget/Searcher.js index 130b7dcdfe..e66e2ec3d5 100644 --- a/Open-ILS/web/js/dojo/openils/widget/Searcher.js +++ b/Open-ILS/web/js/dojo/openils/widget/Searcher.js @@ -266,16 +266,27 @@ if(!dojo._hasResource["openils.widget.Searcher"]) { 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;