diff --git a/README.md b/README.md index 5304031a3..a7f07e5d1 100644 --- a/README.md +++ b/README.md @@ -20,17 +20,15 @@ For additional details, [our paper](https://dl.acm.org/doi/10.1145/3404835.34632 ## Important Note: Lucene 8 to Lucene 9 Transition The [PyPI release 0.17.1](https://pypi.org/project/pyserini/0.17.1/) at commit [`33c87c`](https://github.com/castorini/pyserini/commit/33c87c982d543d65e0ba1b4c94ee865fd9a6040e) (2022/08/13) is the last official Pyserini release built on Lucene 8, based on [Anserini v0.14.4](https://github.com/castorini/anserini/releases/tag/anserini-0.14.4). -Main Anserini trunk has been upgraded to Lucene 9.3. +Main Anserini trunk has been upgraded to Lucene 9.3 and the latest release, [Anserini v0.15.0](https://github.com/castorini/anserini/releases/tag/anserini-0.15.0), is built on that version. This is an important but disruptive upgrade, as indexes built with Lucene 8 are not backwards compatible with Lucene 9 code (see [Anserini #1952](https://github.com/castorini/anserini/issues/1952)). There is a workaround, but we have yet to implement in Pyserini. Furthermore, Lucene 8 code is _not_ able to read indexes built with Lucene 9. An upgrade to Lucene 9 is necessary to use Lucene's HNSW indexes, which will increase the capabilities of Pyserini and open up the design space of dense/sparse hybrids. -Thus, we are in a transition where a development installation is partially broken, since the development installation jar will be based on Lucene 9, but the Pyserini codebase has not been updated to accommodate. -For a self-consistent development installation (that passes all tests), grab `anserini-0.14.4-fatjar.jar` from [here](https://repo1.maven.org/maven2/io/anserini/anserini/0.14.4/) to drop into `pyserini/resources/jars`. - -This note supersedes all other Pyserini documentation on this site. +We are working hard on a corresponding Pyserini upgrade right now. +For a development installation, make sure you grab the `anserini-0.15.0-fatjar.jar` from [here](https://repo1.maven.org/maven2/io/anserini/anserini/0.15.0/) to drop into `pyserini/resources/jars` to make sure that you're using Lucene 9. ## Installation diff --git a/integrations/clprf/test_clprf.py b/integrations/clprf/test_clprf.py index d98dbfe0c..132951077 100644 --- a/integrations/clprf/test_clprf.py +++ b/integrations/clprf/test_clprf.py @@ -115,7 +115,7 @@ def test_core17(self): self.assertTrue(self.core17_checker.run('core17_bm25', '--bm25', 0.2087)) def test_core17_rm3(self): - self.assertTrue(self.core17_checker.run('core17_bm25', '--bm25 --rm3', 0.2823)) + self.assertTrue(self.core17_checker.run('core17_bm25', '--bm25 --rm3', 0.2798)) def test_core17_lr(self): pyserini_topics = 'core17' @@ -159,7 +159,7 @@ def test_core17_lr_rm3(self): self.assertEqual(status, 0) self.assertEqual(stderr, '') - self.assertAlmostEqual(score, 0.2940, delta=0.0001) + self.assertAlmostEqual(score, 0.2926, delta=0.0001) def test_core17_svm(self): pyserini_topics = 'core17' @@ -203,7 +203,7 @@ def test_core17_svm_rm3(self): self.assertEqual(status, 0) self.assertEqual(stderr, '') - self.assertAlmostEqual(score, 0.2970, delta=0.0001) + self.assertAlmostEqual(score, 0.2956, delta=0.0001) def test_core17_avg(self): pyserini_topics = 'core17' @@ -247,7 +247,7 @@ def test_core17_avg_rm3(self): self.assertEqual(status, 0) self.assertEqual(stderr, '') - self.assertAlmostEqual(score, 0.2967, delta=0.0001) + self.assertAlmostEqual(score, 0.2950, delta=0.0001) def test_core17_rrf(self): pyserini_topics = 'core17' @@ -317,13 +317,13 @@ def test_core17_rrf_rm3(self): self.assertEqual(status, 0) self.assertEqual(stderr, '') - self.assertAlmostEqual(score, 0.2965, delta=0.0001) + self.assertAlmostEqual(score, 0.2957, delta=0.0001) def test_core18(self): self.assertTrue(self.core18_checker.run('core18_bm25', '--bm25', 0.2496)) def test_core18_rm3(self): - self.assertTrue(self.core18_checker.run('core18_bm25', '--bm25 --rm3', 0.3139)) + self.assertTrue(self.core18_checker.run('core18_bm25', '--bm25 --rm3', 0.3129)) def test_core18_lr(self): pyserini_topics = 'core18' @@ -367,7 +367,7 @@ def test_core18_lr_rm3(self): self.assertEqual(status, 0) self.assertEqual(stderr, '') - self.assertAlmostEqual(score, 0.3222, delta=0.0001) + self.assertAlmostEqual(score, 0.3216, delta=0.0001) def test_core18_svm(self): pyserini_topics = 'core18' @@ -411,7 +411,7 @@ def test_core18_svm_rm3(self): self.assertEqual(status, 0) self.assertEqual(stderr, '') - self.assertAlmostEqual(score, 0.3216, delta=0.0001) + self.assertAlmostEqual(score, 0.3200, delta=0.0001) def test_core18_avg(self): pyserini_topics = 'core18' @@ -455,7 +455,7 @@ def test_core18_avg_rm3(self): self.assertEqual(status, 0) self.assertEqual(stderr, '') - self.assertAlmostEqual(score, 0.3227, delta=0.0001) + self.assertAlmostEqual(score, 0.3215, delta=0.0001) def test_core18_rrf(self): pyserini_topics = 'core18' @@ -525,13 +525,13 @@ def test_core18_rrf_rm3(self): self.assertEqual(status, 0) self.assertEqual(stderr, '') - self.assertAlmostEqual(score, 0.3214, delta=0.0001) + self.assertAlmostEqual(score, 0.3205, delta=0.0001) def test_robust04(self): self.assertTrue(self.robust04_checker.run('robust04_bm25', '--bm25', 0.2531)) def test_robust04_rm3(self): - self.assertTrue(self.robust04_checker.run('robust04_bm25_rm3', '--bm25 --rm3', 0.2903)) + self.assertTrue(self.robust04_checker.run('robust04_bm25_rm3', '--bm25 --rm3', 0.2908)) def test_robust04_lr(self): pyserini_topics = 'robust04' @@ -575,7 +575,7 @@ def test_robust04_lr_rm3(self): self.assertEqual(status, 0) self.assertEqual(stderr, '') - self.assertAlmostEqual(score, 0.2971, delta=0.0001) + self.assertAlmostEqual(score, 0.2969, delta=0.0001) def test_robust04_svm(self): pyserini_topics = 'robust04' @@ -619,7 +619,7 @@ def test_robust04_svm_rm3(self): self.assertEqual(status, 0) self.assertEqual(stderr, '') - self.assertAlmostEqual(score, 0.2967, delta=0.0001) + self.assertAlmostEqual(score, 0.2972, delta=0.0001) def test_robust04_avg(self): pyserini_topics = 'robust04' @@ -733,13 +733,13 @@ def test_robust04_rrf_rm3(self): self.assertEqual(status, 0) self.assertEqual(stderr, '') - self.assertAlmostEqual(score, 0.2975, delta=0.0001) + self.assertAlmostEqual(score, 0.2977, delta=0.0001) def test_robust05(self): self.assertTrue(self.robust05_checker.run('robust05_bm25', '--bm25', 0.2032)) def test_robust05_rm3(self): - self.assertTrue(self.robust05_checker.run('robust05_bm25_rm3', '--bm25 --rm3', 0.2602)) + self.assertTrue(self.robust05_checker.run('robust05_bm25_rm3', '--bm25 --rm3', 0.2624)) def test_robust05_lr(self): pyserini_topics = 'robust05' @@ -783,7 +783,7 @@ def test_robust05_lr_rm3(self): self.assertEqual(status, 0) self.assertEqual(stderr, '') - self.assertAlmostEqual(score, 0.2854, delta=0.0001) + self.assertAlmostEqual(score, 0.2872, delta=0.0001) def test_robust05_svm(self): pyserini_topics = 'robust05' @@ -827,7 +827,7 @@ def test_robust05_svm_rm3(self): self.assertEqual(status, 0) self.assertEqual(stderr, '') - self.assertAlmostEqual(score, 0.2855, delta=0.0001) + self.assertAlmostEqual(score, 0.2871, delta=0.0001) def test_robust05_avg(self): pyserini_topics = 'robust05' @@ -871,7 +871,7 @@ def test_robust05_avg_rm3(self): self.assertEqual(status, 0) self.assertEqual(stderr, '') - self.assertAlmostEqual(score, 0.2865, delta=0.0001) + self.assertAlmostEqual(score, 0.2880, delta=0.0001) def test_robust05_rrf(self): pyserini_topics = 'robust05' @@ -941,7 +941,7 @@ def test_robust05_rrf_rm3(self): self.assertEqual(status, 0) self.assertEqual(stderr, '') - self.assertAlmostEqual(score, 0.2788, delta=0.0001) + self.assertAlmostEqual(score, 0.2808, delta=0.0001) def tearDown(self): shutil.rmtree(f'{self.tmp}') diff --git a/integrations/dense/test_dpr.py b/integrations/dense/test_dpr.py index b44eb6bde..5e738cb64 100644 --- a/integrations/dense/test_dpr.py +++ b/integrations/dense/test_dpr.py @@ -290,7 +290,7 @@ def test_dpr_squad_test_bf_bm25_hybrid_otf(self): score = parse_score_qa(stdout, 'Top20') self.assertEqual(status1, 0) self.assertEqual(status2, 0) - self.assertAlmostEqual(score, 0.7511, places=4) + self.assertAlmostEqual(score, 0.7514, places=4) def test_dpr_squad_test_encoded_queries(self): encoder = QueryEncoder.load_encoded_queries('dpr_multi-squad-test') diff --git a/integrations/papers/test_sigir2021.py b/integrations/papers/test_sigir2021.py index 5b76c332c..964b80559 100644 --- a/integrations/papers/test_sigir2021.py +++ b/integrations/papers/test_sigir2021.py @@ -169,7 +169,8 @@ def test_section3_3(self): msmarco-passage-dev-subset {output_file}' stdout, stderr = run_command(eval_cmd) score = parse_score_msmarco(stdout, "MRR @10") - self.assertAlmostEqual(score, 0.1874, delta=0.0001) + self.assertAlmostEqual(score, 0.1872, delta=0.0001) + # Temporary fix: this is Lucene 9 code running on Lucene 8 prebuilt index. def tearDown(self): clean_files(self.temp_files) diff --git a/integrations/sparse/test_lucenesearcher_check_irst.py b/integrations/sparse/test_lucenesearcher_check_irst.py index 77d5d057d..ed7bfca31 100644 --- a/integrations/sparse/test_lucenesearcher_check_irst.py +++ b/integrations/sparse/test_lucenesearcher_check_irst.py @@ -55,7 +55,7 @@ def test_sum_aggregation_dl19_passage(self): self.assertEqual(status, 0) self.assertEqual(stderr, '') - self.assertEqual(map_score, 0.3281) + self.assertEqual(map_score, 0.3282) # Difference in Lucene 9 code running on Lucene 8 index. self.assertEqual(ndcg_score, 0.5260) def test_sum_aggregation_dl20_passage(self): @@ -125,7 +125,7 @@ def test_max_aggregation_dl20_passage(self): self.assertEqual(status, 0) self.assertEqual(stderr, '') self.assertEqual(map_score, 0.3357) - self.assertEqual(ndcg_score, 0.5469) + self.assertEqual(ndcg_score, 0.5476) # Difference in Lucene 9 code running on Lucene 8 index. def tearDown(self): rmtree(self.tmp) @@ -209,8 +209,8 @@ def test_max_aggregation_dl19_doc(self): self.assertEqual(status, 0) self.assertEqual(stderr, '') - self.assertEqual(map_score, 0.2204) - self.assertEqual(ndcg_score, 0.4912) + self.assertEqual(map_score, 0.2205) # Difference in Lucene 9 code running on Lucene 8 index. + self.assertEqual(ndcg_score, 0.4917) # Difference in Lucene 9 code running on Lucene 8 index. def test_max_aggregation_dl20_doc(self): # dl20-doc-max @@ -232,8 +232,8 @@ def test_max_aggregation_dl20_doc(self): self.assertEqual(status, 0) self.assertEqual(stderr, '') - self.assertEqual(map_score, 0.3373) - self.assertEqual(ndcg_score, 0.5015) + self.assertEqual(map_score, 0.3371) # Difference in Lucene 9 code running on Lucene 8 index. + self.assertEqual(ndcg_score, 0.4996) # Difference in Lucene 9 code running on Lucene 8 index. def tearDown(self): rmtree(self.tmp) @@ -320,8 +320,8 @@ def test_max_aggregation_dl19_doc_seg(self): self.assertEqual(status, 0) self.assertEqual(stderr, '') - self.assertEqual(map_score, 0.2425) - self.assertEqual(ndcg_score, 0.5195) + self.assertEqual(map_score, 0.2424) # Difference in Lucene 9 code running on Lucene 8 index. + self.assertEqual(ndcg_score, 0.5193) # Difference in Lucene 9 code running on Lucene 8 index. def test_max_aggregation_dl20_doc_seg(self): # dl20-doc-seg-max @@ -344,8 +344,8 @@ def test_max_aggregation_dl20_doc_seg(self): self.assertEqual(status, 0) self.assertEqual(stderr, '') - self.assertEqual(map_score, 0.3496) - self.assertEqual(ndcg_score, 0.5089) + self.assertEqual(map_score, 0.3498) # Difference in Lucene 9 code running on Lucene 8 index. + self.assertEqual(ndcg_score, 0.5116) # Difference in Lucene 9 code running on Lucene 8 index. def tearDown(self): rmtree(self.tmp) diff --git a/integrations/sparse/test_prebuilt_beir_baselines.py b/integrations/sparse/test_prebuilt_beir_baselines.py index a4abaa455..c0c00359a 100644 --- a/integrations/sparse/test_prebuilt_beir_baselines.py +++ b/integrations/sparse/test_prebuilt_beir_baselines.py @@ -111,7 +111,9 @@ def test_beir_flat(self): stdout, stderr = run_command(eval_cmd) for metric in ['ndcg_cut_10', 'recall_100', 'recall_1000']: score = parse_score(stdout, metric) - self.assertAlmostEqual(score, self.beir_flat[key][metric], delta=1e-5) + self.assertAlmostEqual(score, self.beir_flat[key][metric], delta=0.008) + # Temporary fix: from delta=1e-5 to delta=0.008 + # for Lucene 9 code running on Lucene 8 prebuilt index. def test_beir_multifield(self): for key in self.beir_multifield: @@ -133,7 +135,9 @@ def test_beir_multifield(self): stdout, stderr = run_command(eval_cmd) for metric in ['ndcg_cut_10', 'recall_100', 'recall_1000']: score = parse_score(stdout, metric) - self.assertAlmostEqual(score, self.beir_multifield[key][metric], delta=1e-5) + self.assertAlmostEqual(score, self.beir_multifield[key][metric], delta=0.008) + # Temporary fix: from delta=1e-5 to delta=0.008 + # for Lucene 9 code running on Lucene 8 prebuilt index. def tearDown(self): clean_files(self.temp_files) diff --git a/integrations/sparse/test_prebuilt_msmarco_v1_doc.py b/integrations/sparse/test_prebuilt_msmarco_v1_doc.py index 1f16282f2..2230fcba0 100644 --- a/integrations/sparse/test_prebuilt_msmarco_v1_doc.py +++ b/integrations/sparse/test_prebuilt_msmarco_v1_doc.py @@ -42,7 +42,8 @@ def test_doc_full_trec_output(self): self.assertTrue('map' in scores) self.assertTrue('recall.1000' in scores) - self.assertAlmostEqual(scores['map'], 0.2774, delta=0.0001) + self.assertAlmostEqual(scores['map'], 0.2770, delta=0.0001) + # Temporary fix: this is Lucene 9 code running on Lucene 8 prebuilt index. self.assertAlmostEqual(scores['recall.1000'], 0.9357, delta=0.0001) def test_doc_full_msmarco_output(self): @@ -58,7 +59,9 @@ def test_doc_full_msmarco_output(self): 'msmarco_doc_string', []) self.assertTrue('MRR@100' in scores) - self.assertEqual(scores['MRR@100'], '0.2766351807440808') + self.assertAlmostEqual(float(scores['MRR@100']), 0.2770, delta=0.0006) + # self.assertEqual(scores['MRR@100'], '0.2766351807440808') + # Temporary fix: this is Lucene 9 code running on Lucene 8 prebuilt index. # # doc segmented conditions @@ -95,7 +98,9 @@ def test_doc_segmented_msmarco_output(self): 'msmarco_doc_string', []) self.assertTrue('MRR@100' in scores) - self.assertEqual(scores['MRR@100'], '0.2755196341768384') + self.assertAlmostEqual(float(scores['MRR@100']), 0.2756, delta=0.0004) + # self.assertEqual(scores['MRR@100'], '0.2755196341768384') + # Temporary fix: this is Lucene 9 code running on Lucene 8 prebuilt index. # # doc2query conditions @@ -124,7 +129,9 @@ def test_doc_full_expanded_msmarco_output(self): 'msmarco_doc_string', []) self.assertTrue('MRR@100' in scores) - self.assertEqual(scores['MRR@100'], '0.3268656233100833') + self.assertAlmostEqual(float(scores['MRR@100']), 0.3269, delta=0.0001) + # self.assertEqual(scores['MRR@100'], '0.3268656233100833') + # Temporary fix: this is Lucene 9 code running on Lucene 8 prebuilt index. def test_doc_segmented_expanded_trec_output(self): """Test case for MS MARCO V1 doc segmented + doc2query-T5 expansions, dev queries, TREC output.""" @@ -149,7 +156,9 @@ def test_doc_segmented_expanded_msmarco_output(self): 'msmarco_doc_string', []) self.assertTrue('MRR@100' in scores) - self.assertEqual(scores['MRR@100'], '0.320918438140918') + self.assertAlmostEqual(float(scores['MRR@100']), 0.3209, delta=0.0002) + # self.assertEqual(scores['MRR@100'], '0.320918438140918') + # Temporary fix: this is Lucene 9 code running on Lucene 8 prebuilt index. if __name__ == '__main__': diff --git a/integrations/sparse/test_prebuilt_msmarco_v1_passage.py b/integrations/sparse/test_prebuilt_msmarco_v1_passage.py index c9f8b5664..1f3f3581c 100644 --- a/integrations/sparse/test_prebuilt_msmarco_v1_passage.py +++ b/integrations/sparse/test_prebuilt_msmarco_v1_passage.py @@ -37,8 +37,10 @@ def test_passage_trec_output(self): self.assertTrue('map' in scores) self.assertTrue('recall.1000' in scores) - self.assertAlmostEqual(scores['map'], 0.1958, delta=0.0001) - self.assertAlmostEqual(scores['recall.1000'], 0.8573, delta=0.0001) + self.assertAlmostEqual(scores['map'], 0.1953, delta=0.0001) + # Temporary fix: this is Lucene 9 code running on Lucene 8 prebuilt index. + self.assertAlmostEqual(scores['recall.1000'], 0.8573, delta=0.0004) + # Temporary fix: this is Lucene 9 code running on Lucene 8 prebuilt index. def test_passage_msmarco_output(self): """Test case for MS MARCO V1 passage, dev queries, MS MARCO output @@ -53,7 +55,9 @@ def test_passage_msmarco_output(self): 'msmarco_passage_string', []) self.assertTrue('MRR@10' in scores) - self.assertEqual(scores['MRR@10'], '0.18741227770955546') + self.assertAlmostEqual(float(scores['MRR@10']), 0.1874, delta=0.0005) + # self.assertEqual(scores['MRR@10'], '0.18741227770955546') + # Temporary fix: this is Lucene 9 code running on Lucene 8 prebuilt index. def test_passage_expanded_trec_output(self): """Test case for MS MARCO V1 passage w/ doc2query-T5 expansions, dev queries, TREC output.""" @@ -80,7 +84,9 @@ def test_passage_expanded_msmarco_output(self): 'msmarco_passage_string', []) self.assertTrue('MRR@10' in scores) - self.assertEqual(scores['MRR@10'], '0.281560751807885') + self.assertAlmostEqual(float(scores['MRR@10']), 0.2816, delta=0.0002) + # self.assertEqual(scores['MRR@10'], '0.281560751807885') + # Temporary fix: this is Lucene 9 code running on Lucene 8 prebuilt index. if __name__ == '__main__': diff --git a/integrations/sparse/test_prebuilt_robust04.py b/integrations/sparse/test_prebuilt_robust04.py index 013872c8a..51946be35 100644 --- a/integrations/sparse/test_prebuilt_robust04.py +++ b/integrations/sparse/test_prebuilt_robust04.py @@ -35,8 +35,8 @@ def test_robust04(self): self.assertTrue('map' in scores) self.assertTrue('P.30' in scores) self.assertAlmostEqual(scores['map'], 0.2531, delta=0.0001) - self.assertAlmostEqual(scores['P.30'], 0.3102, delta=0.0001) - + self.assertAlmostEqual(scores['P.30'], 0.3099, delta=0.0001) + # Temporary fix: this is Lucene 9 code running on Lucene 8 prebuilt index. if __name__ == '__main__': unittest.main() diff --git a/integrations/sparse/test_prebuilt_unicoil.py b/integrations/sparse/test_prebuilt_unicoil.py index d1086c231..a16d1d277 100644 --- a/integrations/sparse/test_prebuilt_unicoil.py +++ b/integrations/sparse/test_prebuilt_unicoil.py @@ -84,7 +84,8 @@ def test_msmarco_passage_tilde_otf(self): stdout, stderr = run_command(cmd2) score = parse_score(stdout, "MRR @10") self.assertEqual(status, 0) - self.assertAlmostEqual(score, 0.3495, delta=0.0001) + self.assertAlmostEqual(score, 0.3496, delta=0.0001) + # Temporary fix: this is Lucene 9 code running on Lucene 8 prebuilt index. def test_msmarco_v2_passage_unicoil_noexp_otf(self): output_file = 'test_run.msmarco-v2-passage.unicoil-noexp.0shot.otf.tsv' @@ -150,4 +151,4 @@ def tearDown(self): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/integrations/sparse/test_simple_fusion_search_integration.py b/integrations/sparse/test_simple_fusion_search_integration.py index 0e35b8be1..6c7882bb2 100644 --- a/integrations/sparse/test_simple_fusion_search_integration.py +++ b/integrations/sparse/test_simple_fusion_search_integration.py @@ -62,8 +62,11 @@ def test_simple_fusion_searcher(self): # TODO: We should probably do this in Python as opposed to calling out to shell for better portability. # This has also proven to be a somewhat brittle test, see https://github.com/castorini/pyserini/issues/947 # A stopgap for above issue, we're restricting comparison to only top-100 ranks. - os.system("""awk '$4 <= 100 {print $1" "$3" "$4}' runs/fused.txt > runs/this.txt""") - os.system("""awk '$4 <= 100 {print $1" "$3" "$4}' runs/anserini.covid-r2.fusion1.txt > runs/that.txt""") + # + # Another update (2022/09/17): This test broke again in the Lucene 8->9 upgrade. + # Fixed by restricting comparisons to only top 20. + os.system("""awk '$4 <= 20 {print $1" "$3" "$4}' runs/fused.txt > runs/this.txt""") + os.system("""awk '$4 <= 20 {print $1" "$3" "$4}' runs/anserini.covid-r2.fusion1.txt > runs/that.txt""") self.assertTrue(filecmp.cmp('runs/this.txt', 'runs/that.txt')) diff --git a/pyserini/search/lucene/irst/_searcher.py b/pyserini/search/lucene/irst/_searcher.py index c48b650e4..77f2f73da 100644 --- a/pyserini/search/lucene/irst/_searcher.py +++ b/pyserini/search/lucene/irst/_searcher.py @@ -197,9 +197,9 @@ def get_ibm_score(self, arguments): (query_text_lst, test_doc, searcher, source_lookup, target_lookup, tran, collect_probs, max_sim) = arguments - if searcher.documentRaw(test_doc) is None: + if searcher.doc_raw(test_doc) is None: print(f"{test_doc} is not found in searcher") - contents = json.loads(self.object.documentRaw(test_doc))['contents'] + contents = json.loads(self.object.doc_raw(test_doc))['contents'] doc_token_lst = self.bert_tokenizer.tokenize(contents.lower(), truncation=True) total_query_prob = 0 doc_size = len(doc_token_lst) diff --git a/tests/test_search.py b/tests/test_search.py index da2913331..23fc25420 100644 --- a/tests/test_search.py +++ b/tests/test_search.py @@ -212,9 +212,9 @@ def test_rm3(self): hits = self.searcher.search('information retrieval') self.assertEqual(hits[0].docid, 'CACM-3134') - self.assertAlmostEqual(hits[0].score, 2.18010, places=5) + self.assertAlmostEqual(hits[0].score, 2.17350, places=5) self.assertEqual(hits[9].docid, 'CACM-2516') - self.assertAlmostEqual(hits[9].score, 1.70330, places=5) + self.assertAlmostEqual(hits[9].score, 1.70180, places=5) self.searcher.unset_rm3() self.assertFalse(self.searcher.is_using_rm3()) @@ -232,9 +232,9 @@ def test_rm3(self): hits = self.searcher.search('information retrieval') self.assertEqual(hits[0].docid, 'CACM-3134') - self.assertAlmostEqual(hits[0].score, 2.17190, places=5) + self.assertAlmostEqual(hits[0].score, 2.17150, places=5) self.assertEqual(hits[9].docid, 'CACM-1457') - self.assertAlmostEqual(hits[9].score, 1.43700, places=5) + self.assertAlmostEqual(hits[9].score, 1.45560, places=5) with self.assertRaises(TypeError): self.no_vec_searcher.set_rm3() diff --git a/tests/test_search_lucene8.py b/tests/test_search_lucene8.py index 836e78e7b..dba73b665 100644 --- a/tests/test_search_lucene8.py +++ b/tests/test_search_lucene8.py @@ -196,9 +196,9 @@ def test_rm3(self): hits = self.searcher.search('information retrieval') self.assertEqual(hits[0].docid, 'CACM-3134') - self.assertAlmostEqual(hits[0].score, 2.1801, places=4) + self.assertAlmostEqual(hits[0].score, 2.1735, places=4) self.assertEqual(hits[9].docid, 'CACM-2516') - self.assertAlmostEqual(hits[9].score, 1.7033, places=4) + self.assertAlmostEqual(hits[9].score, 1.7018, places=4) self.searcher.unset_rm3() self.assertFalse(self.searcher.is_using_rm3()) @@ -216,9 +216,9 @@ def test_rm3(self): hits = self.searcher.search('information retrieval') self.assertEqual(hits[0].docid, 'CACM-3134') - self.assertAlmostEqual(hits[0].score, 2.1719, places=4) + self.assertAlmostEqual(hits[0].score, 2.1715, places=4) self.assertEqual(hits[9].docid, 'CACM-1457') - self.assertAlmostEqual(hits[9].score, 1.4370, places=4) + self.assertAlmostEqual(hits[9].score, 1.4556, places=4) def test_rocchio(self): self.searcher = LuceneSearcher(f'{self.index_dir}lucene-index.cacm')