0c7c5e88d0ae39e0f8832fe919ea2b69c713ba50
hiram
  Thu Aug 29 14:26:14 2024 -0700
correctly add year specification when requested refs #32596

diff --git src/hg/hubApi/findGenome.c src/hg/hubApi/findGenome.c
index bb80eab..2bc433c 100644
--- src/hg/hubApi/findGenome.c
+++ src/hg/hubApi/findGenome.c
@@ -127,30 +127,32 @@
 
 static void addLevel(struct dyString *query)
 /* assemblyLevel = complete, chromosome, scaffold or contig */
 {
 if (isNotEmpty(assemblyLevel))
     sqlDyStringPrintf(query, " AND assemblyLevel='%s'", assemblyLevel);
 }
 
 static void addConditions(struct dyString *query)
 /* add any of the optional conditions */
 {
 addBrowserExists(query);
 addCategory(query);
 addStatus(query);
 addLevel(query);
+if (specificYear > 0)
+    sqlDyStringPrintf(query, " AND year='%u'", specificYear);
 }
 
 static long long multipleWordSearch(struct sqlConnection *conn, char **words, int wordCount, struct jsonWrite *jw, long long *totalMatchCount)
 /* perform search on multiple words, prepare json and return number of matches */
 {
 long long itemCount = 0;
 *totalMatchCount = 0;
 if (wordCount < 0)
     return itemCount;
 
 /* get the words[] into a single string */
 struct dyString *queryDy = dyStringNew(128);
 dyStringPrintf(queryDy, "%s", words[0]);
 for (int i = 1; i < wordCount; ++i)
     dyStringPrintf(queryDy, " %s", words[i]);