8705123ad669501646271bdd1e341af235dcb1fd
chmalee
  Fri Jul 22 09:37:38 2022 -0700
Fix subtle duplicated item bug in bigBed trix searching

diff --git src/hg/lib/bigBedFind.c src/hg/lib/bigBedFind.c
index 9ffd17f..e3c5862 100644
--- src/hg/lib/bigBedFind.c
+++ src/hg/lib/bigBedFind.c
@@ -204,37 +204,41 @@
     // 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)
             warn("trix search failure for %s: %s", tdb->table, dyStringContents(errCatch->message));
         errCatchFree(&errCatch);
 	}
 
+    // if no trix file or we didn't find anything from a trix search
+    if (!posList1)
+        {
         // now search for the raw id's
         struct slName *oneIndex=indexList;
         for (; oneIndex; oneIndex = oneIndex->next)
             {
             posList2 = getPosFromBigBed(cart, tdb, bbi, oneIndex->name, term, NULL, hfs);
             posList1 = slCat(posList1, posList2);
             }
+        }
 
     if (posList1 != NULL)
 	{
 	struct hgPosTable *table;
 
 	found = TRUE;
 	AllocVar(table);
 	slAddHead(&hgp->tableList, table);
 	table->description = cloneString(description ? description : tdb->longLabel);
 	table->name = cloneString(tdb->table);
 
 	table->posList = posList1;
 	}
     bigBedFileClose(&bbi);
     }