juanka588 commented on a change in pull request #1473:
URL: https://github.com/apache/lucene-solr/pull/1473#discussion_r419337819



##########
File path: 
lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsWriter.java
##########
@@ -1060,36 +1052,35 @@ public void close() throws IOException {
       return;
     }
     closed = true;
-    
+
+    final String metaName = 
IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, 
BlockTreeTermsReader.TERMS_META_EXTENSION);
     boolean success = false;
-    try {
-      
-      final long dirStart = termsOut.getFilePointer();
-      final long indexDirStart = indexOut.getFilePointer();
+    try (IndexOutput metaOut = state.directory.createOutput(metaName, 
state.context)) {
+      CodecUtil.writeIndexHeader(metaOut, 
BlockTreeTermsReader.TERMS_META_CODEC_NAME, 
BlockTreeTermsReader.VERSION_CURRENT,
+          state.segmentInfo.getId(), state.segmentSuffix);
 
-      termsOut.writeVInt(fields.size());
+      metaOut.writeVInt(fields.size());

Review comment:
       @jpountz here I see the same lack of serializer write/read code, could 
it be possible to have such thing, It would improve readability and unit 
testing by only mocking fieldMetadatas and check serialization is correctly 
applied.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to