lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "A. Lotfi" <majidna...@yahoo.com>
Subject How to convert TermDocs and TermEnum ??
Date Mon, 20 May 2013 14:54:34 GMT
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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message