From 4fa9156d3af5721b3d247959edc330d875d69e60 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Mon, 11 Apr 2011 10:56:46 +0000 Subject: [PATCH] add commented out code to write the dot-file for the FST index git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1091020 13f79535-47bb-0310-9956-ffa450edef68 --- .../codecs/VariableGapTermsIndexReader.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lucene/src/java/org/apache/lucene/index/codecs/VariableGapTermsIndexReader.java b/lucene/src/java/org/apache/lucene/index/codecs/VariableGapTermsIndexReader.java index 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 toDot import 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 data protected 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(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) { // subsample final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(true);