lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: How to convert TermDocs and TermEnum ??
Date Fri, 24 May 2013 10:43:01 GMT
Hi,

Have a look at MIGRATE.txt?

Mike McCandless

http://blog.mikemccandless.com


On Mon, May 20, 2013 at 10:54 AM, A. Lotfi <majidnakit@yahoo.com> wrote:
> Hi,
>
> I found some difficulties converting from old API to the newest one :
>
> import org.apache.lucene.index.TermDocs;   // does not exist
> import org.apache.lucene.index.TermEnum;  // does not exist
>
> I tried the migration doc, but could not figure it out, here my code :
>
>  private List<Short>[] loadFieldValues(IndexReader reader) throws IOException {
>
>         List<Short>[] retArray = new List[reader.maxDoc()];
>         TermEnum termEnum = reader.terms (new Term (GEO_LOC));
>         try {
>             do {
>                 Term term = termEnum.term();
>                 if (term==null || term.field() != GEO_LOC) break;
>                 TermDocs td = reader.termDocs(term);
>                 String value = term.text();
>                .......
>                ...........
>
>                 td.close();
>             } while (termEnum.next());
>
>         } finally {
>             termEnum.close();
>         }
>         return retArray;
>     }
>
> I will appreciate your help.
> thanks

Mime
View raw message