| @@ 786-799 (lines=14) @@ | ||
| 783 | return index_params |
|
| 784 | ||
| 785 | ||
| 786 | def get_search_param(index_type, metric_type="L2"): |
|
| 787 | search_params = {"metric_type": metric_type} |
|
| 788 | if index_type in ivf() or index_type in binary_support(): |
|
| 789 | search_params.update({"nprobe": 64}) |
|
| 790 | elif index_type in ["HNSW", "RHNSW_SQ", "RHNSW_PQ"]: |
|
| 791 | search_params.update({"ef": 64}) |
|
| 792 | elif index_type == "NSG": |
|
| 793 | search_params.update({"search_length": 100}) |
|
| 794 | elif index_type == "ANNOY": |
|
| 795 | search_params.update({"search_k": 1000}) |
|
| 796 | else: |
|
| 797 | logging.getLogger().error("Invalid index_type.") |
|
| 798 | raise Exception("Invalid index_type.") |
|
| 799 | return search_params |
|
| 800 | ||
| 801 | ||
| 802 | def assert_equal_vector(v1, v2): |
|
| @@ 864-877 (lines=14) @@ | ||
| 861 | return index_params |
|
| 862 | ||
| 863 | ||
| 864 | def get_search_param(index_type, metric_type="L2"): |
|
| 865 | search_params = {"metric_type": metric_type} |
|
| 866 | if index_type in ivf() or index_type in binary_support(): |
|
| 867 | search_params.update({"nprobe": 64}) |
|
| 868 | elif index_type in ["HNSW", "RHNSW_SQ", "RHNSW_PQ"]: |
|
| 869 | search_params.update({"ef": 64}) |
|
| 870 | elif index_type == "NSG": |
|
| 871 | search_params.update({"search_length": 100}) |
|
| 872 | elif index_type == "ANNOY": |
|
| 873 | search_params.update({"search_k": 1000}) |
|
| 874 | else: |
|
| 875 | logging.getLogger().error("Invalid index_type.") |
|
| 876 | raise Exception("Invalid index_type.") |
|
| 877 | return search_params |
|
| 878 | ||
| 879 | ||
| 880 | def assert_equal_vector(v1, v2): |
|