lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From AHMET ARSLAN <iori...@yahoo.com>
Subject Re: get all tokens from index
Date Wed, 09 Sep 2009 07:08:11 GMT

> hello all, is there any way to get all
> tokens from my index ? please anyone
> suggest me

The code below prints all terms of a field.

       String path = "E:\\ThesaurusSolrHome\\data\\index";
       String field = "contents";

        IndexReader indexReader = IndexReader.open(path);
        TermEnum termEnum = indexReader.terms();

        while (termEnum.next()) {
            Term term = termEnum.term();
            if (term.field().equalsIgnoreCase(field))
                System.out.println(term.text());

        }
        termEnum.close();
        indexReader.close();


      

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message