package cn.com.pc.penguin.service.impl;

import cn.com.pc.penguin.core.PenguinArgs;
import cn.com.pc.penguin.core.PenguinDocument;
import cn.com.pc.penguin.core.PenguinEngine;
import cn.com.pc.penguin.core.PenguinSearchHandler;
import cn.com.pc.penguin.service.DocumentBuilder;
import cn.com.pc.penguin.service.PenguinSearchResults;
import cn.com.pc.penguin.service.PenguinService;
import cn.com.pc.penguin.service.SearchArgs;
import org.json.JSONObject;

/**
 * Created by IntelliJ IDEA.
 * User: huangqinghe
 * To change this template use File | Settings | File Templates.
 */
public class LocalPenguinService  implements PenguinService {

	public void index(DocumentBuilder builder) throws Exception {
        PenguinDocument pdoc = new PenguinDocument(builder);
		PenguinEngine.searchHandler.index(pdoc);
		//searchHandler.commit();
	}

	public PenguinSearchResults search(SearchArgs args) throws Exception {
		PenguinArgs penguinArgs = new PenguinArgs(args);
		return PenguinEngine.searchHandler.search(penguinArgs);
	}

}
