now calling the new search query parsing method for regular bib and metabib searches...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 15 Nov 2007 22:54:33 +0000 (22:54 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 15 Nov 2007 22:54:33 +0000 (22:54 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@8070 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/common/js/config.js
Open-ILS/web/opac/skin/default/css/layout.css
Open-ILS/web/opac/skin/default/js/adv_global.js
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
Open-ILS/web/opac/skin/default/xml/common/searchbar.xml

index 58a63a6..aca1d7d 100644 (file)
@@ -272,6 +272,8 @@ config.ids.altcanvas = {};
 
 var SEARCH_MRS                                         = 'open-ils.search:open-ils.search.metabib.multiclass:1';
 var SEARCH_RS                                          = 'open-ils.search:open-ils.search.biblio.multiclass:1';
+var SEARCH_MRS_QUERY                   = 'open-ils.search:open-ils.search.metabib.multiclass.query:1';
+var SEARCH_RS_QUERY             = 'open-ils.search:open-ils.search.biblio.multiclass.query:1';
 var FETCH_SEARCH_RIDS                  = "open-ils.search:open-ils.search.biblio.record.class.search:1";
 var FETCH_MRMODS                                       = "open-ils.search:open-ils.search.biblio.metarecord.mods_slim.retrieve";
 var FETCH_MODS_FROM_COPY               = "open-ils.search:open-ils.search.biblio.mods_from_copy";
index 9f5704b..2f170e5 100644 (file)
@@ -82,6 +82,7 @@ table { border-collapse: collapse; }
 #searchbar_table { border-collapse: collapse; }
 
 .search_box_container { width: 240px; padding: 3px; }/* border: 1px solid #A0A0A0;' class='color_2'>*/
+#search_box { width: 260px; }
 
 
 /* ---------------------------------------------------------------------- */
index 1aac9ac..c5da253 100644 (file)
@@ -118,14 +118,14 @@ function advSubmitGlobal() {
        args[PARAM_LITFORM]     = litforms;
        args[PARAM_AUDIENCE]    = audiences;
        args[PARAM_LANGUAGE] = languages;
-       args[PARAM_SEARCHES]    = js2JSON(searches); /* break these out */
+       //args[PARAM_SEARCHES]  = js2JSON(searches); /* break these out */
        args[PARAM_DEPTH]               = depthSelGetDepth();
        args[PARAM_LOCATION]    = depthSelGetNewLoc();
        args[PARAM_SORT]                = sortby;
        args[PARAM_SORT_DIR]    = sortdir;
        args[PARAM_ADVTYPE]     = ADVTYPE_MULTI;
        args[PARAM_STYPE]               = "";
-       args[PARAM_TERM]                = "";
+       args[PARAM_TERM]                = searches;
        args[PARAM_AVAIL]               = limit2avail;
 
        /* pubdate sorting causes a record (not metarecord) search */
@@ -146,7 +146,7 @@ function advSubmitGlobal() {
 
 function advBuildSearchBlob() {
 
-       var searches;
+       var searches = '';
        var tbody    = $('adv_global_tbody');
        var rows     = tbody.getElementsByTagName('tr');
 
@@ -162,14 +162,6 @@ function advBuildSearchBlob() {
                if(!term) continue;
 
                var string = "";
-
-               if(!searches) searches = {};
-
-               if(searches[stype]) 
-                       string = searches[stype].term;
-               else 
-                       searches[stype] = { term : "" };
-
                switch(contains) {
                        case 'contains' : 
                                string += " " + term; 
@@ -190,10 +182,15 @@ function advBuildSearchBlob() {
                if(string) {
                        string = string.replace(/'/g,' ');
                        string = string.replace(/\\/g,' ');
-                       searches[stype].term = string;
+            string = string.replace(/^\s*/,'');
+            string = string.replace(/\s*$/,'');
+                       //searches[stype].term = string;
+            if(searches) searches += ' ';
+            searches += stype + ':'+ string;
                }
        }
 
+    _debug("created search query " + searches);
        return searches;
 }
 
index ca15d60..97fcd6b 100644 (file)
@@ -37,11 +37,11 @@ function mresultDoSearch() {
 }
 
 function _mresultCollectIds() { 
-       resultCollectSearchIds(true, SEARCH_MRS, mresultHandleMRIds ); 
+       resultCollectSearchIds(true, SEARCH_MRS_QUERY, mresultHandleMRIds ); 
 }
 
 function mresultCollectAdvIds() { 
-       resultCollectSearchIds(false, SEARCH_MRS, mresultHandleMRIds ); 
+       resultCollectSearchIds(false, SEARCH_MRS_QUERY, mresultHandleMRIds ); 
 }
 
 
index 6602165..3df7c48 100644 (file)
@@ -42,21 +42,11 @@ function resultCollectSearchIds( type, method, handler ) {
        var args = {};
 
        if( type ) {
-               args.searches = {};
-               args.searches[getStype()] = {};
-               var term = getTerm();
-               if( term ) {
-                       term = term.replace(/'/g,' ');
-                       term = term.replace(/\\/g,' ');
-                       args.searches[getStype()].term = term;
-               }
-
                var form = parseForm(getForm());
                item_type = form.item_type;
                item_form = form.item_form;
 
        } else {
-               args.searches = JSON2js(getSearches());
                item_type = (getItemType()) ? getItemType().split(/,/) : null;
                item_form = (getItemForm()) ? getItemForm().split(/,/) : null;
        }
@@ -73,6 +63,7 @@ function resultCollectSearchIds( type, method, handler ) {
        args.limit    = limit;
        args.offset   = getOffset();
        args.visibility_limit = 3000;
+    args.default_class = getStype();
 
        if(sort) args.sort = sort;
        if(sortdir) args.sort_dir = sortdir;
@@ -85,10 +76,10 @@ function resultCollectSearchIds( type, method, handler ) {
        if(getLitForm()) args.lit_form  = getLitForm().split(/,/);
        if(getLanguage()) args.language = getLanguage().split(/,/);
 
-       //alert(js2JSON(args));
+       _debug('Search args: ' + js2JSON(args));
+       _debug('Raw query: ' + getTerm());
 
-       _debug('SEARCH: \n' + js2JSON(args) + '\n\n');
-       var req = new Request(method, args, 1);
+       var req = new Request(method, args, getTerm(), 1);
        req.callback(handler);
        req.send();
 }
@@ -184,6 +175,8 @@ function resultLowHits() {
        sreq.callback(resultSuggestSpelling);
        sreq.send();
 
+    /* XXX patch to use the search results */
+
        var words = getTerm().split(' ');
        var word;
        while( word = words.shift() ) {
index e5620af..79ece56 100644 (file)
@@ -283,12 +283,12 @@ function rresultLaunchDrawn(id, node) {
 
 function rresultDoRecordSearch() { 
        rresultIsPaged = true;
-       resultCollectSearchIds(true, SEARCH_RS, rresultFilterSearchResults ); 
+       resultCollectSearchIds(true, SEARCH_RS_QUERY, rresultFilterSearchResults ); 
 }
 
 function rresultDoRecordMultiSearch() { 
        rresultIsPaged = true;
-       resultCollectSearchIds(false, SEARCH_RS, rresultFilterSearchResults ); 
+       resultCollectSearchIds(false, SEARCH_RS_QUERY, rresultFilterSearchResults ); 
 }
 
 
index 2b6393a..505f6ab 100644 (file)
@@ -28,7 +28,7 @@
 
                                <td nowrap='nowrap' align='center'  class='search_box_container color_2'>
 
-                                       <input id='search_box' style='width: 190px;' type='text' />
+                                       <input id='search_box' type='text' />
                                        <span style='padding-left: 6px;'>
                                                <input type='button' style='width: 40px;' id='search_submit' value='&button.go;' />
                                        </span>