15438197526bd4c53ebd64921edc05e266f28a93 angie Thu Jan 11 11:23:26 2018 -0800 Apply the limitResults parameter to the number of matching terms collected in hgFind.matches, so a term with thousands of matching results doesn't lead to a cart so big that it's slow. refs #20809 diff --git src/hg/lib/hgFind.c src/hg/lib/hgFind.c index 7018a05..b2043a4 100644 --- src/hg/lib/hgFind.c +++ src/hg/lib/hgFind.c @@ -3244,47 +3244,53 @@ { for (hfs = longList; hfs != NULL; hfs = hfs->next) { hgFindUsingSpec(db, hfs, term, limitResults, hgp, relativeFlag, relStart, relEnd, multiTerm); } /* Lowe lab additions -- would like to replace these with specs, but * will leave in for now. */ if (!trackHubDatabase(db)) findTigrGenes(db, term, hgp); trackHubFindPos(db, term, hgp); } hgFindSpecFreeList(&shortList); hgFindSpecFreeList(&longList); + if (cart != NULL) + { if(hgpMatchNames == NULL) hgpMatchNames = newDyString(256); + dyStringClear(hgpMatchNames); + int matchCount = 0; for(hgpItem = hgp; hgpItem != NULL; hgpItem = hgpItem->next) { struct hgPosTable *hpTable = NULL; for(hpTable = hgpItem->tableList; hpTable != NULL; hpTable = hpTable->next) { struct hgPos *pos = NULL; for(pos = hpTable->posList; pos != NULL; pos = pos->next) { + if (limitResults != EXHAUSTIVE_SEARCH_REQUIRED && matchCount++ >= limitResults) + break; dyStringPrintf(hgpMatchNames, "%s,", pos->browserName); } } } - if (cart != NULL) cartSetString(cart, "hgFind.matches", hgpMatchNames->string); } + } slReverse(&hgp->tableList); if (multiTerm) collapseSamePos(hgp); fixSinglePos(hgp); if (cart && hgp->singlePos && isNotEmpty(hgp->singlePos->highlight)) cartSetString(cart, "highlight", hgp->singlePos->highlight); return hgp; } void hgPositionsHelpHtml(char *organism, char *database) /* Display contents of dbDb.htmlPath for database, or print an HTML comment * explaining what's missing. */ { char *htmlPath = hHtmlPath(database);