public SmartMe.Core.Data.IQueryResultItem Search( SmartMe.Core.Data.InputQuery query )
        {
            SmartMe.Core.Data.SearchEngineResult emptyResult = new SmartMe.Core.Data.SearchEngineResult();
            emptyResult.SearchEngineType = SmartMe.Core.Data.SearchEngineType.Google;
            string url = "http://www.google.cn/search?q=" + HttpUtility.UrlEncode(query.Text, Encoding.UTF8);
            emptyResult.SearchUrl=url;
            if(query == null || query.QueryType!= SmartMe.Core.Data.InputQueryType.Text|| query.Text==null || query.Text=="")
            {
                return emptyResult;
            }

            string html=SmartMe.Web.Crawl.Crawler.Crawl(url,Encoding.UTF8);
            if(html==null || html=="")
            {
                return emptyResult;
            }
            SmartMe.Web.Parse.GoogleParser parser= new SmartMe.Web.Parse.GoogleParser();
            SmartMe.Core.Data.SearchEngineResult result=parser.Parse(html,Encoding.UTF8);
            result.SearchUrl = url;
            return result;
        }
        public SmartMe.Core.Data.IQueryResultItem Search( SmartMe.Core.Data.InputQuery query )
        {
            SmartMe.Core.Data.SearchEngineResult emptyResult = new SmartMe.Core.Data.SearchEngineResult();
            emptyResult.SearchEngineType = SmartMe.Core.Data.SearchEngineType.Baidu;
            string url = "http://www.baidu.com/s?wd=" + HttpUtility.UrlEncode(query.Text, Encoding.GetEncoding("gb2312"));
            emptyResult.SearchUrl=url;
            if (query == null || query.QueryType != SmartMe.Core.Data.InputQueryType.Text || query.Text == null || query.Text == "")
            {
                return emptyResult;
            }

            string html = SmartMe.Web.Crawl.Crawler.Crawl(url, Encoding.GetEncoding("gb2312"));
            if(html==null||html=="")
            {
                return emptyResult;
            }
            SmartMe.Web.Parse.BaiduParser parser = new SmartMe.Web.Parse.BaiduParser();
            SmartMe.Core.Data.SearchEngineResult result=parser.Parse(html, Encoding.GetEncoding("gb2312"));
            result.SearchUrl=url;
            return result;
        }
        public SmartMe.Core.Data.IQueryResultItem Search(SmartMe.Core.Data.InputQuery query)
        {
            SmartMe.Core.Data.SearchEngineResult emptyResult = new SmartMe.Core.Data.SearchEngineResult();
            emptyResult.SearchEngineType = SmartMe.Core.Data.SearchEngineType.Wikipedia;

            string url = "http://en.wikipedia.org/w/index.php?title=Special:Search&search=" + HttpUtility.UrlEncode(query.Text, Encoding.UTF8) + "&fulltext=Search";
            emptyResult.SearchUrl = url;
            if (query == null || query.QueryType != SmartMe.Core.Data.InputQueryType.Text || query.Text == null || query.Text == "")
            {
                return emptyResult;
            }

            string html = SmartMe.Web.Crawl.Crawler.Crawl(url, Encoding.UTF8);
            if (html == null || html == "")
            {
                return emptyResult;
            }
            SmartMe.Web.Parse.WikipediaParser parser = new SmartMe.Web.Parse.WikipediaParser();
            SmartMe.Core.Data.SearchEngineResult result = parser.Parse(html, Encoding.UTF8);
            result.SearchUrl = url;
            return result;
        }
Esempio n. 4
0
        public SmartMe.Core.Data.IQueryResultItem Search(SmartMe.Core.Data.InputQuery query)
        {
            SmartMe.Core.Data.SearchEngineResult emptyResult = new SmartMe.Core.Data.SearchEngineResult();
            emptyResult.SearchEngineType = SmartMe.Core.Data.SearchEngineType.Google;
            string url = "http://www.google.cn/search?q=" + HttpUtility.UrlEncode(query.Text, Encoding.UTF8);

            emptyResult.SearchUrl = url;
            if (query == null || query.QueryType != SmartMe.Core.Data.InputQueryType.Text || query.Text == null || query.Text == "")
            {
                return(emptyResult);
            }

            string html = SmartMe.Web.Crawl.Crawler.Crawl(url, Encoding.UTF8);

            if (html == null || html == "")
            {
                return(emptyResult);
            }
            SmartMe.Web.Parse.GoogleParser       parser = new SmartMe.Web.Parse.GoogleParser();
            SmartMe.Core.Data.SearchEngineResult result = parser.Parse(html, Encoding.UTF8);
            result.SearchUrl = url;
            return(result);
        }
Esempio n. 5
0
        public SmartMe.Core.Data.IQueryResultItem Search(SmartMe.Core.Data.InputQuery query)
        {
            SmartMe.Core.Data.SearchEngineResult emptyResult = new SmartMe.Core.Data.SearchEngineResult();
            emptyResult.SearchEngineType = SmartMe.Core.Data.SearchEngineType.Baidu;
            string url = "http://www.baidu.com/s?wd=" + HttpUtility.UrlEncode(query.Text, Encoding.GetEncoding("gb2312"));

            emptyResult.SearchUrl = url;
            if (query == null || query.QueryType != SmartMe.Core.Data.InputQueryType.Text || query.Text == null || query.Text == "")
            {
                return(emptyResult);
            }

            string html = SmartMe.Web.Crawl.Crawler.Crawl(url, Encoding.GetEncoding("gb2312"));

            if (html == null || html == "")
            {
                return(emptyResult);
            }
            SmartMe.Web.Parse.BaiduParser        parser = new SmartMe.Web.Parse.BaiduParser();
            SmartMe.Core.Data.SearchEngineResult result = parser.Parse(html, Encoding.GetEncoding("gb2312"));
            result.SearchUrl = url;
            return(result);
        }
Esempio n. 6
0
        public SmartMe.Core.Data.IQueryResultItem Search(SmartMe.Core.Data.InputQuery query)
        {
            SmartMe.Core.Data.SearchEngineResult emptyResult = new SmartMe.Core.Data.SearchEngineResult();
            emptyResult.SearchEngineType = SmartMe.Core.Data.SearchEngineType.Wikipedia;

            string url = "http://en.wikipedia.org/w/index.php?title=Special:Search&search=" + HttpUtility.UrlEncode(query.Text, Encoding.UTF8) + "&fulltext=Search";

            emptyResult.SearchUrl = url;
            if (query == null || query.QueryType != SmartMe.Core.Data.InputQueryType.Text || query.Text == null || query.Text == "")
            {
                return(emptyResult);
            }

            string html = SmartMe.Web.Crawl.Crawler.Crawl(url, Encoding.UTF8);

            if (html == null || html == "")
            {
                return(emptyResult);
            }
            SmartMe.Web.Parse.WikipediaParser    parser = new SmartMe.Web.Parse.WikipediaParser();
            SmartMe.Core.Data.SearchEngineResult result = parser.Parse(html, Encoding.UTF8);
            result.SearchUrl = url;
            return(result);
        }