@@ -1386,16 +1386,19 @@ for (const kind of ['memory', 'file'] as StoreKind[]) {
13861386 const from = sql . length ;
13871387 const hits = await adapter . search ( QUERY , { source : s , topK : 2 , scope } ) ;
13881388 const want = await exact . adapter . search ( QUERY , { source : t , topK : 2 , scope } ) ;
1389- expect ( hits . map ( ( h ) => h . chunkId ) ) . toEqual ( want . map ( ( h ) => h . chunkId ) ) ;
1389+ // The passages the exact scan ranks, by record and passage: the two sources' chunk ids differ by their name.
1390+ const passages = ( found : typeof hits ) => found . map ( ( h ) => h . chunkId . slice ( h . chunkId . indexOf ( ':' ) ) ) ;
1391+ expect ( passages ( hits ) ) . toEqual ( passages ( want ) ) ;
13901392 return vectorLegs ( sql , from ) ;
13911393 } ;
13921394
13931395 // 99 passages in scope (records 141…239), under the cut: the exact scan alone, no one-bit pass.
13941396 expect ( await search ( [ { kind : 'record' , ids : records ( 141 , 240 ) } ] ) ) . toEqual ( { approximate : 0 , exact : 1 } ) ;
13951397 // 100 (records 140…239): the first pass, which keeps about 20 of its 80 candidates, and answers.
13961398 expect ( await search ( [ { kind : 'record' , ids : records ( 140 , 240 ) } ] ) ) . toEqual ( { approximate : 1 , exact : 0 } ) ;
1397- // The passages in scope are counted, not the ids: 20 records holding 100 passages take the first pass.
1398- expect ( await search ( [ { kind : 'record' , ids : records ( 0 , 20 ) } ] ) ) . toEqual ( { approximate : 1 , exact : 0 } ) ;
1399+ // The passages in scope are counted, not the ids: 20 records holding 100 passages take the first pass
1400+ // (whose pool of near-duplicate passages may then fall short, and the exact scan follow).
1401+ expect ( ( await search ( [ { kind : 'record' , ids : records ( 0 , 20 ) } ] ) ) . approximate ) . toBe ( 1 ) ;
13991402 // Two terms of 40 records each, one id in both: 80 passages, under the cut.
14001403 expect ( await search ( [ { kind : 'record' , ids : records ( 100 , 140 ) } , { kind : 'record' , ids : records ( 139 , 180 ) } ] ) ) . toEqual ( { approximate : 0 , exact : 1 } ) ;
14011404 // The narrow records beside a parent (metadata) term: the record index does not serve that scan, so
0 commit comments