On Tue, Nov 10, 2009 at 00:44, Michael McCandless
<luc...@mikemccandless.com> wrote:
> Stepping back, since presumably your app knows what it's storing in
> the directory, can't you filter for files you know you've created?
> What's the larger use case here?

The exact use case where we were using list() is to determine whether
the index had data in it, without having to open it and do a
docCount() (well, there were also calls to it in the unit tests, but
those were entirely replaceable with listAll()).

This was previously a one-liner:

    boolean containsData = directory.list().length > 1

Maybe there is another newer API which will return this to being a
one-liner -- at the time it was written this seemed to be the best
option.

By the way, when I mean "there is no data in it", I mean the index
exists but has 0 documents.  Detecting that the index itself does not
exist is somewhat simpler.

Daniel


-- 
Daniel Noll                            Forensic and eDiscovery Software
Senior Developer                              The world's most advanced
Nuix                                                email data analysis
http://nuix.com/                                and eDiscovery software

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

Reply via email to