BooleanQuery.setMaxClauseCount(10000);
    private CountedIndexReader getCountedIndexReader() throws IOException    {        synchronized(getLock()) {                    IndexReader reader = null;            try {                /* uggghhh!  nasty.  FIXME - need to coordinate with index writer better              (manually create a RamDirectory and index into that?) */                flush();                reader = IndexReader.open(mIdxPath);            } catch(IOException e) {                // Handle the special case of trying to open a not-yet-created                // index, by opening for write and immediately closing.  Index                // directory should get initialized as a result.                File indexDir = new File(mIdxPath);                if (!indexDir.exists()) {                    openIndexWriter();                    flush();                    try {                        reader = IndexReader.open(mIdxPath);                    } catch (IOException e1) {                        if (reader != null)                            reader.close();                        throw e1;                    }                } else {                    if (reader != null)                        reader.close();                    throw e;                }            }            return new CountedIndexReader(reader);        }    }