private int collectCandidates ( Map < Long , Score > candidates , List < Bucket > buckets , int threshold ) { int ix ; for ( ix = 0 ; ix < threshold && candidates . size ( ) < ( CUTOFF_FACTOR_1 * max_search_hits ) ; ix ++ ) { Bucket b = buckets . get ( ix ) ; long [ ] ids = b . records ; double score = b . getScore ( ) ; for ( int ix2 = 0 ; ix2 < b . nextfree ; ix2 ++ ) { Score s = candidates . get ( ids [ ix2 ] ) ; if ( s == null ) { s = new Score ( ids [ ix2 ] ) ; candidates . put ( ids [ ix2 ] , s ) ; } s . score += score ; } if ( DEBUG ) System . out . println ( "Bucket " + b . nextfree + " -> " + candidates . size ( ) ) ; } return ix ; }
Goes through the first buckets picking out candidate records and tallying up their scores .