private 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("開始時間: " + Calendar.getInstance().getTime() + "\r\n");
			fwHistory.write("開始時間: " + Calendar.getInstance().getTime() + "\r\n");
		} catch (IOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}

		String url = "";
		lastTime = Calendar.getInstance().getTimeInMillis();
		while(!this.spiderEngine.getUnsearchList().isEmpty()){
			url = this.spiderEngine.peekUnsearchQueue().getUrl();
			try {
				if (!this.spiderEngine.isSearched(url)) {
					WebPage srb = processHtml(url);
					fw.write(srb.getText().toString());
					fwHistory.write(url + "\r\n");
					srb = null;
					url = null;
					count++;
					if(count % 50 == 0){
						System.gc();
						System.out.println("GC:"+count);
					}
					
					if (count % 100 == 0) {
						fwHistory.write("需解析的鏈結列表: " + this.spiderEngine.getUnsearchList().size() + "\r\n");
						fwHistory.write("已經被搜索站點列表: " + this.spiderEngine.getSearchedSites().size() + "\r\n");
						long crossTime = Calendar.getInstance().getTimeInMillis() - lastTime;
						fwHistory.write("此回搜尋用了: " + crossTime + "毫秒("+ getRightNowTimeStr("-", ":", "_") + ")\r\n");
						lastTime = Calendar.getInstance().getTimeInMillis();
						//
						//System.gc();
						//
						System.out.println("需解析的鏈結列表: " + this.spiderEngine.getUnsearchList().size());
						System.out.println("已經被搜索站點列表: " + this.spiderEngine.getSearchedSites().size());
						System.out.println("此回搜尋用了: " + crossTime);
						System.out.println(count);
					}
					if (count % 1000 == 0) {
						count = 0;
						fw.close();
						fw = null;
						file = null;
						file = new java.io.File(createFileName() + ".html.txt");
						fw = new FileWriter(file);
						System.out.println(count);
					}
				}

			} catch (Exception ex) {

			}
		}
	}