Class BaseMergePolicyTestCase

    • Constructor Detail

      • BaseMergePolicyTestCase

        public BaseMergePolicyTestCase()
    • Method Detail

      • assertSegmentInfos

        protected abstract void assertSegmentInfos​(MergePolicy policy,
                                                   SegmentInfos infos)
                                            throws IOException
        Assert that the given segment infos match expectations of the merge policy, assuming segments that have only been either flushed or merged with this merge policy.
        Throws:
        IOException
      • testFindForcedDeletesMerges

        public void testFindForcedDeletesMerges()
                                         throws IOException
        Throws:
        IOException
      • makeSegmentCommitInfo

        protected static SegmentCommitInfo makeSegmentCommitInfo​(String name,
                                                                 int maxDoc,
                                                                 int numDeletedDocs,
                                                                 double sizeMB,
                                                                 String source)
        Make a new SegmentCommitInfo with the given maxDoc, numDeletedDocs and sizeInBytes, which are usually the numbers that merge policies care about.
      • applyDeletes

        protected static SegmentInfos applyDeletes​(SegmentInfos infos,
                                                   int numDeletes)
        Apply numDeletes uniformly across all segments of infos.
      • testSimulateAppendOnly

        public void testSimulateAppendOnly()
                                    throws IOException
        Simulate an append-only use-case, ie. there are no deletes.
        Throws:
        IOException
      • doTestSimulateAppendOnly

        protected void doTestSimulateAppendOnly​(MergePolicy mergePolicy,
                                                int totalDocs,
                                                int maxDocsPerFlush)
                                         throws IOException
        Simulate an append-only use-case, ie. there are no deletes. totalDocs exist in the index in the end, and flushes contribute at most maxDocsPerFlush documents.
        Throws:
        IOException
      • testSimulateUpdates

        public void testSimulateUpdates()
                                 throws IOException
        Simulate an update use-case where documents are uniformly updated across segments.
        Throws:
        IOException
      • doTestSimulateUpdates

        protected void doTestSimulateUpdates​(MergePolicy mergePolicy,
                                             int totalDocs,
                                             int maxDocsPerFlush)
                                      throws IOException
        Simulate an update use-case where documents are uniformly updated across segments. totalDocs exist in the index in the end, and flushes contribute at most maxDocsPerFlush documents.
        Throws:
        IOException