From 8ed88b6cad3c62ba3f4549125c80c527aae82bbf Mon Sep 17 00:00:00 2001 From: berick Date: Fri, 1 Apr 2011 09:46:56 -0400 Subject: [PATCH] subject searching now includes the parent subject in the search terms --- Open-ILS/web/opac/skin/kcls/js/marc.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Open-ILS/web/opac/skin/kcls/js/marc.js b/Open-ILS/web/opac/skin/kcls/js/marc.js index 3c6ce531bd..cef0bca4bb 100644 --- a/Open-ILS/web/opac/skin/kcls/js/marc.js +++ b/Open-ILS/web/opac/skin/kcls/js/marc.js @@ -105,6 +105,7 @@ MarcRecord.prototype.render = function(fields, args) { // wrap each item in the array with an anchor tag for searching // excluding those subfields specified in 'codes' MarcRecord.prototype.buildSearchStr = function(arr, args, codes) { + var subjStrs = []; for(var i in arr) { var skip = false; for(var n in args.unlink) @@ -120,6 +121,14 @@ MarcRecord.prototype.buildSearchStr = function(arr, args, codes) { args2[PARAM_OFFSET] = 0; args2[PARAM_TERM] = arr[i]; args2[PARAM_STYPE] = args.searchType; + if(args.searchType == STYPE_SUBJECT) { + // subject searching is hierarchical, so we string them together + // into a long search string, which includes all parent subjects + subjStrs.push(arr[i]); + args2[PARAM_TERM] = subjStrs[0]; + for(var idx = 1; idx < subjStrs.length; idx++) + args2[PARAM_TERM] = args2[PARAM_TERM] + ' ' + subjStrs[idx]; + } arr[i] = ""+arr[i]+""; } }; -- 2.11.0