You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2019/06/10 19:42:29 UTC
[lucene-solr] 02/02: SOLR-13512: Fix a bug due to a different
StoredFieldVisitor API in 8x.
This is an automated email from the ASF dual-hosted git repository.
ab pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
commit 58d3761bf5365c1dcdb0022c3f2e1ace38f950a4
Author: Andrzej Bialecki <ab...@apache.org>
AuthorDate: Mon Jun 10 21:40:40 2019 +0200
SOLR-13512: Fix a bug due to a different StoredFieldVisitor API in 8x.
---
.../org/apache/solr/handler/admin/IndexSizeEstimator.java | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/IndexSizeEstimator.java b/solr/core/src/java/org/apache/solr/handler/admin/IndexSizeEstimator.java
index 5ef02ff..35b8de0 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/IndexSizeEstimator.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/IndexSizeEstimator.java
@@ -56,7 +56,6 @@ import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.PriorityQueue;
import org.apache.lucene.util.RamUsageEstimator;
import org.apache.lucene.util.SuppressForbidden;
-import org.apache.lucene.util.UnicodeUtil;
import org.apache.solr.common.MapWriter;
import org.apache.solr.common.util.Utils;
import org.slf4j.Logger;
@@ -625,13 +624,16 @@ public class IndexSizeEstimator {
}
/** Process a string field. */
- public void stringField(FieldInfo fieldInfo, String value) throws IOException {
+ public void stringField(FieldInfo fieldInfo, byte[] value) throws IOException {
// trim the value if needed
- int len = value != null ? UnicodeUtil.calcUTF16toUTF8Length(value, 0, value.length()) : 0;
- if (value.length() > maxLength) {
- value = value.substring(0, maxLength);
+ int len = value != null ? value.length : 0;
+ if (len > maxLength) {
+ byte[] newValue = new byte[maxLength];
+ System.arraycopy(value, 0, newValue, 0, maxLength);
+ value = newValue;
}
- countItem(fieldInfo.name, value, len);
+ String strValue = new String(value, "UTF-8");
+ countItem(fieldInfo.name, strValue, len);
}
/** Process a int numeric field. */