Package com.github.rnewson.couchdb.lucene.couchdb

Examples of com.github.rnewson.couchdb.lucene.couchdb.Database


                         final HttpServletResponse resp) throws IOException, JSONException {
        final Couch couch = getCouch(req);
        final Set<String> dbKeep = new HashSet<String>();
        final JSONArray databases = couch.getAllDatabases();
        for (int i = 0; i < databases.length(); i++) {
            final Database db = couch.getDatabase(databases.getString(i));
            final UUID uuid = db.getUuid();
            if (uuid == null) {
                continue;
            }
            dbKeep.add(uuid.toString());

            final Set<String> viewKeep = new HashSet<String>();

            for (final DesignDocument ddoc : db.getAllDesignDocuments()) {
                for (final View view : ddoc.getAllViews().values()) {
                    viewKeep.add(view.getDigest());
                }
            }

            // Delete all indexes except the keepers.
            final File[] dirs = DatabaseIndexer.uuidDir(root, db.getUuid()).listFiles();
            if (dirs != null) {
                for (final File dir : dirs) {
                    if (!viewKeep.contains(dir.getName())) {
                        LOG.info("Cleaning old index at " + dir);
                        FileUtils.deleteDirectory(dir);
View Full Code Here


    }

    private DatabaseIndexer getIndexer(final HttpServletRequest req)
            throws IOException, JSONException {
        final Couch couch = getCouch(req);
        final Database database = couch.getDatabase(new PathParts(req)
                .getDatabaseName());
        return getIndexer(database);
    }
View Full Code Here

TOP

Related Classes of com.github.rnewson.couchdb.lucene.couchdb.Database

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.