Class BaseKnnVectorsFormatTestCase


  • public abstract class BaseKnnVectorsFormatTestCase
    extends LuceneTestCase
    Base class aiming at testing vectors formats. To test a new format, all you need is to register a new Codec which uses it and extend this class and override getCodec().
    WARNING: This API is experimental and might change in incompatible ways in the next release.
    • Constructor Detail

      • BaseKnnVectorsFormatTestCase

        public BaseKnnVectorsFormatTestCase()
    • Method Detail

      • addRandomFields

        protected void addRandomFields​(Document doc)
        Add random fields to the provided document.
      • testFieldConstructor

        public void testFieldConstructor()
      • testFieldConstructorExceptions

        public void testFieldConstructorExceptions()
      • testFieldSetValue

        public void testFieldSetValue()
      • testIllegalDimChangeTwoDocs

        public void testIllegalDimChangeTwoDocs()
                                         throws Exception
        Throws:
        Exception
      • testIllegalSimilarityFunctionChange

        public void testIllegalSimilarityFunctionChange()
                                                 throws Exception
        Throws:
        Exception
      • testIllegalDimChangeTwoWriters

        public void testIllegalDimChangeTwoWriters()
                                            throws Exception
        Throws:
        Exception
      • testIllegalSimilarityFunctionChangeTwoWriters

        public void testIllegalSimilarityFunctionChangeTwoWriters()
                                                           throws Exception
        Throws:
        Exception
      • testAddIndexesDirectory0

        public void testAddIndexesDirectory0()
                                      throws Exception
        Throws:
        Exception
      • testAddIndexesDirectory1

        public void testAddIndexesDirectory1()
                                      throws Exception
        Throws:
        Exception
      • testAddIndexesDirectory01

        public void testAddIndexesDirectory01()
                                       throws Exception
        Throws:
        Exception
      • testIllegalDimChangeViaAddIndexesDirectory

        public void testIllegalDimChangeViaAddIndexesDirectory()
                                                        throws Exception
        Throws:
        Exception
      • testIllegalSimilarityFunctionChangeViaAddIndexesDirectory

        public void testIllegalSimilarityFunctionChangeViaAddIndexesDirectory()
                                                                       throws Exception
        Throws:
        Exception
      • testIllegalDimChangeViaAddIndexesCodecReader

        public void testIllegalDimChangeViaAddIndexesCodecReader()
                                                          throws Exception
        Throws:
        Exception
      • testIllegalSimilarityFunctionChangeViaAddIndexesCodecReader

        public void testIllegalSimilarityFunctionChangeViaAddIndexesCodecReader()
                                                                         throws Exception
        Throws:
        Exception
      • testIllegalDimChangeViaAddIndexesSlowCodecReader

        public void testIllegalDimChangeViaAddIndexesSlowCodecReader()
                                                              throws Exception
        Throws:
        Exception
      • testIllegalSimilarityFunctionChangeViaAddIndexesSlowCodecReader

        public void testIllegalSimilarityFunctionChangeViaAddIndexesSlowCodecReader()
                                                                             throws Exception
        Throws:
        Exception
      • testIllegalMultipleValues

        public void testIllegalMultipleValues()
                                       throws Exception
        Throws:
        Exception
      • testIllegalDimensionTooLarge

        public void testIllegalDimensionTooLarge()
                                          throws Exception
        Throws:
        Exception
      • testIllegalEmptyVector

        public void testIllegalEmptyVector()
                                    throws Exception
        Throws:
        Exception
      • testDifferentCodecs1

        public void testDifferentCodecs1()
                                  throws Exception
        Throws:
        Exception
      • testDifferentCodecs2

        public void testDifferentCodecs2()
                                  throws Exception
        Throws:
        Exception
      • testInvalidKnnVectorFieldUsage

        public void testInvalidKnnVectorFieldUsage()
      • testDeleteAllVectorDocs

        public void testDeleteAllVectorDocs()
                                     throws Exception
        Throws:
        Exception
      • testKnnVectorFieldMissingFromOneSegment

        public void testKnnVectorFieldMissingFromOneSegment()
                                                     throws Exception
        Throws:
        Exception
      • testIndexedValueNotAliased

        public void testIndexedValueNotAliased()
                                        throws Exception
        Throws:
        Exception
      • testIndexMultipleKnnVectorFields

        public void testIndexMultipleKnnVectorFields()
                                              throws Exception
        Throws:
        Exception
      • testRandom

        public void testRandom()
                        throws Exception
        Index random vectors, sometimes skipping documents, sometimes deleting a document, sometimes merging, sometimes sorting the index, and verify that the expected values can be read back consistently.
        Throws:
        Exception
      • testRandomWithUpdatesAndGraph

        public void testRandomWithUpdatesAndGraph()
                                           throws Exception
        Index random vectors, sometimes skipping documents, sometimes updating a document, sometimes merging, sometimes sorting the index, using an HNSW similarity function so as to also produce a graph, and verify that the expected values can be read back consistently.
        Throws:
        Exception
      • testCheckIndexIncludesVectors

        public void testCheckIndexIncludesVectors()
                                           throws Exception
        Throws:
        Exception
      • testSimilarityFunctionIdentifiers

        public void testSimilarityFunctionIdentifiers()
      • getCodec

        protected abstract Codec getCodec()
        Returns the codec to run tests against
      • getCreatedVersionMajor

        protected int getCreatedVersionMajor()
        Returns the major version that this codec is compatible with.
      • applyCreatedVersionMajor

        protected final <D extends Directory> D applyCreatedVersionMajor​(D d)
                                                                  throws IOException
        Set the created version of the given Directory and return it.
        Throws:
        IOException
      • excludedExtensionsFromByteCounts

        protected Collection<String> excludedExtensionsFromByteCounts()
        Return the list of extensions that should be excluded from byte counts when comparing indices that store the same content.
      • testMergeStability

        public void testMergeStability()
                                throws Exception
        The purpose of this test is to make sure that bulk merge doesn't accumulate useless data over runs.
        Throws:
        Exception
      • mergeIsStable

        protected boolean mergeIsStable()
      • testMultiClose

        public void testMultiClose()
                            throws IOException
        Calls close multiple times on closeable codec apis
        Throws:
        IOException
      • testRandomExceptions

        public void testRandomExceptions()
                                  throws Exception
        Tests exception handling on write and openInput/createOutput
        Throws:
        Exception
      • shouldTestMergeInstance

        protected boolean shouldTestMergeInstance()
        Returns false if only the regular fields reader should be tested, and true if only the merge instance should be tested.
      • testCheckIntegrityReadsAllBytes

        public void testCheckIntegrityReadsAllBytes()
                                             throws Exception
        This test is a best effort at verifying that checkIntegrity doesn't miss any files. It tests that the combination of opening a reader and calling checkIntegrity on it reads all bytes of all files.
        Throws:
        Exception