I try to traverse all the term text in one tis files. And it failed. the code is below. Does I misunderstand something? The source code (especial the index namespace) is very complicated for me. Is there any more document about the design and something can help me understand the source?
Thanks. public static void main(String[] args) throws IOException { File path = new File("../../wiki/index").getCanonicalFile(); FSDirectory directory = FSDirectory.open(path); IndexInput input = directory.openInput("_1ck.tis"); System.out.println(input.readInt()); System.out.println(input.readLong()); System.out.println(input.readInt()); System.out.println(input.readInt()); System.out.println(input.readInt()); String text = ""; for(int i = 0; i < 10; ++i){ TermInfo termInfo = new TermInfo(input); text = text.substring(0, termInfo.term.prefixLength) + termInfo.term.suffix; System.out.println(text); } } private static class Term { public int prefixLength; public String suffix; public int fieldNum; Term(IndexInput input) throws IOException { this.prefixLength = input.readVInt(); this.suffix = input.readString(); this.fieldNum = input.readVInt(); } } private static class TermInfo { public Term term; public int docFreq, freqDelta, proxDelta, skipDelta; TermInfo(IndexInput input) throws IOException { this.term = new Term(input); this.docFreq = input.readVInt(); this.freqDelta = input.readVInt(); this.proxDelta = input.readVInt(); this.skipDelta = input.readVInt(); } }