From 0b8b16f9f281f10d730019f6e291b31f42b936c7 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Thu, 10 Mar 2016 09:12:38 +0100 Subject: [PATCH] LUCENE-7087: Let MemoryIndex#fromDocument(...) accept 'Iterable' as document instead of 'Document' --- lucene/CHANGES.txt | 5 +++++ .../java/org/apache/lucene/index/memory/MemoryIndex.java | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 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' + as document instead of 'Document'. (Martijn van Groningen) + ======================= Lucene 6.0.0 ======================= System Requirements diff --git a/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java b/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java index 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 document, Analyzer analyzer) { return fromDocument(document, analyzer, false, false, 0); } @@ -277,7 +277,7 @@ public class MemoryIndex { * @param storePayloads true 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 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 document, Analyzer analyzer, boolean storeOffsets, boolean storePayloads, long maxReusedBytes) { MemoryIndex mi = new MemoryIndex(storeOffsets, storePayloads, maxReusedBytes); for (IndexableField field : document) { mi.addField(field, analyzer);