package cn.com.pc.penguin.core;

import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.util.Version;

/**
 * Created by IntelliJ IDEA.
 * User: huangqinghe
 * To change this template use File | Settings | File Templates.
 */
public class SearchManagerFactory {
    public synchronized static SearchManager createSearchManager(String searchType,Boolean isOnFile) throws Exception {
		PenguinSettings settings  = new PenguinSettings(searchType);
		if (isOnFile != null && isOnFile) {
			settings.setOnRam(false);
		}
		settings.init();
		settings.setAnalyzer(new StandardAnalyzer(Version.LUCENE_30));
		PenguinSearchManager sm = new PenguinSearchManager();
		sm.setSettings(settings);
		sm.init();
		return sm;
	}
}
