06600d01f3b25b00c9797d98c8a63a8bfafd4d07
chmalee
  Mon Oct 31 12:24:09 2022 -0700
When doing a multi position search that redirects right to hgTracks, like 'NM_012090.5;NM_012421.4', when doing the redirect, turn the track on, refs #29693

diff --git src/hg/js/hgSearch.js src/hg/js/hgSearch.js
index 6db98a4..1e96808 100644
--- src/hg/js/hgSearch.js
+++ src/hg/js/hgSearch.js
@@ -470,33 +470,37 @@
                 var shortLabel = position[1];
                 var longLabel = position[2];
                 url = "hgTrackUi?g=" + trackName;
                 matchTitle = "<b>" +  shortLabel + " - " + longLabel + "</b>";
             } else {
                 // unaligned mrnas and ests can still be searched but all you can get
                 // to is the hgc page, no hgTracks for them
                 goToHgTracks = true;
                 hgTracksTitle = hgcTitle = title;
                 if (["all_mrna", "all_est", "xenoMrna", "xenoEst", "intronEst"].includes(title)) {
                     hgTracksTitle = title.replace(/all_/, "");
                     if (searchDesc.includes("Unaligned"))
                         goToHgTracks = false;
                 }
                 if (goToHgTracks) {
-                    url = "hgTracks?db=" + db + "&" + hgTracksTitle + "=pack&position=" + match.position + "&hgFind.matches=" + match.hgFindMatches;
-                    if (match.extraSel)
+                    url = "hgTracks?db=" + db + "&" + hgTracksTitle + "=pack&position=" + match.position;
+                    if (match.hgFindMatches) {
+                        url += "&hgFind.matches=" + match.hgFindMatches;
+                    }
+                    if (match.extraSel) {
                         url += "&" + match.extraSel;
+                    }
                     if (match.highlight) {
                         url += url[url.length-1] !== '&' ? '&' : '';
                         url += "highlight=" + match.highlight;
                     }
                 } else {
                     url = "hgc?db=" + db + "&g=" + hgcTitle + "&i=" + match.position + "&c=0&o=0&l=0&r=0" ;
                 }
                 matchTitle = match.posName;
                 //if (match.canonical === true)
                 matchTitle = "<b>" + matchTitle + "</b>";
             }
             var newListObj;
             if (printCount < 500) {
                 if (printCount + 1 > 10) {
                     newListObj = "<li class='" + title + "_hidden' style='display: none'><a href=\"" + url + "\">" + matchTitle + "</a> - ";
@@ -779,36 +783,40 @@
         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 (cartJson.db !== undefined) {
                 db = cartJson.db;
             } else {
                 alert("Error no database from request");
             }
             // check right away for a special redirect to hgTracks:
             if (cartJson.positionMatches !== undefined &&
                     cartJson.positionMatches.length == 1 &&
                     cartJson.positionMatches[0].matches[0].doRedirect === true) {
-                match = cartJson.positionMatches[0].matches[0];
+                positionMatch = cartJson.positionMatches[0];
+                match = positionMatch.matches[0];
                 position = match.position;
                 newUrl = "../cgi-bin/hgTracks" + "?db=" + db + "&position=" + position;
                 if (match.highlight) {
                     newUrl += "&highlight=" + match.highlight;
                 }
+                if (positionMatch.name !== "chromInfo") {
+                    newUrl += "&" + positionMatch.name + "=pack";
+                }
                 window.location.replace(newUrl);
             }
             var urlParts = {};
             if (debugCartJson) {
                 console.log('from server:\n', cartJson);
             }
             if (typeof cartJson.search !== "undefined") {
                 urlParts = changeUrl({"search": cartJson.search});
             } else {
                 urlParts = changeUrl({"db": db});
                 cartJson.search = urlParts.urlVars.search;
             }
             _.assign(uiState,cartJson);
             if (typeof cartJson.categs  !== "undefined") {
                 _.each(uiState.positionMatches, function(match) {