8637af0782efc3d9d13ae865e3e8e0a4f1f1545d chmalee Fri Apr 10 14:18:16 2026 -0700 When doing bigBed searches, the hgPos->browserName needs to match tg->mapItemName so item highlights work. Typically this works because we expect to search for things by item name, but with multiple indexes if we get a match on a non-name index then we need to be sure the name field is set as browserName (and thus hgFind.matches on the URL) rather than the searched term, refs #34866 diff --git src/hg/lib/bigBedFind.c src/hg/lib/bigBedFind.c index 2329a842b6e..24b85d71d62 100644 --- src/hg/lib/bigBedFind.c +++ src/hg/lib/bigBedFind.c @@ -55,44 +55,46 @@ bigBedLabelCalculateFields(cart, tdb, bbi, &labelColumns ); char startBuf[256], endBuf[256], *row[bbi->fieldCount]; for (interval = intervalList; interval != NULL; interval = interval->next) { struct hgPos *hgPos; AllocVar(hgPos); slAddHead(&posList, hgPos); bbiCachedChromLookup(bbi, interval->chromId, lastChromId, chromName, sizeof(chromName)); lastChromId = interval->chromId; hgPos->chrom = cloneString(chromName); hgPos->chromStart = interval->start; hgPos->chromEnd = interval->end; - hgPos->browserName = cloneString(term); hgPos->description = cloneString(description); + int rowFieldCount = bigBedIntervalToRow(interval, chromName, startBuf, endBuf, row, bbi->fieldCount); if (searchItemLabel) { - bigBedIntervalToRow(interval, chromName, startBuf, endBuf, row, bbi->fieldCount); hgPos->name = replaceFieldInPattern(searchItemLabel, bbi->fieldCount, fieldNames, row); } else { hgPos->name = bigBedMakeLabel(tdb, labelColumns, interval, chromName); - if (hfs && (sameString(hfs->searchName, "mane") || sameString(hfs->searchName, "hgnc"))) - bigBedIntervalToRow(interval, chromName, startBuf, endBuf, row, bbi->fieldCount); } + // browserName needs to correspond to tg->mapItemName() + if (rowFieldCount > 3) + hgPos->browserName = cloneString(row[3]); + else + hgPos->browserName = cloneString(term); if (hfs) { char *paddingStr = hgFindSpecSetting(hfs, "padding"); int padding = isEmpty(paddingStr) ? 0 : atoi(paddingStr); if (padding > 0) { // highlight the item bases only, to distinguish from padding hgPos->highlight = addHighlight(cartString(cart, "db"), hgPos->chrom, hgPos->chromStart, hgPos->chromEnd); hgPos->chromStart -= padding; hgPos->chromEnd += padding; if (hgPos->chromStart < 0) hgPos->chromStart = 0; }