@Override
	public int doQuery(TextArea logText, int maxResultNum, int maxKeywordNum,
			int language, String filename, Token[] keywords, boolean cmdMode) {
		// TODO Auto-generated method stub
		results = new ArrayList<ResultInfo>();
		String querykeywords = "";
		

		int tempcount = count;
		int page = 0;
		for (int i = 1; i <= maxKeywordNum; i++) {
			filename = filename.length() > 0 ? filename + "+" : "";
			int index = (keywords.length - i - (cmdMode ? count : 0))
					% keywords.length;
			querykeywords += keywords[index].getName() + "+";
			tempcount++;
			logText.append("using keywords:\t"
					+ (filename.trim() + querykeywords.trim()).replaceAll(
							"\\+", " ") + "\n");
			queryStr = generateQuery(filename.trim() + querykeywords.trim(),language,page);
					
			//System.out.println(queryStr);
			MyGithubFeed resultFeed = new MyGithubFeed(queryStr);
			int resultNum = resultFeed.getTotalResultsNum();
			logText.append("results from github:\t" + resultNum + "\n");
			if (resultNum < maxResultNum || i == maxKeywordNum) {

				for (int j = 0; j < Math.min(resultNum, maxResultNum); j++) {
					if(j - page * itemPerPage<0)continue;
					ResultInfo resultInfo = new ResultInfo();
					
					GithubEntry se = resultFeed.getGithubEntries().get(
							j - page * itemPerPage);
					resultInfo.url = se.getPath();
					resultInfo.projectName = se.getProjectName();
					resultInfo.pckg = "";
					resultInfo.path = se.getUrl();

					resultInfo.license = "";
					resultInfo.searchEngine = "Github";
					// System.out.println("id:" + resultInfo.pckg);
					results.add(resultInfo);
					logText.append(resultInfo.toString() + "\n");
					if (j - page * itemPerPage == resultFeed.getGithubEntries().size() - 1
							&& j + 1 < Math.min(resultNum, maxResultNum)) {
						queryStr = generateQuery(filename.trim() + querykeywords.trim(),language,++page);
						resultFeed = new MyGithubFeed(queryStr);

					}
				}

				break;
			} else {

				continue;
			}

			// Send the request and receive the response:
		}
		count = tempcount;

		return results.size();
	}