af3a143571e5aa064eab75c34f9444b35413b562 chmalee Tue Nov 30 15:28:15 2021 -0800 Add snippet support to trix searching. Required changing the wordPos from the first highest matching wordIndex to the wordIndex of the actual span. Have trixContextIndex create a second level index for fast retrieval of line offsets in original text file used by ixIxx. Create a simple UI for navigating hgFind search results. diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c index 3ec710e..fad775c 100644 --- src/hg/hgTracks/hgTracks.c +++ src/hg/hgTracks/hgTracks.c @@ -64,30 +64,31 @@ #include "chromInfo.h" #include "extTools.h" #include "basicBed.h" #include "customFactory.h" #include "genbank.h" #include "bigWarn.h" #include "wigCommon.h" #include "knetUdc.h" #include "hex.h" #include #include "customComposite.h" #include "chromAlias.h" #include "jsonWrite.h" #include "cds.h" #include "cacheTwoBit.h" +#include "cartJson.h" //#include "bed3Sources.h" /* Other than submit and Submit all these vars should start with hgt. * to avoid weeding things out of other program's namespaces. * Because the browser is a central program, most of its cart * variables are not hgt. qualified. It's a good idea if other * program's unique variables be qualified with a prefix though. */ char *excludeVars[] = { "submit", "Submit", "dirty", "hgt.reset", "hgt.in1", "hgt.in2", "hgt.in3", "hgt.inBase", "hgt.out1", "hgt.out2", "hgt.out3", "hgt.out4", "hgt.left1", "hgt.left2", "hgt.left3", "hgt.right1", "hgt.right2", "hgt.right3", "hgt.dinkLL", "hgt.dinkLR", "hgt.dinkRL", "hgt.dinkRR", "hgt.tui", "hgt.hideAll", "hgt.visAllFromCt", @@ -9475,33 +9476,31 @@ static boolean resolvePosition(char **pPosition) /* Position may be an already-resolved chr:start-end, or a search term. * If it is a search term: * 1 match ==> set globals chromName, winStart, winEnd, return TRUE. * 0 matches ==> switch back to lastPosition, hopefully get 1 match from that; * set globals chromName, winStart, winEnd, return TRUE. If no lastPosition, try w/hDefaultPos(). * multiple matches ==> Display a page with links to match positions, return FALSE. */ { boolean resolved = TRUE; struct dyString *dyWarn = dyStringNew(0); boolean noShort = (cartOptionalString(cart, "noShort") != NULL); hgp = hgFindSearch(cart, pPosition, &chromName, &winStart, &winEnd, hgTracksName(), dyWarn); displayChromName = chromAliasGetDisplayChrom(database, cart, chromName); if (isNotEmpty(dyWarn->string)) { - if (noShort) // we're on the second pass of the search - hgp->posCount = 0; // hgFindSearch gives us a bogus hgp if the warn string is set - else + if (!noShort) // we're not on the second pass of the search warn("%s", dyWarn->string); } if (!noShort && hgp->singlePos) { createHgFindMatchHash(); } else { char *menuStr = menuBar(cart, database); if (menuStr) puts(menuStr); hgPositionsHtml(database, hgp, hgTracksName(), cart); resolved = FALSE; }