simpletext: don't make string for every p here

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1032786 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2010-11-08 23:32:43 +00:00
parent 81f8363e51
commit cc87ac007c
1 changed files with 3 additions and 1 deletions

View File

@ -386,6 +386,7 @@ class SimpleTextFieldsReader extends FieldsProducer {
private final BytesRef scratch = new BytesRef(10);
private final BytesRef scratch2 = new BytesRef(10);
private final UnicodeUtil.UTF16Result scratchUTF16 = new UnicodeUtil.UTF16Result();
private final UnicodeUtil.UTF16Result scratchUTF16_2 = new UnicodeUtil.UTF16Result();
private BytesRef payload;
private long nextDocStart;
@ -460,7 +461,8 @@ class SimpleTextFieldsReader extends FieldsProducer {
public int nextPosition() throws IOException {
readLine(in, scratch);
assert scratch.startsWith(POS): "got line=" + scratch.utf8ToString();
final int pos = Integer.parseInt(new String(scratch.bytes, scratch.offset+POS.length, scratch.length-POS.length));
UnicodeUtil.UTF8toUTF16(scratch.bytes, scratch.offset+POS.length, scratch.length-POS.length, scratchUTF16_2);
final int pos = ArrayUtil.parseInt(scratchUTF16_2.result, 0, scratchUTF16_2.length);
final long fp = in.getFilePointer();
readLine(in, scratch);
if (scratch.startsWith(PAYLOAD)) {