diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index e90e5671019..fb478bcddc7 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -123,6 +123,9 @@ Bug Fixes some readers did not have the requested numeric DV field. (Rob Audenaerde, Shai Erera) +* LUCENE-5028: Remove pointless and confusing doShare option in FST's + PositiveIntOutputs (Han Jiang via Mike McCandless) + Optimizations * LUCENE-4936: Improve numeric doc values compression in case all values share diff --git a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/TokenInfoDictionary.java b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/TokenInfoDictionary.java index fd7a676d1d7..6edcf345b03 100644 --- a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/TokenInfoDictionary.java +++ b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/TokenInfoDictionary.java @@ -44,7 +44,7 @@ public final class TokenInfoDictionary extends BinaryDictionary { try { is = getResource(FST_FILENAME_SUFFIX); is = new BufferedInputStream(is); - fst = new FST(new InputStreamDataInput(is), PositiveIntOutputs.getSingleton(true)); + fst = new FST(new InputStreamDataInput(is), PositiveIntOutputs.getSingleton()); } catch (IOException ioe) { priorE = ioe; } finally { diff --git a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/UserDictionary.java b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/UserDictionary.java index 3ff5e64a01a..10df235c5c7 100644 --- a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/UserDictionary.java +++ b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/UserDictionary.java @@ -88,7 +88,7 @@ public final class UserDictionary implements Dictionary { List data = new ArrayList(featureEntries.size()); List segmentations = new ArrayList(featureEntries.size()); - PositiveIntOutputs fstOutput = PositiveIntOutputs.getSingleton(true); + PositiveIntOutputs fstOutput = PositiveIntOutputs.getSingleton(); Builder fstBuilder = new Builder(FST.INPUT_TYPE.BYTE2, fstOutput); IntsRef scratch = new IntsRef(); long ord = 0; diff --git a/lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/TokenInfoDictionaryBuilder.java b/lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/TokenInfoDictionaryBuilder.java index bec0c8700f2..253bc87ed53 100644 --- a/lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/TokenInfoDictionaryBuilder.java +++ b/lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/TokenInfoDictionaryBuilder.java @@ -131,7 +131,7 @@ public class TokenInfoDictionaryBuilder { System.out.println(" encode..."); - PositiveIntOutputs fstOutput = PositiveIntOutputs.getSingleton(true); + PositiveIntOutputs fstOutput = PositiveIntOutputs.getSingleton(); Builder fstBuilder = new Builder(FST.INPUT_TYPE.BYTE2, 0, 0, true, true, Integer.MAX_VALUE, fstOutput, null, true, PackedInts.DEFAULT, true, 15); IntsRef scratch = new IntsRef(); long ord = -1; // first ord will be 0 diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/VariableGapTermsIndexReader.java b/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/VariableGapTermsIndexReader.java index 532c9e6d5e2..6975f265ab1 100644 --- a/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/VariableGapTermsIndexReader.java +++ b/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/VariableGapTermsIndexReader.java @@ -44,7 +44,7 @@ import org.apache.lucene.util.fst.Util; // for toDot * @lucene.experimental */ public class VariableGapTermsIndexReader extends TermsIndexReaderBase { - private final PositiveIntOutputs fstOutputs = PositiveIntOutputs.getSingleton(true); + private final PositiveIntOutputs fstOutputs = PositiveIntOutputs.getSingleton(); private int indexDivisor; // Closed if indexLoaded is true: @@ -199,7 +199,7 @@ public class VariableGapTermsIndexReader extends TermsIndexReaderBase { if (indexDivisor > 1) { // subsample final IntsRef scratchIntsRef = new IntsRef(); - final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(true); + final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(); final Builder builder = new Builder(FST.INPUT_TYPE.BYTE1, outputs); final BytesRefFSTEnum fstEnum = new BytesRefFSTEnum(fst); BytesRefFSTEnum.InputOutput result; diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/VariableGapTermsIndexWriter.java b/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/VariableGapTermsIndexWriter.java index 65a0b7e9959..6d3f6ba1b8c 100644 --- a/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/VariableGapTermsIndexWriter.java +++ b/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/VariableGapTermsIndexWriter.java @@ -235,7 +235,7 @@ public class VariableGapTermsIndexWriter extends TermsIndexWriterBase { public FSTFieldWriter(FieldInfo fieldInfo, long termsFilePointer) throws IOException { this.fieldInfo = fieldInfo; - fstOutputs = PositiveIntOutputs.getSingleton(true); + fstOutputs = PositiveIntOutputs.getSingleton(); fstBuilder = new Builder(FST.INPUT_TYPE.BYTE1, fstOutputs); indexStart = out.getFilePointer(); ////System.out.println("VGW: field=" + fieldInfo.name); diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldsReader.java b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldsReader.java index ff940e8c411..d576d3ce1ef 100644 --- a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldsReader.java +++ b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldsReader.java @@ -513,7 +513,7 @@ class SimpleTextFieldsReader extends FieldsProducer { } private void loadTerms() throws IOException { - PositiveIntOutputs posIntOutputs = PositiveIntOutputs.getSingleton(false); + PositiveIntOutputs posIntOutputs = PositiveIntOutputs.getSingleton(); final Builder>> b; final PairOutputs outputsInner = new PairOutputs(posIntOutputs, posIntOutputs); final PairOutputs> outputs = new PairOutputs>(posIntOutputs, diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene42/Lucene42DocValuesConsumer.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene42/Lucene42DocValuesConsumer.java index aced6ce5589..a1f6dc47d82 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene42/Lucene42DocValuesConsumer.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene42/Lucene42DocValuesConsumer.java @@ -245,7 +245,7 @@ class Lucene42DocValuesConsumer extends DocValuesConsumer { meta.writeVInt(field.number); meta.writeByte(FST); meta.writeLong(data.getFilePointer()); - PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(true); + PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(); Builder builder = new Builder(INPUT_TYPE.BYTE1, outputs); IntsRef scratch = new IntsRef(); long ord = 0; diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene42/Lucene42DocValuesProducer.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene42/Lucene42DocValuesProducer.java index 30aad0fb39a..c5ac3f11ee8 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene42/Lucene42DocValuesProducer.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene42/Lucene42DocValuesProducer.java @@ -278,7 +278,7 @@ class Lucene42DocValuesProducer extends DocValuesProducer { instance = fstInstances.get(field.number); if (instance == null) { data.seek(entry.offset); - instance = new FST(data, PositiveIntOutputs.getSingleton(true)); + instance = new FST(data, PositiveIntOutputs.getSingleton()); fstInstances.put(field.number, instance); } } @@ -352,7 +352,7 @@ class Lucene42DocValuesProducer extends DocValuesProducer { instance = fstInstances.get(field.number); if (instance == null) { data.seek(entry.offset); - instance = new FST(data, PositiveIntOutputs.getSingleton(true)); + instance = new FST(data, PositiveIntOutputs.getSingleton()); fstInstances.put(field.number, instance); } } diff --git a/lucene/core/src/java/org/apache/lucene/util/fst/PositiveIntOutputs.java b/lucene/core/src/java/org/apache/lucene/util/fst/PositiveIntOutputs.java index 2460f25034c..d13648af877 100644 --- a/lucene/core/src/java/org/apache/lucene/util/fst/PositiveIntOutputs.java +++ b/lucene/core/src/java/org/apache/lucene/util/fst/PositiveIntOutputs.java @@ -33,26 +33,13 @@ public final class PositiveIntOutputs extends Outputs { private final static Long NO_OUTPUT = new Long(0); - private final boolean doShare; + private final static PositiveIntOutputs singleton = new PositiveIntOutputs(); - private final static PositiveIntOutputs singletonShare = new PositiveIntOutputs(true); - private final static PositiveIntOutputs singletonNoShare = new PositiveIntOutputs(false); - - private PositiveIntOutputs(boolean doShare) { - this.doShare = doShare; + private PositiveIntOutputs() { } - /** Returns the instance of PositiveIntOutputs. */ public static PositiveIntOutputs getSingleton() { - return getSingleton(true); - } - - /** Expert: pass doShare=false to disable output sharing. - * In some cases this may result in a smaller FST, - * however it will also break methods like {@link - * Util#getByOutput} and {@link Util#shortestPaths}. */ - public static PositiveIntOutputs getSingleton(boolean doShare) { - return doShare ? singletonShare : singletonNoShare; + return singleton; } @Override @@ -61,14 +48,10 @@ public final class PositiveIntOutputs extends Outputs { assert valid(output2); if (output1 == NO_OUTPUT || output2 == NO_OUTPUT) { return NO_OUTPUT; - } else if (doShare) { + } else { assert output1 > 0; assert output2 > 0; return Math.min(output1, output2); - } else if (output1.equals(output2)) { - return output1; - } else { - return NO_OUTPUT; } } @@ -134,6 +117,6 @@ public final class PositiveIntOutputs extends Outputs { @Override public String toString() { - return "PositiveIntOutputs(doShare=" + doShare + ")"; + return "PositiveIntOutputs"; } } diff --git a/lucene/core/src/java/org/apache/lucene/util/fst/Util.java b/lucene/core/src/java/org/apache/lucene/util/fst/Util.java index 26aa69a06e9..ed7452ecce8 100644 --- a/lucene/core/src/java/org/apache/lucene/util/fst/Util.java +++ b/lucene/core/src/java/org/apache/lucene/util/fst/Util.java @@ -93,9 +93,7 @@ public final class Util { * *

NOTE: this only works with {@code FST}, only * works when the outputs are ascending in order with - * the inputs and only works when you shared - * the outputs (pass doShare=true to {@link - * PositiveIntOutputs#getSingleton}). + * the inputs. * For example, simple ordinals (0, 1, * 2, ...), or file offets (when appending to a file) * fit this. */ @@ -517,11 +515,7 @@ public final class Util { } /** Starting from node, find the top N min cost - * completions to a final node. - * - *

NOTE: you must share the outputs when you build the - * FST (pass doShare=true to {@link - * PositiveIntOutputs#getSingleton}). */ + * completions to a final node. */ public static MinResult[] shortestPaths(FST fst, FST.Arc fromNode, T startOutput, Comparator comparator, int topN, boolean allowEmptyString) throws IOException { diff --git a/lucene/core/src/java/org/apache/lucene/util/fst/package.html b/lucene/core/src/java/org/apache/lucene/util/fst/package.html index 93c16e1f27e..dfd42a3fe1d 100644 --- a/lucene/core/src/java/org/apache/lucene/util/fst/package.html +++ b/lucene/core/src/java/org/apache/lucene/util/fst/package.html @@ -43,7 +43,7 @@ FST Construction example: String inputValues[] = {"cat", "dog", "dogs"}; long outputValues[] = {5, 7, 12}; - PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(true); + PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(); Builder<Long> builder = new Builder<Long>(INPUT_TYPE.BYTE1, outputs); BytesRef scratchBytes = new BytesRef(); IntsRef scratchInts = new IntsRef(); @@ -60,8 +60,7 @@ Retrieval by key: Retrieval by value:

-    // Only works because outputs are also in sorted order, and
-    // we passed 'true' for sharing to PositiveIntOutputs.getSingleton
+    // Only works because outputs are also in sorted order
     IntsRef key = Util.getByOutput(fst, 12);
     System.out.println(Util.toBytesRef(key, scratchBytes).utf8ToString()); // dogs
 
@@ -77,7 +76,6 @@ Iterate over key-value pairs in sorted order: N-shortest paths by weight:
-    // Only works because we passed 'true' for sharing to PositiveIntOutputs.getSingleton
     Comparator<Long> comparator = new Comparator<Long>() {
       public int compare(Long left, Long right) {
         return left.compareTo(right);
diff --git a/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java b/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java
index fd7e8acec47..fe21e0ab87a 100644
--- a/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java
+++ b/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java
@@ -126,7 +126,7 @@ public class TestFSTs extends LuceneTestCase {
 
       // FST ord pos int
       {
-        final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(true);
+        final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
         final List> pairs = new ArrayList>(terms2.length);
         for(int idx=0;idx(terms2[idx], (long) idx));
@@ -171,7 +171,7 @@ public class TestFSTs extends LuceneTestCase {
 
     // PositiveIntOutput (ord)
     {
-      final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(true);
+      final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
       final List> pairs = new ArrayList>(terms.length);
       for(int idx=0;idx(terms[idx], (long) idx));
@@ -181,8 +181,7 @@ public class TestFSTs extends LuceneTestCase {
 
     // PositiveIntOutput (random monotonically increasing positive number)
     {
-      final boolean doShare = random().nextBoolean();
-      final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(doShare);
+      final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
       final List> pairs = new ArrayList>(terms.length);
       long lastOutput = 0;
       for(int idx=0;idx(terms[idx], value));
       }
-      new FSTTester(random(), dir, inputMode, pairs, outputs, doShare).doTest(true);
+      new FSTTester(random(), dir, inputMode, pairs, outputs, true).doTest(true);
     }
 
     // PositiveIntOutput (random positive number)
     {
-      final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(random().nextBoolean());
+      final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
       final List> pairs = new ArrayList>(terms.length);
       for(int idx=0;idx(terms[idx], _TestUtil.nextLong(random(), 0, Long.MAX_VALUE)));
@@ -205,8 +204,8 @@ public class TestFSTs extends LuceneTestCase {
 
     // Pair
     {
-      final PositiveIntOutputs o1 = PositiveIntOutputs.getSingleton(random().nextBoolean());
-      final PositiveIntOutputs o2 = PositiveIntOutputs.getSingleton(random().nextBoolean());
+      final PositiveIntOutputs o1 = PositiveIntOutputs.getSingleton();
+      final PositiveIntOutputs o2 = PositiveIntOutputs.getSingleton();
       final PairOutputs outputs = new PairOutputs(o1, o2);
       final List>> pairs = new ArrayList>>(terms.length);
       long lastOutput = 0;
@@ -306,7 +305,7 @@ public class TestFSTs extends LuceneTestCase {
     }
     IndexReader r = DirectoryReader.open(writer, true);
     writer.close();
-    final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(random().nextBoolean());
+    final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
 
     final boolean doRewrite = random().nextBoolean();
 
@@ -653,8 +652,8 @@ public class TestFSTs extends LuceneTestCase {
 
     if (storeOrds && storeDocFreqs) {
       // Store both ord & docFreq:
-      final PositiveIntOutputs o1 = PositiveIntOutputs.getSingleton(true);
-      final PositiveIntOutputs o2 = PositiveIntOutputs.getSingleton(false);
+      final PositiveIntOutputs o1 = PositiveIntOutputs.getSingleton();
+      final PositiveIntOutputs o2 = PositiveIntOutputs.getSingleton();
       final PairOutputs outputs = new PairOutputs(o1, o2);
       new VisitTerms>(dirOut, wordsFileIn, inputMode, prune, outputs, doPack, noArcArrays) {
         Random rand;
@@ -669,7 +668,7 @@ public class TestFSTs extends LuceneTestCase {
       }.run(limit, verify, false);
     } else if (storeOrds) {
       // Store only ords
-      final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(true);
+      final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
       new VisitTerms(dirOut, wordsFileIn, inputMode, prune, outputs, doPack, noArcArrays) {
         @Override
         public Long getOutput(IntsRef input, int ord) {
@@ -678,7 +677,7 @@ public class TestFSTs extends LuceneTestCase {
       }.run(limit, verify, true);
     } else if (storeDocFreqs) {
       // Store only docFreq
-      final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(false);
+      final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
       new VisitTerms(dirOut, wordsFileIn, inputMode, prune, outputs, doPack, noArcArrays) {
         Random rand;
         @Override
@@ -781,7 +780,7 @@ public class TestFSTs extends LuceneTestCase {
     // smaller FST if the outputs grow monotonically.  But
     // if numbers are "random", false should give smaller
     // final size:
-    final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(true);
+    final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
 
     // Build an FST mapping BytesRef -> Long
     final Builder builder = new Builder(FST.INPUT_TYPE.BYTE1, outputs);
@@ -1100,7 +1099,7 @@ public class TestFSTs extends LuceneTestCase {
   }
 
   public void testFinalOutputOnEndState() throws Exception {
-    final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(true);
+    final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
 
     final Builder builder = new Builder(FST.INPUT_TYPE.BYTE4, 2, 0, true, true, Integer.MAX_VALUE, outputs, null, random().nextBoolean(), PackedInts.DEFAULT, true, 15);
     builder.add(Util.toUTF32("stat", new IntsRef()), 17L);
@@ -1115,7 +1114,7 @@ public class TestFSTs extends LuceneTestCase {
   }
 
   public void testInternalFinalState() throws Exception {
-    final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(true);
+    final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
     final boolean willRewrite = random().nextBoolean();
     final Builder builder = new Builder(FST.INPUT_TYPE.BYTE1, 0, 0, true, true, Integer.MAX_VALUE, outputs, null, willRewrite, PackedInts.DEFAULT, true, 15);
     builder.add(Util.toIntsRef(new BytesRef("stat"), new IntsRef()), outputs.getNoOutput());
@@ -1136,7 +1135,7 @@ public class TestFSTs extends LuceneTestCase {
   // Make sure raw FST can differentiate between final vs
   // non-final end nodes
   public void testNonFinalStopNode() throws Exception {
-    final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(true);
+    final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
     final Long nothing = outputs.getNoOutput();
     final Builder b = new Builder(FST.INPUT_TYPE.BYTE1, outputs);
 
@@ -1216,7 +1215,7 @@ public class TestFSTs extends LuceneTestCase {
   };
 
   public void testShortestPaths() throws Exception {
-    final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(true);
+    final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
     final Builder builder = new Builder(FST.INPUT_TYPE.BYTE1, outputs);
 
     final IntsRef scratch = new IntsRef();
@@ -1258,8 +1257,8 @@ public class TestFSTs extends LuceneTestCase {
   public void testShortestPathsWFST() throws Exception {
 
     PairOutputs outputs = new PairOutputs(
-        PositiveIntOutputs.getSingleton(true), // weight
-        PositiveIntOutputs.getSingleton(true)  // output
+        PositiveIntOutputs.getSingleton(), // weight
+        PositiveIntOutputs.getSingleton()  // output
     );
     
     final Builder> builder = new Builder>(FST.INPUT_TYPE.BYTE1, outputs);
@@ -1301,7 +1300,7 @@ public class TestFSTs extends LuceneTestCase {
     final TreeMap slowCompletor = new TreeMap();
     final TreeSet allPrefixes = new TreeSet();
     
-    final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(true);
+    final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
     final Builder builder = new Builder(FST.INPUT_TYPE.BYTE1, outputs);
     final IntsRef scratch = new IntsRef();
     
@@ -1416,8 +1415,8 @@ public class TestFSTs extends LuceneTestCase {
     final TreeSet allPrefixes = new TreeSet();
     
     PairOutputs outputs = new PairOutputs(
-        PositiveIntOutputs.getSingleton(true), // weight
-        PositiveIntOutputs.getSingleton(true)  // output
+        PositiveIntOutputs.getSingleton(), // weight
+        PositiveIntOutputs.getSingleton()  // output
     );
     final Builder> builder = new Builder>(FST.INPUT_TYPE.BYTE1, outputs);
     final IntsRef scratch = new IntsRef();
diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggester.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggester.java
index 66c25d74b38..6e797ad1edc 100644
--- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggester.java
+++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggester.java
@@ -512,7 +512,7 @@ public class AnalyzingSuggester extends Lookup {
 
       reader = new Sort.ByteSequencesReader(tempSorted);
      
-      PairOutputs outputs = new PairOutputs(PositiveIntOutputs.getSingleton(true), ByteSequenceOutputs.getSingleton());
+      PairOutputs outputs = new PairOutputs(PositiveIntOutputs.getSingleton(), ByteSequenceOutputs.getSingleton());
       Builder> builder = new Builder>(FST.INPUT_TYPE.BYTE1, outputs);
 
       // Build FST:
@@ -634,7 +634,7 @@ public class AnalyzingSuggester extends Lookup {
   public boolean load(InputStream input) throws IOException {
     DataInput dataIn = new InputStreamDataInput(input);
     try {
-      this.fst = new FST>(dataIn, new PairOutputs(PositiveIntOutputs.getSingleton(true), ByteSequenceOutputs.getSingleton()));
+      this.fst = new FST>(dataIn, new PairOutputs(PositiveIntOutputs.getSingleton(), ByteSequenceOutputs.getSingleton()));
       maxAnalyzedPathsForOneInput = dataIn.readVInt();
       hasPayloads = dataIn.readByte() == 1;
     } finally {
diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/WFSTCompletionLookup.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/WFSTCompletionLookup.java
index 7b8d78286b7..f634bee80ed 100644
--- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/WFSTCompletionLookup.java
+++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/WFSTCompletionLookup.java
@@ -101,7 +101,7 @@ public class WFSTCompletionLookup extends Lookup {
     TermFreqIterator iter = new WFSTTermFreqIteratorWrapper(iterator);
     IntsRef scratchInts = new IntsRef();
     BytesRef previous = null;
-    PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(true);
+    PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
     Builder builder = new Builder(FST.INPUT_TYPE.BYTE1, outputs);
     while ((scratch = iter.next()) != null) {
       long cost = iter.weight();
@@ -136,7 +136,7 @@ public class WFSTCompletionLookup extends Lookup {
   @Override
   public boolean load(InputStream input) throws IOException {
     try {
-      this.fst = new FST(new InputStreamDataInput(input), PositiveIntOutputs.getSingleton(true));
+      this.fst = new FST(new InputStreamDataInput(input), PositiveIntOutputs.getSingleton());
     } finally {
       IOUtils.close(input);
     }