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/hgTracks/searchTracks.c src/hg/hgTracks/searchTracks.c index c5137c9..75915e0 100644 --- src/hg/hgTracks/searchTracks.c +++ src/hg/hgTracks/searchTracks.c @@ -185,31 +185,31 @@ val = nextWord(&tmp); } if (trixWordCount > 0) { // Unfortunately trixSearch can't handle the slName list int i; char **trixWords = needMem(sizeof(char *) * trixWordCount); for (i = 0, el = trixList; el != NULL; i++, el = el->next) trixWords[i] = strLower(el->name); // Now open the trix file char trixFile[HDB_MAX_PATH_STRING]; getSearchTrixFile(database, trixFile, sizeof(trixFile)); struct trix *trix = trixOpen(trixFile); - struct trixSearchResult *tsList = trixSearch(trix, trixWordCount, trixWords, TRUE); + struct trixSearchResult *tsList = trixSearch(trix, trixWordCount, trixWords, tsmExpand); for ( ; tsList != NULL; tsList = tsList->next) { struct track *track = (struct track *) hashFindVal(trackHash, tsList->itemId); if (track != NULL) // It is expected that this is NULL { // (e.g. when trix references trackDb tracks which have no tables) refAdd(&tracks, track); } } //trixClose(trix); // don't bother (this is a CGI that is about to end) } } return tracks; } static struct slRef *advancedSearchForTracks(struct sqlConnection *conn,struct group *groupList,