Apache Lucene open-source search software
add commented out code to write the dot-file for the FST index
Michael McCandless4fa9156d3af5
diff --git a/lucene/src/java/org/apache/lucene/index/codecs/VariableGapTermsIndexReader.java b/lucene/src/java/org/apache/lucene/index/codecs/VariableGapTermsIndexReader.javaindex 68ec78ab023..77dc6eda6de 100644--- a/lucene/src/java/org/apache/lucene/index/codecs/VariableGapTermsIndexReader.java+++ b/lucene/src/java/org/apache/lucene/index/codecs/VariableGapTermsIndexReader.java@@ -18,6 +18,9 @@ package org.apache.lucene.index.codecs;*/import java.io.IOException;+import java.io.FileOutputStream; // for toDot+import java.io.OutputStreamWriter; // for toDot+import java.io.Writer; // for toDotimport java.util.Collection;import java.util.HashMap;import java.util.Iterator;@@ -34,6 +37,7 @@ import org.apache.lucene.util.automaton.fst.Builder;import org.apache.lucene.util.automaton.fst.BytesRefFSTEnum;import org.apache.lucene.util.automaton.fst.FST;import org.apache.lucene.util.automaton.fst.PositiveIntOutputs;+import org.apache.lucene.util.automaton.fst.Util; // for toDot/** See {@link VariableGapTermsIndexWriter}*@@ -52,11 +56,13 @@ public class VariableGapTermsIndexReader extends TermsIndexReaderBase {// start of the field info dataprotected long dirOffset;+ final String segment;+public VariableGapTermsIndexReader(Directory dir, FieldInfos fieldInfos, String segment, int indexDivisor, String codecId)throws IOException {in = dir.openInput(IndexFileNames.segmentFileName(segment, codecId, VariableGapTermsIndexWriter.TERMS_INDEX_EXTENSION));-+ this.segment = segment;boolean success = false;try {@@ -176,6 +182,14 @@ public class VariableGapTermsIndexReader extends TermsIndexReaderBase {fst = new FST<Long>(clone, fstOutputs);clone.close();+ /*+ final String dotFileName = segment + "_" + fieldInfo.name + ".dot";+ Writer w = new OutputStreamWriter(new FileOutputStream(dotFileName));+ Util.toDot(fst, w, false, false);+ System.out.println("FST INDEX: SAVED to " + dotFileName);+ w.close();+ */+if (indexDivisor > 1) {// subsamplefinal PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(true);