public void collectTermsByPrefixesForListOfHitPositions ( String field , int docId , ArrayList < String > prefixes , ArrayList < IntervalTreeNodeData < String > > positionsHits ) throws IOException { IndexDoc doc = getDoc ( field , docId ) ; IndexInput inIndexObjectPosition = indexInputList . get ( "indexObjectPosition" ) ; IndexInput inTerm = indexInputList . get ( "term" ) ; // create tree interval hits IntervalRBTree < String > positionTree = new IntervalRBTree < String > ( positionsHits ) ; // find prefixIds Map < String , Integer > prefixIds = getPrefixesIds ( field , prefixes ) ; // search matching tokens if ( prefixIds != null ) { CodecSearchTree . searchMtasTreeWithIntervalTree ( prefixIds . values ( ) , positionTree , inIndexObjectPosition , doc . fpIndexObjectPosition , doc . smallestObjectFilepointer ) ; // reverse list Map < Integer , String > idPrefixes = new HashMap <> ( ) ; for ( Entry < String , Integer > entry : prefixIds . entrySet ( ) ) { idPrefixes . put ( entry . getValue ( ) , entry . getKey ( ) ) ; } // term administration Map < Long , String > refTerms = new HashMap <> ( ) ; for ( IntervalTreeNodeData < String > positionHit : positionsHits ) { for ( MtasTreeHit < String > hit : positionHit . list ) { if ( hit . idData == null ) { hit . idData = idPrefixes . get ( hit . additionalId ) ; if ( ! refTerms . containsKey ( hit . additionalRef ) ) { refTerms . put ( hit . additionalRef , MtasCodecPostingsFormat . getTerm ( inTerm , hit . additionalRef ) ) ; } hit . refData = refTerms . get ( hit . additionalRef ) ; } } } } }
Collect terms by prefixes for list of hit positions .