microsoft / DiskANN

Graph-structured Indices for Scalable, Fast, Fresh and Filtered Approximate Nearest Neighbor Search
Other
1.06k stars 215 forks source link

correct index_path_prefix in __init__ function of static disk index #483

Closed wxyucs closed 10 months ago

wxyucs commented 10 months ago

Reference Issues/PRs

What does this implement/fix? Briefly explain your changes.

correct the index_path_prefix which added index_directory to the front twice. The first time is in the function _valid_index_prefix:

def _valid_index_prefix(index_directory: str, index_prefix: str) -> str:
    ...
    return os.path.join(index_directory, index_prefix)

class StaticDiskIndex:
     ...
     def __init__(
        ...
        index_prefix = _valid_index_prefix(index_directory, index_prefix) # first time
        ...
        self._index = _index(                                                                                                          
            distance_metric=dap_metric,                                                                                                
            index_path_prefix=os.path.join(index_directory, index_prefix), # second time
            num_threads=num_threads,                                                                                                   
            num_nodes_to_cache=num_nodes_to_cache,                                                                                     
            cache_mechanism=cache_mechanism,                                                                                           
        ) 

Any other comments?