Apache Lucene open-source search software
LUCENE-7087: Let MemoryIndex#fromDocument(...) accept 'Iterable<? extends IndexableField>' as document instead of 'Document'
Martijn van Groningen0b8b16f9f281
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex 7e803cf0a3a..a07e69d1696 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -14,6 +14,11 @@ Optimizations* LUCENE-7071: Reduce bytes copying in OfflineSorter, giving ~10%speedup on merging 2D LatLonPoint values (Mike McCandless)+Other++* LUCENE-7087: Let MemoryIndex#fromDocument(...) accept 'Iterable<? extends IndexableField>'+ as document instead of 'Document'. (Martijn van Groningen)+======================= Lucene 6.0.0 =======================System Requirementsdiff --git a/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java b/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.javaindex 849cd633868..9e01182ec90 100644--- a/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java+++ b/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java@@ -265,7 +265,7 @@ public class MemoryIndex {* @param analyzer the analyzer to use* @return a MemoryIndex*/- public static MemoryIndex fromDocument(Document document, Analyzer analyzer) {+ public static MemoryIndex fromDocument(Iterable<? extends IndexableField> document, Analyzer analyzer) {return fromDocument(document, analyzer, false, false, 0);}@@ -277,7 +277,7 @@ public class MemoryIndex {* @param storePayloads <code>true</code> if payloads should be stored* @return a MemoryIndex*/- public static MemoryIndex fromDocument(Document document, Analyzer analyzer, boolean storeOffsets, boolean storePayloads) {+ public static MemoryIndex fromDocument(Iterable<? extends IndexableField> document, Analyzer analyzer, boolean storeOffsets, boolean storePayloads) {return fromDocument(document, analyzer, storeOffsets, storePayloads, 0);}@@ -290,7 +290,7 @@ public class MemoryIndex {* @param maxReusedBytes the number of bytes that should remain in the internal memory pools after {@link #reset()} is called* @return a MemoryIndex*/- public static MemoryIndex fromDocument(Document document, Analyzer analyzer, boolean storeOffsets, boolean storePayloads, long maxReusedBytes) {+ public static MemoryIndex fromDocument(Iterable<? extends IndexableField> document, Analyzer analyzer, boolean storeOffsets, boolean storePayloads, long maxReusedBytes) {MemoryIndex mi = new MemoryIndex(storeOffsets, storePayloads, maxReusedBytes);for (IndexableField field : document) {mi.addField(field, analyzer);