updated low-hit spellcheck and authority check to honor multi-class search calls
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 12 Mar 2008 15:40:11 +0000 (15:40 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 12 Mar 2008 15:40:11 +0000 (15:40 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@8991 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/skin/default/js/mresult.js
Open-ILS/web/opac/skin/default/js/result_common.js
Open-ILS/web/opac/skin/default/js/rresult.js

index aaad90d..5185052 100644 (file)
@@ -47,11 +47,12 @@ function mresultCollectAdvIds() {
 
 function mresultHandleMRIds(r) {
        var res = r.getResultObject();
+    resultCompiledSearch = res.compiled_search;
+    cookieManager.write(COOKIE_SEARCH, js2JSON(res.compiled_search), -1);
        if(res.count != null) {
                if( getOffset() == 0 ) HITCOUNT = res.count;
                runEvt('result', 'hitCountReceived');
        } 
-    cookieManager.write(COOKIE_SEARCH, js2JSON(res.compiled_search), -1);
        runEvt('result', 'idsReceived', res.ids);
 }
 
index 3df7c48..318cba5 100644 (file)
@@ -4,6 +4,7 @@ var recordsCache = [];
 var lowHitCount = 4;
 
 var resultFetchAllRecords = false;
+var resultCompiledSearch = null;
 
 /* set up the event handlers */
 if( findCurrentPage() == MRESULT || findCurrentPage() == RRESULT ) {
@@ -171,16 +172,18 @@ function resultLowHits() {
        if(getHitCount() > 0)
                unHideMe($('result_low_hits_msg'));
 
-       var sreq = new Request(CHECK_SPELL, getTerm());
+    alert(js2JSON(resultCompiledSearch));
+
+    var words = [];
+    for(var key in resultCompiledSearch.searches) 
+        words.push(resultCompiledSearch.searches[key].term);
+
+       var sreq = new Request(CHECK_SPELL, words.join(' '));
        sreq.callback(resultSuggestSpelling);
        sreq.send();
 
-    /* XXX patch to use the search results */
-
-       var words = getTerm().split(' ');
-       var word;
-       while( word = words.shift() ) {
-               var areq = new Request(FETCH_CROSSREF, getStype(), getTerm() );
+    for(var key in resultCompiledSearch.searches) {
+               var areq = new Request(FETCH_CROSSREF, key, resultCompiledSearch.searches[key].term);
                areq.callback(resultLowHitXRef);
                areq.send();
        }
index 0b11da9..39b7301 100644 (file)
@@ -223,7 +223,7 @@ function rresultHandleRIds(r) {
 }
 
 function _rresultHandleIds(ids, count) {
-       var json = js2JSON({ids:ids,count:count});
+       //var json = js2JSON({ids:ids,count:count});
        /*
        cookieManager.write(COOKIE_SRIDS, json, '+1d');
        */
@@ -300,6 +300,7 @@ function rresultFilterSearchResults(r) {
                        ids.push(result.ids[i][0]);
        }
 
+    resultCompiledSearch = result.compiled_search;
     cookieManager.write(COOKIE_SEARCH, js2JSON(result.compiled_search), -1);
        _rresultHandleIds( ids, result.count );
 }