15aca5da7562e7314e110729f6b5e85f3b77371b jcasper Mon Jul 24 08:57:28 2017 -0700 hgHubConnect now requires all search terms and supports term expansion, refs #19758 diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c index 64fff60..41fa255 100644 --- src/hg/hgHubConnect/hgHubConnect.c +++ src/hg/hgHubConnect/hgHubConnect.c @@ -354,53 +354,106 @@ "select %s.hubUrl from %s left join %s on %s.hubUrl = %s.hubUrl where %s.hubUrl is NULL", publicTable, publicTable, statusTable, publicTable, statusTable, statusTable); struct sqlResult *sr = sqlGetResult(conn, query); char **row; while ((row = sqlNextRow(sr)) != NULL) { char *errorMessage = NULL; char *url = row[0]; // add this url to the hubStatus table hubFindOrAddUrlInStatusTable(database, cart, url, &errorMessage); } } +char *modifyTermsForHubSearch(char *hubSearchTerms, bool isStrictSearch) +/* This won't exactly be pretty. MySQL treats any sequence of alphanumerics and underscores + * as a word, and single apostrophes are allowed as long as they don't come back-to-back. + * Cut down to those characters, then add initial + (for requiring word) and * (for word + * expansion) as appropriate. */ +{ +char *cloneTerms = cloneString(hubSearchTerms); +struct dyString *modifiedTerms = dyStringNew(0); +if (isNotEmpty(cloneTerms)) + { + int i; + for (i=0; itextLength == hubSearchTextLong) && isEmpty(hst->text)) + continue; char *hubUrl = hst->hubUrl; struct hubEntry *hubInfo = hashFindVal(hubLookup, hubUrl); if (hubInfo == NULL) continue; // Search table evidently includes a hub that's not on this server. Skip it. char *db = cloneString(hst->db); tolowers(db); if (isNotEmpty(dbFilter)) { if (isNotEmpty(db)) { if (stringIn(dbFilter, db) == NULL) continue; } else { @@ -849,31 +902,30 @@ /* Given a hub's info and a structure listing the search hits within the hub, first print * a basic line of hub information with a "connect" button. Then, if the search results * are non-NULL, write out information about the genomes and tracks from the search hits that * match the db filter. * If there are no search results to print, the basic hub lines are combined into a single HTML table * that is defined outside this function. * Otherwise, each hub line is printed in its own table followed by a