mirror of
https://github.com/apache/lucene.git
synced 2025-03-03 06:49:38 +00:00
check and remove leading zeros when writing IntField: SOLR-394
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@594185 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2d3ddfeadc
commit
8e339464dc
@ -47,7 +47,15 @@ public class IntField extends FieldType {
|
||||
}
|
||||
|
||||
public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException {
|
||||
writer.writeInt(name, f.stringValue());
|
||||
String s = f.stringValue();
|
||||
int len = s.length();
|
||||
if (len>=2) {
|
||||
char ch = s.charAt(0);
|
||||
if ((ch=='0') || (ch=='-' && s.charAt(1)=='0')) {
|
||||
s = Integer.toString(Integer.parseInt(s));
|
||||
}
|
||||
}
|
||||
writer.writeInt(name, s);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user