401691176ea0ade97d1c643bc2ed4c382fee1ef2
chmalee
  Fri Nov 3 16:59:50 2023 -0700
Fix multi-term searches when using genomePosCJ: 1. make sure to collapse hgps together and combine highlight strings and item highlight names, 2. make sure hgSearch checks the json data returned during its init function if there was an error from the search term, such as different chromosomes for a multi-term search, refs #22978

diff --git src/hg/js/hgSearch.js src/hg/js/hgSearch.js
index e6afb2b..d5b6680 100644
--- src/hg/js/hgSearch.js
+++ src/hg/js/hgSearch.js
@@ -795,30 +795,31 @@
     function init() {
         cart.setCgi('hgSearch');
         cart.debug(debugCartJson);
         // If a user clicks search before the page has finished loading
         // start processing it now:
         $("#searchBarSearchButton").click(sendUserSearch);
         if (typeof cartJson !== "undefined") {
             if (typeof cartJson.db !== "undefined") {
                 db = cartJson.db;
             } else {
                 alert("Error no database from request");
             }
             if (typeof cartJson.warning !== "undefined") {
                 alert("Warning: " + cartJson.warning);
             }
+            checkJsonData(cartJson, "init");
             // check right away for a special redirect to hgTracks:
             if (typeof cartJson.warning === "undefined" &&
                     typeof cartJson.positionMatches !== "undefined" &&
                     cartJson.positionMatches.length == 1 &&
                     cartJson.positionMatches[0].matches[0].doRedirect === true) {
                 positionMatch = cartJson.positionMatches[0];
                 match = positionMatch.matches[0];
                 position = match.position;
                 newUrl = "../cgi-bin/hgTracks" + "?db=" + db + "&position=" + position;
                 if (match.highlight) {
                     newUrl += "&addHighlight=" + match.highlight;
                 }
                 if (positionMatch.name !== "chromInfo") {
                     newUrl += "&" + positionMatch.name + "=pack";
                 }