lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rockacola <rockac...@gmail.com>
Subject Re: Are you able to list everything in index
Date Mon, 23 Mar 2009 22:48:59 GMT

Hi Evert,

Thanks for your tip, it actually gave me a hint toward my desired solution!
This is what I've end up with:

        public static List<Document> GetAll(string physicalIndexDirectory)
        {
            List<Document> list = new List<Document>();
            IndexReader ir = IndexReader.Open(physicalIndexDirectory);
            
            for (int i = 0; i < ir.MaxDoc(); i++)
            {
                list.Add(ir.Document(i));
            }

            return list;
        }


Regards.



Evert Wagenaar wrote:
> 
> Hi Racola,
> 
> You can get all the Terms from the Index from the IndexReader like in the
> code below. I'm uding Luvene Java and don't know much of .Net. But
> customized sorting can easily be done with a the Set collections (Like
> SortedSet).
> 
> Regards,
> 
> Evert
> 
> 
>         Directory dir = FSDirectory.getDirectory(indexLocation);
>         IndexReader reader = IndexReader.open(dir);
>         TermEnum terms = reader.terms();
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Are-you-able-to-list-everything-in-index-tp22652917p22670970.html
Sent from the Lucene - General mailing list archive at Nabble.com.


Mime
View raw message