lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iron light <iron9li...@gmail.com>
Subject Re: How does the term infos file (.tis) works?
Date Thu, 01 Oct 2009 12:21:54 GMT
Thanks, Mike.

The reason is I wanna dig deeply.
I just read the code. And found that  the index namespace (IndexWriter!) in
so tough for me.
Is there any document, resource or blog about the code?

IL

On Thu, Oct 1, 2009 at 8:53 PM, Michael McCandless <
lucene@mikemccandless.com> wrote:

> It's better to use the TermEnum API (IndexReader.terms()) to step
> through the terms, than to directly access the raw file (unless you
> have some reason to do so...).
>
> Mike
>
> On Wed, Sep 30, 2009 at 6:29 AM, iron light <iron9light@gmail.com> wrote:
> > 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();
> >        }
> >    }
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message