e25660cfe3e40f77688852171a4868c0784afa69 angie Fri Oct 11 12:56:01 2019 -0700 Fixing error in assembly hub composite track search; also, don't default to bigBed name index unless a searchSpec (hfs) is given. refs #24238 diff --git src/hg/lib/bigBedFind.c src/hg/lib/bigBedFind.c index b730d40..324972b 100644 --- src/hg/lib/bigBedFind.c +++ src/hg/lib/bigBedFind.c @@ -133,68 +133,82 @@ char *description = NULL; if (hfs) { char buf[2048]; if (isNotEmpty(hfs->searchDescription)) truncatef(buf, sizeof(buf), "%s", hfs->searchDescription); else safef(buf, sizeof(buf), "%s", hfs->searchTable); description = cloneString(buf); } struct trackDb *tdb; boolean found = FALSE; for(tdb=tdbList; tdb; tdb = tdb->next) { if (tdb->subtracks) + { found = findBigBedPosInTdbList(cart, db, tdbList->subtracks, term, hgp, hfs) || found; + continue; + } + if (startsWith("bigWig", tdb->type) || !startsWith("big", tdb->type)) + continue; + + // Which field(s) to search? Look for searchIndex in search spec, then in trackDb for + // backwards compat. + char *indexField = NULL; + if (hfs) + indexField = hgFindSpecSetting(hfs, "searchIndex"); + if (!indexField) + indexField = trackDbSetting(tdb, "searchIndex"); + if (!indexField && !hfs) + continue; + // If !indexField but we do have a non-NULL hfs, then open file to see if it has a name index. char *fileName = trackDbSetting(tdb, "bigDataUrl"); - if (!fileName) + if (!fileName && !trackHubDatabase(db)) { struct sqlConnection *conn = hAllocConnTrack(db, tdb); fileName = bbiNameFromSettingOrTable(tdb, conn, tdb->table); hFreeConn(&conn); } if (!fileName) continue; // we fail silently if bigBed can't be opened. struct bbiFile *bbi = NULL; struct errCatch *errCatch = errCatchNew(); if (errCatchStart(errCatch)) { bbi = bigBedFileOpen(fileName); } errCatchEnd(errCatch); if (errCatch->gotError) continue; - // Which field(s) to search? Look for searchIndex in search spec, then in trackDb for - // backwards compat. If not found, but there is a name field with index, use that. - char *indexField = NULL; - if (hfs) - indexField = hgFindSpecSetting(hfs, "searchIndex"); - if (!indexField) - indexField = trackDbSetting(tdb, "searchIndex"); + // Now (since hfs is non-NULL) check the file to see if it has a name index if we + // don't already have indexField. if (!indexField) { struct slName *indexFields = bigBedListExtraIndexes(bbi); if (slNameInList(indexFields, "name")) indexField = "name"; slNameFreeList(&indexFields); } if (!indexField) + { + bigBedFileClose(&bbi); continue; + } struct slName *indexList = slNameListFromString(indexField, ','); struct hgPos *posList1 = NULL, *posList2 = NULL; char *trixFile = trackDbSetting(tdb, "searchTrix"); // if there is a trix file, use it to search for the term if (trixFile != NULL) { struct errCatch *errCatch = errCatchNew(); if (errCatchStart(errCatch)) { posList1 = doTrixSearch(cart, tdb, hReplaceGbdb(trixFile), indexList, bbi, term, NULL, hfs); } errCatchEnd(errCatch); if (errCatch->gotError)