c6ce277e36a537437a04146c8fa7adebb40428ff
chmalee
  Wed May 15 12:10:42 2024 -0700
Libify some searching code so checkHgFindSpec can use it. Make checkHgFindSpec use the same code path as hgSearch so it can correctly test the search correctly, refs #33731

diff --git src/hg/inc/hgFind.h src/hg/inc/hgFind.h
index ab5072a..20ed351 100644
--- src/hg/inc/hgFind.h
+++ src/hg/inc/hgFind.h
@@ -84,57 +84,54 @@
     char *shortLabel;
     char *longLabel;
     char *description;
     unsigned char visibility;
     float priority;
     char *grp;
     };
 
 
 struct hgPositions *hgPositionsFind(char *db, char *query, char *extraCgi,
 	char *hgAppName, struct cart *cart, boolean multiTerm, boolean measureTiming, struct searchCategory *categories);
 /* Return container of tracks and positions (if any) that match term. */
 
 struct hgPositions *hgFindSearch(struct cart *cart, char **pPosition,
                                  char **retChrom, int *retStart, int *retEnd,
-                                 char *hgAppName, struct dyString *dyWarn);
+                                 char *hgAppName, struct dyString *dyWarn, struct searchCategory *categories);
 /* 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 */
 
 #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 *groupHash);
 /* Return the default categories for all databases */
 
 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 *groupHash);
 /* If we have saved categories for this database from the last search, return those,
@@ -142,17 +139,22 @@
 
 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
  * at db.chrom:start+1-end for search results. */
 
+void hashTracksAndGroups(struct cart *cart, char *db);
+/* get the list of tracks available for this assembly, along with their group names
+ * and visibility-ness. Note that this implicitly makes connected hubs show up
+ * in the trackList struct, which means we get item search for connected
+ * hubs for free */
 #endif /* HGFIND_H */