mirror of https://github.com/apache/lucene.git
LUCENE-6681: SortingMergePolicy must override MergePolicy.size(...).
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1691421 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9342ddc392
commit
e8a5ffbea3
|
@ -259,6 +259,9 @@ Bug fixes
|
|||
* LUCENE-6680: Preserve two suggestions that have same key and weight but
|
||||
different payloads (Arcadius Ahouansou via Mike McCandless)
|
||||
|
||||
* LUCENE-6681: SortingMergePolicy must override MergePolicy.size(...).
|
||||
(Christine Poerschke via Adrien Grand)
|
||||
|
||||
Changes in Runtime Behavior
|
||||
|
||||
* LUCENE-6501: The subreader structure in ParallelCompositeReader
|
||||
|
|
|
@ -260,6 +260,11 @@ public final class SortingMergePolicy extends MergePolicy {
|
|||
return in.useCompoundFile(segments, newSegment, writer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected long size(SegmentCommitInfo info, IndexWriter writer) throws IOException {
|
||||
return in.size(info, writer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SortingMergePolicy(" + in + ", sorter=" + sorter + ")";
|
||||
|
|
|
@ -18,6 +18,8 @@ package org.apache.lucene.index;
|
|||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
@ -192,4 +194,15 @@ public class TestSortingMergePolicy extends LuceneTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public void testMethodsOverridden() throws Exception {
|
||||
for (Method m : MergePolicy.class.getDeclaredMethods()) {
|
||||
if (Modifier.isFinal(m.getModifiers())) continue;
|
||||
try {
|
||||
SortingMergePolicy.class.getDeclaredMethod(m.getName(), m.getParameterTypes());
|
||||
} catch (NoSuchMethodException e) {
|
||||
fail("SortingMergePolicy needs to override '"+m+"'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue