748b06ac95ff2a3957be3845bd3594984e3cc3cf chmalee Wed Aug 17 19:21:48 2022 -0700 Rename test cgi to official name. Always search everything, only show categories that have matches in the result list. Add /search endpoint to hubApi, add code to search help docs in hgSuggest but don't call it yet in autoComplete.js. Minor fixups so search result links work correctly. Fixing up old programs that call hgPositionsFind diff --git src/hg/inc/hgFind.h src/hg/inc/hgFind.h index 2352ea9..ab5072a 100644 --- src/hg/inc/hgFind.h +++ src/hg/inc/hgFind.h @@ -98,43 +98,57 @@ char **retChrom, int *retStart, int *retEnd, char *hgAppName, struct dyString *dyWarn); /* If *pPosition is a search term, then try to resolve it to genomic position(s). * If unable to find a unique position then revert pPosition to lastPosition (or default position). * Return a container of matching tables and positions. Warnings/errors are appended to dyWarn. */ void hgPositionsHtml(char *db, struct hgPositions *hgp, char *hgAppName, struct cart *cart); /* Write multiple search results as HTML. */ void hgPosFree(struct hgPos **pEl); /* Free up hgPos. */ void searchCategoryFree(struct searchCategory **el); /* Free a searchCategory */ -struct searchCategory *makeCategory(struct cart *cart, char *categName, struct searchableTrack *searchTrack, char *db, struct hash *trackHash, struct hash *groupHash); +#define hgFixedTrix "/gbdb/hgFixed/search/" +#define publicHubsTrix "hubSearchTextRows" +#define helpDocsTrix "searchableDocs" + +int cmpCategories(const void *a, const void *b); +/* Compare two categories for uniquifying */ + +struct trix *openStaticTrix(char *trixName); +/* Open up a trix file in hgFixed */ + +/* Caches used by various searching routines */ +extern struct hash *hgFindTrackHash; +extern struct hash *hgFindGroupHash; + +struct searchCategory *makeCategory(struct cart *cart, char *categName, struct searchableTrack *searchTrack, char *db, struct hash *groupHash); /* Make a single searchCategory, unless the requested categName is a container * track or track group (for example all phenotype tracks), in which case we make * categories for each subtrack */ -struct searchCategory *getCategsForNonDb(struct cart *cart, char *db, struct hash *trackHash, struct hash *groupHash); +struct searchCategory *getCategsForNonDb(struct cart *cart, char *db, struct hash *groupHash); /* Return the default categories for all databases */ -struct searchCategory *getCategsForDatabase(struct cart *cart, char *db, struct hash *trackHash, struct hash *groupHash); +struct searchCategory *getCategsForDatabase(struct cart *cart, char *db, struct hash *groupHash); /* Get the default categories to search if user has not selected any before. * By default we search for gene loci (knownGene), track names, and track items */ -struct searchCategory *getAllCategories(struct cart *cart, char *db, struct hash *trackHash, struct hash *groupHash); +struct searchCategory *getAllCategories(struct cart *cart, char *db, struct hash *groupHash); /* If we have saved categories for this database from the last search, return those, * otherwise return the default selection */ void hgPositionsHelpHtmlCart(struct cart *cart, char *organism, char *database); /* Display contents of dbDb.htmlPath for database, or print an HTML comment * explaining what's missing. */ #define hgPositionsHelpHtml(o, d) hgPositionsHelpHtmlCart(cart, o, d) char *hCarefulTrackOpenVisCart(struct cart *cart, char *db, char *trackName); /* If track is already in full mode, return full; otherwise, return * hTrackOpenVis. */ #define hCarefulTrackOpenVis(d, t) hCarefulTrackOpenVisCart(cart, d, t) char *addHighlight(char *db, char *chrom, unsigned start, unsigned end); /* Return a string that can be assigned to the cart var addHighlight, to add a yellow highlight