Package com.flaptor.hounder

Examples of com.flaptor.hounder.IndexDescriptor


            baseDir.mkdirs();
        }
    }

    public boolean addIndex(Index index) {
        IndexDescriptor desc = index.getIndexDescriptor();
        if (!knownClusters.contains(desc.getClusterName())) {
            return false;
        }

        // If there was an old copy of that index, delete it
        Index oldFromSameCluster = indexes.get(desc.getClusterName());
        if (null != oldFromSameCluster) {
            logger.debug("erasing old index for cluster \"" + desc.getClusterName() + "\".");
            oldFromSameCluster.eraseFromDisk();
        }


        // add it to current indexes
        indexes.put(desc.getClusterName(),index);

        // if we have a copy of each of this clusters, we can
        // create a multi index.
        if (indexes.size() == knownClusters.size()) {
            Index[] toMerge = new Index[knownClusters.size()];
View Full Code Here


                         + "indexes";
     
    lastOperation = new Hashtable<String, Long>();
        workingDirectory = new File(workingDirPath);
    indexDirectory = new File(workingDirectory, "index");
        indexDescriptor = new IndexDescriptor(config.getString("IndexManager.indexDescriptor"));
        library = new IndexLibrary(indexer);

        optimizeForBatch = config.getBoolean("optimizeForBatch");
        if (optimizeForBatch) {
            logger.warn("Constructor: the index manager is configured for batch indexing. Deletes will throw exceptions and"
View Full Code Here

            logger.info("constructor: Using latest copy as index.");
            String indexPath = indexDirectory.getAbsolutePath();
            com.flaptor.util.FileUtil.deleteDir(indexPath);
            Index latestCopyIndex = new Index(new File(latestCopy));
            workIndex = latestCopyIndex.copyIndex(indexDirectory);
            IndexDescriptor foundIndexDescriptor = workIndex.getIndexDescriptor();
            if (!indexDescriptor.equals(foundIndexDescriptor)) {
                String s = "This indexer is supposed to serve: " + indexDescriptor.toString() + ", but the index" +
                    " found is: " + foundIndexDescriptor.toString();
                logger.fatal(s);
                throw new IllegalStateException(s);
            }
            nextAddId = findLargestAddId() + 1;
            openWriter();
View Full Code Here

        this.clusterSize = clusterSize;
        this.outputDirectory = outputDirectory;
        hashFunction = new Hash(clusterSize);
        indexManagers = new BatchIndexManager[clusterSize];
        for (int i = 0; i < clusterSize; i++) {
            IndexDescriptor id = new IndexDescriptor(clusterSize, i , fragmentName);
            indexManagers[i] = new BatchIndexManager(id, new File(outputDirectory, "index-" + String.valueOf(i)));
        }
        //Some of the configuration is taken from the config system
        Config config = Config.getConfig("indexer.properties");
        docIdName = config.getString("docIdName");
View Full Code Here

                }
            }
            // Write index descriptors
            for (int i = 0; i < numIndexes; i++) {
                Index idx = new Index(new File(indexNames[i]));
                IndexDescriptor idxDescriptor = new IndexDescriptor(numIndexes,i,"defaultCluster");
                idx.setIndexDescriptor(idxDescriptor);
                idx.setIndexProperty("lastOptimization",String.valueOf(System.currentTimeMillis()));
                idx.close();
            }
           
View Full Code Here

    }


    public static void main(String[] args) throws Exception {
        IRemoteIndexUpdater updater = new IndexUpdatesListenerStub(Integer.parseInt(args[1]), args[0]);
        IndexDescriptor idxDesc = new IndexDescriptor("0of1@defaultCluster");
        if (args[2].contains(":")) {
            idxDesc.setRsyncAccessString(args[2].split(":")[0]);
            idxDesc.setLocalPath(args[2].split(":")[1]);
        } else {
            idxDesc.setRsyncAccessString("");
            idxDesc.setLocalPath(args[2]);
        }
        System.out.println("Updating " + idxDesc.getRemotePath() +" : " + updater.setNewIndex(idxDesc));
    }
View Full Code Here

TOP

Related Classes of com.flaptor.hounder.IndexDescriptor

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.