mirror of https://github.com/apache/lucene.git
fix TestKnnGraph test failure if it gets SimpleText
This test reaches into lucene90 internals, fails with classcastexception if it happens to get simpletext.
This commit is contained in:
parent
1fff174690
commit
96eb043131
|
@ -213,8 +213,10 @@ public class TestKnnGraph extends LuceneTestCase {
|
||||||
public void testSearch() throws Exception {
|
public void testSearch() throws Exception {
|
||||||
// We can't use dot product here since the vectors are laid out on a grid, not a sphere.
|
// We can't use dot product here since the vectors are laid out on a grid, not a sphere.
|
||||||
searchStrategy = SearchStrategy.EUCLIDEAN_HNSW;
|
searchStrategy = SearchStrategy.EUCLIDEAN_HNSW;
|
||||||
|
IndexWriterConfig config = newIndexWriterConfig();
|
||||||
|
config.setCodec(Codec.forName("Lucene90")); // test is not compatible with simpletext
|
||||||
try (Directory dir = newDirectory();
|
try (Directory dir = newDirectory();
|
||||||
IndexWriter iw = new IndexWriter(dir, newIndexWriterConfig())) {
|
IndexWriter iw = new IndexWriter(dir, config)) {
|
||||||
// Add a document for every cartesian point in an NxN square so we can
|
// Add a document for every cartesian point in an NxN square so we can
|
||||||
// easily know which are the nearest neighbors to every point. Insert by iterating
|
// easily know which are the nearest neighbors to every point. Insert by iterating
|
||||||
// using a prime number that is not a divisor of N*N so that we will hit each point once,
|
// using a prime number that is not a divisor of N*N so that we will hit each point once,
|
||||||
|
|
Loading…
Reference in New Issue