16eee40c920d259c10ee345472708d0cc0cc3393
chmalee
Tue Mar 3 11:25:23 2026 -0800
Adds an hg.conf defined 'popular' species list to the new search bar as a 'default' list of results upon focus of the search bar. Combines with 'recents' list. Add a chevron next to the search bar so users know the autocomplete has some default options, refs #36232
diff --git src/hg/lib/web.c src/hg/lib/web.c
index d80ba6ba4b9..acdf382ab03 100644
--- src/hg/lib/web.c
+++ src/hg/lib/web.c
@@ -942,42 +942,70 @@
*
* The caller CGI needs to include jquery-ui.js and utils.js to turn this into a
* useable search bar with autocomplete */
{
printf("
\n"); // for styling purposes
if (isNotEmpty(labelText))
{
printf("", id, isNotEmpty(labelClassStr) ? labelClassStr : "genomeSearchLabelDefault", labelText);
}
printf("
\n");
printf("\n");
+printf("\n", id);
if (withSearchButton)
printf("", id);
char *searchHelpText = "All genome searches are case-insensitive. Single-word searches default to prefix "
"matching if an exact match is not found. "
"
"
"
Force inclusion: Use a + sign before +word to ensure it appears in result.
"
"
Exclude words: Use a - sign before -word to exclude it from the search result.
"
"
Wildcard search: Add an * (asterisk) at end of word* to search for all terms starting with that prefix.
"
"
Phrase search: Enclose 'words in quotes' to search for the exact phrase.
"
"
";
printInfoIcon(searchHelpText);
printf("
\n"); // the search button is grouped with the input
+// Embed popular assemblies JSON for the autocomplete dropdown
+{
+char *popularStr = cfgOptionDefault("browser.popularGenomes",
+ "hg38,hg19,mm39,mm10,rn7,danRer11,dm6,ce11,sacCer3");
+struct slName *dbNames = slNameListFromComma(popularStr);
+struct dyString *json = dyStringNew(512);
+dyStringAppendC(json, '[');
+boolean first = TRUE;
+struct slName *dbIter;
+for (dbIter = dbNames; dbIter != NULL; dbIter = dbIter->next)
+ {
+ struct dbDb *info = hDbDb(dbIter->name);
+ if (info == NULL || !info->active)
+ continue;
+ if (!first)
+ dyStringAppendC(json, ',');
+ first = FALSE;
+ dyStringPrintf(json, "{\"db\":\"%s\",\"label\":\"%s - %s (%s)\",\"commonName\":\"%s\"}",
+ info->name, info->organism, info->description, info->name, info->organism);
+ }
+dyStringAppendC(json, ']');
+printf("\n", id, dyStringContents(json));
+dyStringFree(&json);
+slFreeList(&dbNames);
+}
printf("
\n");
}
static char *getDbForGenome(char *genome, struct cart *cart)
/*
Function to find the default database for the given Genome.
It looks in the cart first and then, if that database's Genome matches the
passed-in Genome, returns it. If the Genome does not match, it returns the default
database that does match that Genome.
param Genome - The Genome for which to find a database
param cart - The cart to use to first search for a suitable database name
return - The database matching this Genome type
*/
{