From 4e0593960d3017457ab8f69b174cc48874dc8eee Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 12 Mar 2008 15:40:11 +0000 Subject: [PATCH] updated low-hit spellcheck and authority check to honor multi-class search calls 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 | 3 ++- .../web/opac/skin/default/js/result_common.js | 17 ++++++++++------- Open-ILS/web/opac/skin/default/js/rresult.js | 3 ++- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Open-ILS/web/opac/skin/default/js/mresult.js b/Open-ILS/web/opac/skin/default/js/mresult.js index aaad90d93d..51850529fc 100644 --- a/Open-ILS/web/opac/skin/default/js/mresult.js +++ b/Open-ILS/web/opac/skin/default/js/mresult.js @@ -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); } diff --git a/Open-ILS/web/opac/skin/default/js/result_common.js b/Open-ILS/web/opac/skin/default/js/result_common.js index 3df7c48bf4..318cba5aa1 100644 --- a/Open-ILS/web/opac/skin/default/js/result_common.js +++ b/Open-ILS/web/opac/skin/default/js/result_common.js @@ -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(); } diff --git a/Open-ILS/web/opac/skin/default/js/rresult.js b/Open-ILS/web/opac/skin/default/js/rresult.js index 0b11da9de5..39b7301e23 100644 --- a/Open-ILS/web/opac/skin/default/js/rresult.js +++ b/Open-ILS/web/opac/skin/default/js/rresult.js @@ -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 ); } -- 2.43.2