ae58fc2850911b1d1fbaf842aed88d22c2776640 angie Fri Feb 12 12:59:23 2016 -0800 Adding a third search mode to trixSearch(), for less stringent searches such as autocomplete. The first two modes were previously designated by a boolean expand -- now there is an enum trixSearchMode whose first two values correspond to that (expand==FALSE = tsmExact, expand==TRUE = tsmExpand). The third mode, tsmFirstFive, returns matches of five or more characters even if there are many characters left in a long word. For example, "arabi" will match "arabidopsis" in tsmFirstFive mode, but not in tsmExpand mode because that leaves six unmatched letters after "arabi". diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c index a213ef0..f835e6d 100644 --- src/hg/hgHubConnect/hgHubConnect.c +++ src/hg/hgHubConnect/hgHubConnect.c @@ -281,31 +281,31 @@ // add this url to the hubStatus table hubFindOrAddUrlInStatusTable(database, cart, url, &errorMessage); } } struct hash *getUrlSearchHash(char *trixFile, char *hubSearchTerms) /* find hubs that match search term in trixFile */ { struct hash *urlSearchHash = newHash(5); struct trix *trix = trixOpen(trixFile); int trixWordCount = chopString(hubSearchTerms, " ", NULL, 0); char *trixWords[trixWordCount]; trixWordCount = chopString(hubSearchTerms, " ", trixWords, trixWordCount); -struct trixSearchResult *tsList = trixSearch(trix, trixWordCount, trixWords, TRUE); +struct trixSearchResult *tsList = trixSearch(trix, trixWordCount, trixWords, tsmExpand); for ( ; tsList != NULL; tsList = tsList->next) hashStore(urlSearchHash, tsList->itemId); return urlSearchHash; } static boolean outputPublicTable(struct sqlConnection *conn, char *publicTable, char *statusTable, struct hash **pHash) /* Put up the list of public hubs and other controls for the page. */ { char *trixFile = cfgOptionEnvDefault("HUBSEARCHTRIXFILE", "hubSearchTrixFile", "/gbdb/hubs/public.ix"); char *hubSearchTerms = cartOptionalString(cart, hgHubSearchTerms); char *cleanSearchTerms = cloneString(hubSearchTerms); boolean haveTrixFile = fileExists(trixFile); struct hash *urlSearchHash = NULL;