dungba88 commented on code in PR #12758:
URL: https://github.com/apache/lucene/pull/12758#discussion_r1382359394


##########
lucene/core/src/java/org/apache/lucene/util/fst/FST.java:
##########
@@ -411,17 +401,42 @@ public FST(DataInput metaIn, DataInput in, Outputs<T> 
outputs) throws IOExceptio
     this(metaIn, in, outputs, new OnHeapFSTStore(DEFAULT_MAX_BLOCK_BITS));
   }
 
+  /** Load a previously saved FST. */
+  public FST(DataInput metaIn, DataInput in, Outputs<T> outputs, FSTStore 
fstStore)
+      throws IOException {
+    this(parseMetadata(metaIn, outputs), in, outputs, fstStore);
+  }
+
   /**
    * Load a previously saved FST; maxBlockBits allows you to control the size 
of the byte[] pages
    * used to hold the FST bytes.
    */
-  public FST(DataInput metaIn, DataInput in, Outputs<T> outputs, FSTStore 
fstStore)
+  public FST(FSTMetadata<T> metadata, DataInput in, Outputs<T> outputs, 
FSTStore fstStore)
       throws IOException {
-    this.outputs = outputs;
+    this(metadata, outputs, initStore(fstStore, metadata.numBytes, in));
+  }
+
+  private static FSTReader initStore(FSTStore fstStore, long numBytes, 
DataInput in)
+      throws IOException {
+    fstStore.init(in, numBytes);

Review Comment:
   This can also be syntactic sugar by making `init` return the `FSTReader`



-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

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