jpountz commented on code in PR #14364:
URL: https://github.com/apache/lucene/pull/14364#discussion_r1999714466


##########
lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestSuggestField.java:
##########
@@ -951,7 +951,16 @@ static IndexWriterConfig iwcWithSuggestField(Analyzer 
analyzer, final Set<String
         new FilterCodec(TestUtil.getDefaultCodec().getName(), 
TestUtil.getDefaultCodec()) {
           final CompletionPostingsFormat.FSTLoadMode fstLoadMode =
               RandomPicks.randomFrom(random(), 
CompletionPostingsFormat.FSTLoadMode.values());
-          final PostingsFormat postingsFormat = new 
Completion101PostingsFormat(fstLoadMode);
+          // FST load mode can only be overridden via a custom completion 
postings format
+          final PostingsFormat postingsFormat =
+              new CompletionPostingsFormat("Completion101", fstLoadMode) {
+                final CompletionPostingsFormat delegate = new 
Completion101PostingsFormat();
+
+                @Override
+                protected PostingsFormat delegatePostingsFormat() {
+                  return delegate.delegatePostingsFormat();
+                }
+              };

Review Comment:
   FWIW this may work accidentally on NRT segments if IndexWriter opens them 
with the codec configured on the IndexWriterConfig, but it you were to open an 
index from a Directory using this postings format, it would open it using the 
default FST load mode and ignore the one passed to the constructor here. This 
is because, Lucene would read "Completion101" from the segment infos and look 
it up through SPI, which would return the default format that is registered 
under this name rather than this instance that you are creating here.
   
   I wonder if we should remove FSTLoadMode completely. To your point, it's 
trappy to think that this thing is actually configurable?



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