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/index/trixSearch/trixSearch.c src/index/trixSearch/trixSearch.c index 9ae200a..5d3d30d 100644 --- src/index/trixSearch/trixSearch.c +++ src/index/trixSearch/trixSearch.c @@ -58,31 +58,31 @@ } } void trixSearchCommand(char *inFile, int wordCount, char *words[]) /* trixSearchCommand - search trix free text index from command line. */ { struct trix *trix; char ixFile[PATH_LEN]; struct trixSearchResult *tsList; int i; safef(ixFile, sizeof(ixFile), "%s.ix", inFile); for (i=0; i<wordCount; ++i) tolowers(words[i]); trix = trixOpen(ixFile); -tsList = trixSearch(trix, wordCount, words, TRUE); +tsList = trixSearch(trix, wordCount, words, tsmExpand); dumpTsList(tsList); trixSearchResultFreeList(&tsList); trixClose(&trix); } int main(int argc, char *argv[]) /* Process command line. */ { optionInit(&argc, argv, options); if (argc < 3) usage(); maxReturn = optionInt("maxReturn", maxReturn); full = optionExists("full"); trixSearchCommand(argv[1], argc-2, argv+2); return 0;