Package com.flaptor.util

Examples of com.flaptor.util.Config


    private int textLengthLimit; // the maximum allowed page text length.
    private RmiServer cacheRmiServer;
   
    public CacheModule (String moduleName, Config globalConfig) {
        super(moduleName, globalConfig);
        Config mdlConfig = getModuleConfig();
        String textDir = mdlConfig.getString("text.cache.dir");
        if (textDir.length() > 0) {
            textCache = new FileCache<String>(textDir);
        }
        String pageDir = mdlConfig.getString("page.cache.dir");
        if (pageDir.length() > 0) {
            pageCache = new FileCache<DocumentCacheItem>(pageDir);
        }
        textLengthLimit = globalConfig.getInt("page.text.max.length");
       
View Full Code Here


    private IndexUpdatesListener iul;

    public IndexLibrary(ReloadableIndexHandler rih) {
        this.rih = rih;
        deletes = new DelayQueue<DeleteIndexTask>();
        Config config = Config.getConfig("searcher.properties");
        indexDeleteDelay = config.getLong("IndexLibrary.indexDeleteDelay");
        boolean cleanup = config.getBoolean("IndexLibrary.cleanupOnStartup");
        File baseDir = new File(Config.getConfig("common.properties").getString("baseDir"));
        File workingDir = null;
        try {
            workingDir = new File(baseDir,config.getString("searcher.dir") + File.separator + "indexes");
            workingDir = FileUtil.createOrGetDir(workingDir.getAbsolutePath(), true, true);
        } catch (IOException e1) {
            throw new RuntimeException(e1);
        }
        File[] files = listFilesByDate_NewestFirst(workingDir);
View Full Code Here

    protected void setUp() throws Exception {
        dir = FileUtil.createTempDir("SynonymQuerySuggestorTest", ".tmp");
        String synonymFile = dir.getAbsolutePath()+File.separator+"synonyms.txt";
        TestUtils.writeFile(synonymFile,"foo=house,bar\nfoo1=bar1\nfoos=bar,bar1,bar2\ndont=cant,wont");

        Config config = Config.getConfig("searcher.properties");
        config.set("QueryParser.searchFields", "content");
        config.set("QueryParser.searchFieldWeights", "1.0f");
        config.set("QueryParser.synonymFile",synonymFile);

       
        baseSearcher = new SearcherStub();
        suggestSearcher = new SuggestQuerySearcher(baseSearcher,new SynonymQuerySuggestor(new File(synonymFile)),100,factor,3);
    }
View Full Code Here

        String phrasesFile = dir.getAbsolutePath()+File.separator+"phrases.txt";
        TestUtils.writeFile(phrasesFile, "yo soy marto\nvoy a la casa de mono\nla casa\nsoy de river plate\n");
        String synonymFile = dir.getAbsolutePath()+File.separator+"synonyms.txt";
        TestUtils.writeFile(synonymFile,"foo=bar\nfoo1=bar1\nfoos=bar,bar1,bar2");

        Config config = Config.getConfig("searcher.properties");
        config.set("QueryParser.searchFields", "content");
        config.set("QueryParser.searchFieldWeights", "1.0f");
        config.set("searcher.query.phrasesFile", phrasesFile);
        config.set("QueryParser.synonymFields","text");
        config.set("QueryParser.synonymFile",synonymFile);

       
        qp = new QueryParser();
    }
View Full Code Here

        config.set("clustering.enable","false");
        config.set("protect.against.empty.pagedb","false");

        TestUtils.writeFile(tmpDir+"/testhotspot", "*");

        Config indexerModuleConfig = Config.getConfig("indexerModule.properties");
        indexerModuleConfig.set("use.mock.indexer","yes");
        Config whitelistModuleConfig = Config.getConfig("whitelistModule.properties");

        whitelistModuleConfig.set("whitelist.file",tmpDir+"/testhotspot");
        whitelistModuleConfig.set("on.true.set.tags","TAG_IS_INDEXABLE");

    }
View Full Code Here

    @TestInfo(testType = TestInfo.TestType.INTEGRATION)
    public void testSpamRank () throws Exception {
        if (!testingSpamRank) return;
        System.out.println("...Testing SpamRank");
        Config spamModuleConfig = Config.getConfig("spamModule.properties");
        spamModuleConfig.set("url.pattern.file",tmpDir+"/spam.regex");
        TestUtils.writeFile(tmpDir+"/spam.regex",SimWeb.pageToUrl(1));
        config.set("max.distance", "0");
        config.set("priority.percentile.to.fetch", "100");
        config.set("record.parents", "true");
        config.set("modules", "com.flaptor.hounder.crawler.modules.WhiteListModule,whitelist|com.flaptor.hounder.crawler.modules.SpamDetectorModule,spam|com.flaptor.hounder.crawler.modules.IndexerModule,indexer");
View Full Code Here

  private String tmpDir = null;
   
    @Override
    public void setUp() throws Exception {
    tmpDir = com.flaptor.util.FileUtil.createTempDir("RmiIndexerStubTest", ".tmp").getAbsolutePath();
    Config commonConfig = Config.getConfig("common.properties");
        commonConfig.set("baseDir", tmpDir);

        Config config = Config.getConfig("indexer.properties");
        config.set("Indexer.modules", "com.flaptor.hounder.indexer.Writer");
        config.set("IndexManager.updateInterval", "1000");
        config.set("Indexer.maxQueueSize", "100");
        config.set("IndexLibrary.remoteIndexUpdaters", "");
        config.set("IndexLibrary.rsyncAccessString", "");
        config.set("clustering.enable","false");
    }
View Full Code Here

        "bayes.calculator.min.required.both=0\n" +
        "bayes.calculator.ignore.term.probability.from=0.43\n"+
        "bayes.calculator.ignore.term.probability.to=0.44\n"+
        "bayes.calculator.tmp.dir=" +  dirName + "\n";
        TestUtils.writeFile(CONFIG_FILE, cfg);
        Config config=  Config.getConfig(CONFIG_FILE);
        bc= new BayesCalculator(dirName, CATEGORY_NAME, config, 1);

        /* Adding the following
           tokens   timesCat    timesNonCat
            strA    4            0
View Full Code Here

        "bayes.calculator.min.required.both=5\n" +
        "bayes.calculator.ignore.term.probability.from=0.43\n"+
        "bayes.calculator.ignore.term.probability.to=0.44\n"+
        "bayes.calculator.tmp.dir=" +  dirName + "\n";
        TestUtils.writeFile(CONFIG_FILE, cfg);
        Config config=  Config.getConfig(CONFIG_FILE);
        bc= new BayesCalculator(dirName, CATEGORY_NAME, config, 1);
       
        docTknCat.put("not_enough_cat", new int[]{1});
        docTknNonCat.put("not_enough_non_cat", new int[]{1});
        for (int i=0; i< 2; i++){
View Full Code Here

    private void setUpSearcher() throws Exception {   
        searcherConfig = Config.getConfig("searcher.properties");
        String tmpDir = com.flaptor.util.FileUtil.createTempDir("junit", ".tmp").getAbsolutePath();
        String searcherTmpDir = com.flaptor.util.FileUtil.createTempDir("junit", ".tmp").getAbsolutePath();

        Config indexerConfig = Config.getConfig("indexer.properties");
        Config.getConfig("common.properties").set("baseDir", tmpDir);
        Config.getConfig("common.properties").set("port.base", String.valueOf(startPort));
        // Configuration
        // indexer:
        indexerConfig.set("IndexManager.updateInterval", "2000");
        indexerConfig.set("IndexLibrary.remoteIndexUpdaters","127.0.0.1:"+String.valueOf(startPort));
        indexerConfig.set("Indexer.modules", "com.flaptor.hounder.indexer.Writer");
        indexerConfig.set("Indexer.fields", "text");
        indexerConfig.set("docIdName", "docId");
        indexerConfig.set("Indexer.maxQueueSize", "100");
        indexerConfig.set("IndexLibrary.rsyncAccessString","");
        indexerConfig.set("Writer.fields", "");
        indexerConfig.set("clustering.enable", "false");
        indexerConfig.set("Indexer.modules","com.flaptor.hounder.indexer.LoggerModule,com.flaptor.hounder.indexer.HtmlParser,com.flaptor.hounder.indexer.Writer");
        // searcher:
        searcherConfig.set("QueryParser.searchFields", "text");
        searcherConfig.set("QueryParser.searchFieldWeights", "1.0f");
        searcherConfig.set("QueryParser.nonTokenizedFields", "");
        searcherConfig.set("Searcher.workingDirPath", searcherTmpDir);
View Full Code Here

TOP

Related Classes of com.flaptor.util.Config

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.