lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: DocsEnum <--- IndexReader.?
Date Tue, 30 Apr 2013 15:36:10 GMT
Hmm MIGRATE is supposed to cover this ... try searching in
MIGRATE.html for "How you obtain the enums has changed"?


Mike McCandless

http://blog.mikemccandless.com


On Tue, Apr 30, 2013 at 10:10 AM, A. Lotfi <majidnakit@yahoo.com> wrote:
>
>
>  Hi,
> I am trying  to migrate some code from version 2.9.0 to 4.2.1, I have this method :
>
>  public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
>             OpenBitSet result = new OpenBitSet(reader.maxDoc());
>             TermDocs td = reader.termDocs();   <----- This line has error
>             try {
>                 td.seek(term);
>                 int[] arr = new int[BUFFER_SIZE];
>                 int[] freq = new int[BUFFER_SIZE];
>                 for (;;) {
>                     int num = td.read(arr, freq);
>                     if (num == 0)
>                         break;
>                     for (int j = 0; j < num; j++) {
>                         result.fastSet(arr[j]);
>                     }
>                 }
>
>             } finally {
>                 td.close();
>             }
>             return result;
>         }
>
> The line that has error said :
>  The method termDocs() is undefined for the type IndexReader
>
> I found this doc about migrating :
> http://lucene.apache.org/core/4_0_0/MIGRATE.html
>
>
> But IndexReader does not have a method that return the new class  DocsEnum ( that renamed
TermDocs).
> Thanks, your help is appreciated.
>
> Abdel

Mime
View raw message