annoy-java icon indicating copy to clipboard operation
annoy-java copied to clipboard

No check for metric value

Open sstolpovskiy opened this issue 7 years ago • 0 comments

Hello,

I have faced the issue:

  1. index is created using default metric in python.
  2. index is read in java with Euclidean metric without error.

On search raised following error: java.lang.ArrayIndexOutOfBoundsException: 2820 at com.spotify.annoy.ANNIndex.getIntInAnnBuf(ANNIndex.java:133) ~[annoy-0.2.6-SNAPSHOT.jar:na] at com.spotify.annoy.ANNIndex.getNearest(ANNIndex.java:257) ~[annoy-0.2.6-SNAPSHOT.jar:na]

Where 2820 number depend so how on index size.

I think it should be some check for valid metric.

sstolpovskiy avatar Feb 26 '18 13:02 sstolpovskiy