lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Noll <>
Subject Re: Directory.list() deprecation
Date Tue, 10 Nov 2009 00:53:00 GMT
On Tue, Nov 10, 2009 at 00:44, Michael McCandless
<> 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

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 Noll                            Forensic and eDiscovery Software
Senior Developer                              The world's most advanced
Nuix                                                email data analysis                                and eDiscovery software

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message