@@ -13,20 +13,24 @@ def test_matching_phase
1313 deploy_app ( SearchApp . new . sd ( selfdir +'test.sd' ) . threads_per_search ( 1 ) )
1414 start
1515 feed_docs
16- run_weak_and_query ( 5 )
17- run_weak_and_query ( 1 )
18- run_nns_query ( 5 )
19- run_nns_query ( 1 )
16+ run_weak_and_query ( 'targetHits' , 5 )
17+ run_weak_and_query ( 'targetHits' , 1 )
18+ run_weak_and_query ( 'totalTargetHits' , 5 ) # 1 node -> same as targetHits
19+ run_weak_and_query ( 'totalTargetHits' , 1 ) # 1 node -> same as targetHits
20+ run_nns_query ( 'targetHits' , 5 )
21+ run_nns_query ( 'targetHits' , 1 )
22+ run_nns_query ( 'totalTargetHits' , 5 ) # 1 node -> same as targetHits
23+ run_nns_query ( 'totalTargetHits' , 1 ) # 1 node -> same as targetHits
2024 end
2125
22- def run_weak_and_query ( target_hits )
26+ def run_weak_and_query ( target_hits_parameter , target_hits )
2327 # significance used for bm25, weight used for weak and
2428 wand_terms = [ 'text contains ({significance:0.1, weight:100}"one")' ,
2529 'text contains ({significance:0.2, weight:200}"two")' ,
2630 'text contains ({significance:0.3, weight:300}"three")' ,
2731 'text contains ({significance:0.5, weight:500}"four")' ,
2832 'text contains ({significance:0.4, weight:400}"five")' ] ;
29- result = search ( { 'yql' => 'select * from sources * where ({targetHits : ' + target_hits . to_s + '}weakAnd(' + wand_terms . join ( ', ' ) + '))' ,
33+ result = search ( { 'yql' => 'select * from sources * where ({' + target_hits_parameter + ' : ' + target_hits . to_s + '}weakAnd(' + wand_terms . join ( ', ' ) + '))' ,
3034 'ranking' => 'weakand' } )
3135 if target_hits == 1
3236 # First update of scores heap threshold is after 4 documents.
@@ -68,8 +72,8 @@ def assert_scores(exp_relevancy, result, feature)
6872 assert_equal ( exp_relevancy , extract_features ( result , 'matchfeatures' , feature ) )
6973 end
7074
71- def run_nns_query ( target_hits )
72- result = search ( { 'yql' => 'select * from sources * where ({targetHits : ' + target_hits . to_s + ', label: "nns"}nearestNeighbor(pos, query_pos))' ,
75+ def run_nns_query ( target_hits_parameter , target_hits )
76+ result = search ( { 'yql' => 'select * from sources * where ({' + target_hits_parameter + ' : ' + target_hits . to_s + ', label: "nns"}nearestNeighbor(pos, query_pos))' ,
7377 'input.query(query_pos)' => '[0.0,0.0]' ,
7478 'ranking' => 'nns' } )
7579 if target_hits == 1
0 commit comments