@@ -166,8 +166,7 @@ def _get_algorithm_definitions(point_type: str, distance_metric: str) -> Dict[st
166
166
metric. For example, `ann_benchmarks.algorithms.nmslib` has two definitions for euclidean float
167
167
data: specifically `SW-graph(nmslib)` and `hnsw(nmslib)`, even though the module is named nmslib.
168
168
169
- If an algorithm has an 'any' distance metric is found for the specific point type, it is used
170
- regardless (and takes precendence) over if the distance metric is present.
169
+ If an algorithm has an 'any' distance metric, it is also included.
171
170
172
171
Returns: A mapping from the algorithm name (not the algorithm class), to the algorithm definitions, i.e.:
173
172
```
@@ -195,11 +194,10 @@ def _get_algorithm_definitions(point_type: str, distance_metric: str) -> Dict[st
195
194
# param `_` is filename, not specific name
196
195
for _ , config in configs .items ():
197
196
c = []
198
- if "any" in config : # "any" branch must come first
199
- c = config ["any" ]
200
- elif distance_metric in config :
201
- c = config [distance_metric ]
202
-
197
+ if "any" in config :
198
+ c .extend (config ["any" ])
199
+ if distance_metric in config :
200
+ c .extend (config [distance_metric ])
203
201
for cc in c :
204
202
definitions [cc .pop ("name" )] = cc
205
203
@@ -359,4 +357,4 @@ def get_definitions(
359
357
)
360
358
361
359
362
- return definitions
360
+ return definitions
0 commit comments