protected void search(String fileName){
		File file = new java.io.File(fileName + ".html.txt");
		File fileHistory = new java.io.File(fileName + ".history.txt");
		FileWriter fw = null;
		FileWriter fwHistory = null;
		try {
			fw = new FileWriter(file);
			fwHistory = new FileWriter(fileHistory);
			fw.write("Start: " + Calendar.getInstance().getTime() + "\r\n");
			fwHistory.write("Stop: " + Calendar.getInstance().getTime() + "\r\n");
		} catch (IOException e1) {
			log.error("Write file error: " + e1.getMessage());
		}

		lastTime = Calendar.getInstance().getTimeInMillis();
		while(!cobweb.getUnsearchQueue().isEmpty()){
			final WebPage srb = cobweb.peekUnsearchQueue();// 查找列隊
			try {
				if (!cobweb.isSearched(srb.getUrl())) {
					// 儲存 html code
					
					// 儲存歷史紀錄
					fwHistory.write(srb.getUrl() + "\r\n");
					// 抓出此頁面內的超連結
					if(srb.getDepth() <= getMaxSpyDepth()){
						WebPage tmpSrb = processHtml(srb.getUrl(), srb.getDepth());
						fw.write("<page_html_code url=\"" + srb.getUrl()+"\" level=\""+srb.getDepth() + "\">");
						fw.write(tmpSrb.getHtmlCode());
//						fw.write(engine.Parser.toPureHtml(srb));
						fw.write("</page_html_code>\r\n");
						tmpSrb = null;
					}
					
//					Thread.sleep(30000);
					
					count++;
					if(count % 50 == 0){
						System.gc();
					}
					if (count % 100 == 0) {
						fwHistory.write("Unsearch web links count: " + this.cobweb.getUnsearchList().size() + "\r\n");
						fwHistory.write("Searched web links count: " + this.cobweb.getSearchedSites().size() + "\r\n");
						long crossTime = Calendar.getInstance().getTimeInMillis() - lastTime;
						fwHistory.write("100 fetch page waste time: " + crossTime + "毫秒("+ getRightNowTimeStr("-", ":", "_") + ")\r\n");
						lastTime = Calendar.getInstance().getTimeInMillis();
						System.gc();
					}
					if (count % 1000 == 0) {
						count = 0;
						fw.close();
						fw = null;
						file = null;
						file = new java.io.File(createFileName() + ".html.txt");
						fw = new FileWriter(file);
					}
				}

			
			} catch (Exception ex) {

			}
		}
		
		// Jobs finished, close files.
		try {
			fw.write("結束時間: " + Calendar.getInstance().getTime() + "\r\n");
			fwHistory.write("結束時間: " + Calendar.getInstance().getTime() + "\r\n");
			fw.close();
			fwHistory.close();
		} catch (IOException e) {
			log.error("Jobs finished, close files failed: " + e.getMessage());
		}
		
	}