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";
#searchbar_table { border-collapse: collapse; }
.search_box_container { width: 240px; padding: 3px; }/* border: 1px solid #A0A0A0;' class='color_2'>*/
+#search_box { width: 260px; }
/* ---------------------------------------------------------------------- */
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 */
function advBuildSearchBlob() {
- var searches;
+ var searches = '';
var tbody = $('adv_global_tbody');
var rows = tbody.getElementsByTagName('tr');
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;
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;
}
}
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 );
}
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;
}
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;
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();
}
sreq.callback(resultSuggestSpelling);
sreq.send();
+ /* XXX patch to use the search results */
+
var words = getTerm().split(' ');
var word;
while( word = words.shift() ) {
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 );
}
<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>