clear memory after parsing a doc, and not on parsing of a new doc

This commit is contained in:
kimchy 2010-11-12 15:36:23 +02:00
parent d994a862dd
commit 6839cc6965
2 changed files with 6 additions and 1 deletions

View File

@ -28,6 +28,8 @@ import org.apache.lucene.document.Fieldable;
*/
public class DocumentBuilder {
public static final Document EMPTY = new Document();
public static DocumentBuilder doc() {
return new DocumentBuilder();
}

View File

@ -391,7 +391,10 @@ public class XContentDocumentMapper implements DocumentMapper, ToXContent {
parser.close();
}
}
return new ParsedDocument(context.uid(), context.id(), context.type(), context.doc(), context.analyzer(), source, context.mappersAdded());
ParsedDocument doc = new ParsedDocument(context.uid(), context.id(), context.type(), context.doc(), context.analyzer(), source, context.mappersAdded());
// reset the context to free up memory
context.reset(null, null, null, null, null);
return doc;
}
void addFieldMapper(FieldMapper fieldMapper) {