5 var idsCookie = new cookieObject("ids", 1, "/", COOKIE_IDS);
7 function mresultUnload() { removeChildren(table); table = null;}
10 function mresultDoSearch() {
12 table = G.ui.result.main_table;
14 hideMe(G.ui.result.row_template);
15 while( table.parentNode.rows.length <= getDisplayCount() ) /* add an extra so IE and safari won't complain */
16 hideMe(table.appendChild(G.ui.result.row_template.cloneNode(true)));
18 if(getOffset() == 0 || getHitCount() == null ) {
19 mresultGetCount(); /* get the hit count */
20 mresultCollectIds(); /* do the actual search */
23 //mresultCollectRecords(); /* grab the records if we have the id's cached */
28 function mresultGetCount() {
29 var req = new Request(FETCH_MRCOUNT,
30 getStype(), getTerm(), getLocation(), getDepth(), getForm() );
31 req.callback(mresultHandleCount);
35 function mresultHandleCount(r) {
36 HITCOUNT = parseInt(r.getResultObject());
41 /* performs the actual search */
42 function mresultCollectIds() {
44 var c = JSON2js(idsCookie.get(COOKIE_IDS));
45 if(c && c.recs) { records = c.recs; ranks = c.ranks; }
47 if( records[getOffset()] != null &&
48 records[getOffset() + getDisplayCount() - 1] != null) {
50 mresultCollectRecords();
54 var req = new Request(FETCH_MRIDS, getStype(), getTerm(),
55 getLocation(), getDepth(), getDisplayCount() * 5, getOffset(), getForm() );
56 req.callback(mresultHandleMRIds);
61 function mresultHandleMRIds(r) {
62 mresultSetRecords(r.getResultObject().ids);
63 mresultCollectRecords();
66 function mresultSetRecords(idstruct) {
68 for( var x = o; x!= idstruct.length + o; x++ ) {
69 records[x] = idstruct[x - o][0];
70 ranks[x] = idstruct[x - o][1];
72 idsCookie.put(COOKIE_IDS, js2JSON({ recs: records, ranks : ranks }) );
76 function mresultHandleMods(r) {
77 var rec = r.getResultObject();
78 resultDisplayRecord(rec, rowtemplate, r.userdata, true);
79 resultCollectCopyCounts(rec, FETCH_MR_COPY_COUNTS);
83 function mresultCollectRecords() {
85 for( var x = getOffset(); x!= getDisplayCount() + getOffset(); x++ ) {
86 if(isNull(records[x])) break;
87 var req = new Request(FETCH_MRMODS, records[x]);
88 req.request.userdata = i++;
89 req.callback(mresultHandleMods);