lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Samir Abdou" <abdou.sa...@gmail.com>
Subject Re: Is there a Term ID for each distinctive term indexed in Lucene?
Date Sat, 01 Sep 2007 10:13:33 GMT
Hi,

You should extend the SegmentReader (or IndexReader) class to implement the
following method:

*public* *long* termID(Term t) *throws* IOException {  *return*
tis.getPosition(t);
}

which will give you a mean to get the ID of a given term.  This ID is simply
the position of that term within ".ti?" file !

Hope this will help

Regards,

Samir





2007/9/1, Tao Cheng <tcheng3@gmail.com>:
>
> Hi all,
>
> I found that instead of storing a term ID for a term in the index, Lucene
> stores the actual term string value. I am wondering if there ever is such
> a
> "term ID" for each distinctive term indexed in Lucne, similar as a "doc
> ID"
> for each distinctive document indexed in Lucene.
>
> In other words, I am looking for a method like " int termId(string term)"
> in
> the IndexReader, such that it can return my an ID given a term's string
> value.
>
> Thanks a lot in advance.
>
> -Tao
>

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