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/makeDb/trackDb/buildTrix src/hg/makeDb/trackDb/buildTrix
index 79f5673..3dc8bb0 100755
--- src/hg/makeDb/trackDb/buildTrix
+++ src/hg/makeDb/trackDb/buildTrix
@@ -14,38 +14,44 @@
 dbs="$@"
 
 # check if a database exists, print note and return non-zero if it doesn't
 dbExists() {
     local db="$1"
     local dbChk=$(hgsql -Ne 'show databases like "'$db'"')
     if [ -z "$dbChk" ] ; then
         echo "Note: database $db does not exist, skipping"
         return 1
     else
         return 0
     fi
 }
 
 buildDbTrix() {
+    set -x
     local db="$1"
     local trixName="$2"
     local metaDbName="$3"
     local cvRaPath="$4"
     local outPath="$5"
     local tmpFile=`mktemp`;
     local tmpFile2=`mktemp`;
     local tmpFile3=`mktemp`;
     makeTrackIndex $db $metaDbName $cvRaPath > $tmpFile;
     if test -s $tmpFile; then
-        ixIxx -maxWordLength=64 $tmpFile $tmpFile2 $tmpFile3
+        ~/bin/x86_64/ixIxx -maxWordLength=64 $tmpFile $tmpFile2 $tmpFile3
 	chmod 664  $tmpFile2 $tmpFile3
+    ~/bin/x86_64/trixContextIndex $tmpFile ${db}_${trixName}
 	rsync -a $tmpFile2 $outMachine:$outPath/${db}_${trixName}.ix
 	rsync -a $tmpFile3 $outMachine:$outPath/${db}_${trixName}.ixx
+    rsync -a $tmpFile $outMachine:$outPath/${db}_${trixName}.txt
+    rsync -a ${db}_${trixName}.offsets $outMachine:$outPath/${db}_${trixName}.offsets
+    rsync -a ${db}_${trixName}.offsets.ixx $outMachine:$outPath/${db}_${trixName}.offsets.ixx
     fi
     rm -f $tmpFile $tmpFile2 $tmpFile3
+    set +x
 }
 
 for db in $dbs ; do
     if dbExists $db ; then
         buildDbTrix $db $trixName $metaDbName $cvRaPath $outPath
     fi
 done