Code Duplication    Length = 29-29 lines in 2 locations

tests/milvus_python_test/entity/test_search.py 2 locations

@@ 697-725 (lines=29) @@
694
        logging.getLogger().info(result)
695
        assert len(result[0]) == 0
696
697
    def _test_search_distance_superstructure_flat_index_B(self, connect, binary_collection):
698
        '''
699
        target: search binary_collection, and check the result: distance
700
        method: compare the return distance value with value computed with SUPER
701
        expected: the return distance equals to the computed value
702
        '''
703
        # from scipy.spatial import distance
704
        top_k = 3
705
        nprobe = 512
706
        int_vectors, vectors, ids = self.init_binary_data(connect, binary_collection, nb=2)
707
        index_type = "FLAT"
708
        index_param = {
709
            "nlist": 16384,
710
            "metric_type": "SUBSTRUCTURE"
711
        }
712
        connect.create_index(binary_collection, binary_field_name, index_param)
713
        logging.getLogger().info(connect.get_collection_info(binary_collection))
714
        logging.getLogger().info(connect.get_index_info(binary_collection))
715
        query_int_vectors, query_vecs = gen_binary_super_vectors(int_vectors, 2)
716
        search_param = get_search_param(index_type)
717
        status, result = connect.search(binary_collection, top_k, query_vecs, params=search_param)
718
        logging.getLogger().info(status)
719
        logging.getLogger().info(result)
720
        assert len(result[0]) == 2
721
        assert len(result[1]) == 2
722
        assert result[0][0].id in ids
723
        assert result[0][0].distance <= epsilon
724
        assert result[1][0].id in ids
725
        assert result[1][0].distance <= epsilon
726
727
    def _test_search_distance_tanimoto_flat_index(self, connect, binary_collection):
728
        '''
@@ 641-669 (lines=29) @@
638
        logging.getLogger().info(result)
639
        assert len(result[0]) == 0
640
641
    def _test_search_distance_substructure_flat_index_B(self, connect, binary_collection):
642
        '''
643
        target: search binary_collection, and check the result: distance
644
        method: compare the return distance value with value computed with SUB 
645
        expected: the return distance equals to the computed value
646
        '''
647
        # from scipy.spatial import distance
648
        top_k = 3
649
        nprobe = 512
650
        int_vectors, vectors, ids = self.init_binary_data(connect, binary_collection, nb=2)
651
        index_type = "FLAT"
652
        index_param = {
653
            "nlist": 16384,
654
            "metric_type": "SUBSTRUCTURE"
655
        }
656
        connect.create_index(binary_collection, binary_field_name, index_param)
657
        logging.getLogger().info(connect.get_collection_info(binary_collection))
658
        logging.getLogger().info(connect.get_index_info(binary_collection))
659
        query_int_vectors, query_vecs = gen_binary_sub_vectors(int_vectors, 2)
660
        search_param = get_search_param(index_type)
661
        status, result = connect.search(binary_collection, top_k, query_vecs, params=search_param)
662
        logging.getLogger().info(status)
663
        logging.getLogger().info(result)
664
        assert len(result[0]) == 1
665
        assert len(result[1]) == 1
666
        assert result[0][0].distance <= epsilon
667
        assert result[0][0].id == ids[0]
668
        assert result[1][0].distance <= epsilon
669
        assert result[1][0].id == ids[1]
670
671
    def _test_search_distance_superstructure_flat_index(self, connect, binary_collection):
672
        '''