58025f52231b5081e9a8dee4372f36e85f25da90
chmalee
  Mon Oct 31 12:12:17 2022 -0700
Allow knownGene snippet file to not exist and fall back to kgXref descriptions, refs #29693

diff --git src/hg/lib/hgFind.c src/hg/lib/hgFind.c
index 8bddf55..8f54454 100644
--- src/hg/lib/hgFind.c
+++ src/hg/lib/hgFind.c
@@ -514,33 +514,41 @@
 char *db = sqlGetDatabase(conn);
 char *dbName;
 
 if (sameString(name, "knownGene"))
     dbName = db;
 else
     dbName = name;
 
 if (slCount(tsrList) > maxToReturn)
     {
     //warn("Search terms are not very specific, only showing first %d matching UCSC Genes.",
    // 	maxToReturn);
     tsr = slElementFromIx(tsrList, maxToReturn-1);
     tsr->next = NULL;
     }
+// allow supporting snippet file to not exist, if there are no
+// snippets then the below code will use the description from
+// kgXref
+struct errCatch *errCatch = errCatchNew();
+if (errCatchStart(errCatch))
+    {
     char *context = hgFindSpecSetting(hfs, "searchTrixContext");
     if (context && sameString(context, "on"))
         addSnippetsToSearchResults(tsrList, trix);
+    }
+errCatchEnd(errCatch);
 
 /* Make hash of all search results - one for each known gene ID. */
 for (tsr = tsrList; tsr != NULL; tsr = tsr->next)
     {
     lmAllocVar(hash->lm, tp);
     tp->tsr = tsr;
     slAddHead(&tpList, tp);
     hashAdd(hash, tsr->itemId, tp);
     }
 
 /* Stream through knownGenes table and make up a pos
  * for each mapping of each gene matching search. */
 sqlDyStringPrintf(dy,
 	"select kg.name,kg.chrom,kg.txStart,kg.txEnd,geneSymbol,description,kc.transcript from %s.knownGene kg "
         "join %s.kgXref on kg.name = %s.kgXref.kgID "