5 var idsCookie = new cookieObject("ids", 1, "/", COOKIE_IDS);
7 function mresultUnload() { removeChildren(table); table = null;}
9 function mresultDoSearch() {
11 table = G.ui.result.main_table;
13 hideMe(G.ui.result.row_template);
14 while( table.parentNode.rows.length <= getDisplayCount() ) /* add an extra so IE and safari won't complain */
15 hideMe(table.appendChild(G.ui.result.row_template.cloneNode(true)));
17 if(getOffset() == 0 || getHitCount() == null ) {
19 mresultCollectIds(FETCH_MRIDS_FULL);
22 mresultCollectIds(FETCH_MRIDS);
26 function mresultGetCount() {
27 var form = (getForm() == "all") ? null : getForm();
28 var req = new Request(FETCH_MRCOUNT,
29 getStype(), getTerm(), getLocation(), getDepth(), form );
30 req.callback(mresultHandleCount);
34 function mresultHandleCount(r) {
35 HITCOUNT = parseInt(r.getResultObject());
40 /* performs the actual search */
41 function mresultCollectIds(method) {
44 if(getOffset() == 0) {
45 idsCookie.put(COOKIE_IDS,"");
48 var c = JSON2js(idsCookie.get(COOKIE_IDS));
49 if(c && c.recs) { records = c.recs; ranks = c.ranks; }
52 if( getOffset() != 0 &&
53 records[getOffset()] != null &&
54 records[resultFinalPageIndex()] != null) {
55 mresultCollectRecords();
59 var req = new Request(method, getStype(), getTerm(),
60 getLocation(), getDepth(), getDisplayCount() * 20, getOffset(), getForm() );
61 req.callback(mresultHandleMRIds);
66 function mresultHandleMRIds(r) {
67 var res = r.getResultObject();
69 if(res.count != null) {
74 mresultSetRecords(res.ids);
75 mresultCollectRecords();
78 function mresultSetRecords(idstruct) {
80 for( var x = o; x < idstruct.length + o; x++ ) {
81 if(idstruct[x-o] == null) break;
82 records[x] = parseInt(idstruct[x - o][0]);
83 ranks[x] = parseFloat(idstruct[x - o][1]);
85 idsCookie.put(COOKIE_IDS, js2JSON({ recs: records, ranks : ranks }) );
89 function mresultHandleMods(r) {
90 var rec = r.getResultObject();
91 resultDisplayRecord(rec, rowtemplate, r.userdata, true);
92 resultCollectCopyCounts(rec, FETCH_MR_COPY_COUNTS);
96 function mresultCollectRecords() {
98 for( var x = getOffset(); x!= getDisplayCount() + getOffset(); x++ ) {
99 if(isNull(records[x])) break;
100 var req = new Request(FETCH_MRMODS, records[x]);
101 req.request.userdata = i++;
102 req.callback(mresultHandleMods);