Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
fix(doc sum router): use meta info instead of doc id to do doc sum
Browse files Browse the repository at this point in the history
  • Loading branch information
jemmyshin committed Aug 14, 2019
1 parent 2d1eaf3 commit 315bd16
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/test_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,16 @@ def test_doc_reduce_router(self):
# shard1 only has d1
s = msg.response.search.topk_results.add()
s.score = 0.1
s.doc.meta_info = b'1'
s.doc.doc_id = 1
s.doc.raw_text = 'd1'

s = msg.response.search.topk_results.add()
s.score = 0.2
s.doc.meta_info = b'2'
s.doc.doc_id = 2

s = msg.response.search.topk_results.add()
s.score = 0.3
s.doc.meta_info = b'3'
s.doc.doc_id = 3

msg.envelope.num_part.extend([1, 2])
c1.send_message(msg)
Expand All @@ -183,16 +183,16 @@ def test_doc_reduce_router(self):
# shard2 has d2 and d3
s = msg.response.search.topk_results.add()
s.score = 0.1
s.doc.meta_info = b'1'
s.doc.doc_id = 1

s = msg.response.search.topk_results.add()
s.score = 0.2
s.doc.meta_info = b'2'
s.doc.doc_id = 2
s.doc.raw_text = 'd2'

s = msg.response.search.topk_results.add()
s.score = 0.3
s.doc.meta_info = b'3'
s.doc.doc_id = 3
s.doc.raw_text = 'd3'

msg.response.search.top_k = 5
Expand Down Expand Up @@ -279,19 +279,19 @@ def test_doc_sum_reduce_router(self):

s = msg.response.search.topk_results.add()
s.score = 0.4
s.doc.doc_id = 1
s.doc.meta_info = b'1'
s.doc.raw_text = 'd3'
s.score_explained = '1-d3\n'

s = msg.response.search.topk_results.add()
s.score = 0.3
s.doc.doc_id = 2
s.doc.meta_info = b'2'
s.doc.raw_text = 'd2'
s.score_explained = '1-d2\n'

s = msg.response.search.topk_results.add()
s.score = 0.2
s.doc.doc_id = 3
s.doc.meta_info = b'3'
s.doc.raw_text = 'd1'
s.score_explained = '1-d3\n'

Expand All @@ -302,19 +302,19 @@ def test_doc_sum_reduce_router(self):

s = msg.response.search.topk_results.add()
s.score = 0.5
s.doc.doc_id = 1
s.doc.meta_info = b'1'
s.doc.raw_text = 'd2'
s.score_explained = '2-d2\n'

s = msg.response.search.topk_results.add()
s.score = 0.2
s.doc.doc_id = 2
s.doc.meta_info = b'2'
s.doc.raw_text = 'd1'
s.score_explained = '2-d1\n'

s = msg.response.search.topk_results.add()
s.score = 0.1
s.doc.doc_id = 3
s.doc.meta_info = b'3'
s.doc.raw_text = 'd3'
s.score_explained = '2-d3\n'

Expand Down

0 comments on commit 315bd16

Please sign in to comment.