Exemple #1
0
        public YSearchResultCollection SearchWeb(String query, int offset, int limit, ref OmukSemantics semantics)
        {
            //semantics = new OmukSemantics();
            YSearchResultCollection resultCollection = new YSearchResultCollection();

            ysearchresponse ysearchResponse= this.ProcessRequest(query, offset, limit);
            resultCollection.NextPageUrl = ysearchResponse.nextpage;
            foreach (ysearchresponseResultset_webResult webResult in ysearchResponse.resultset_web.result)
            {
                resultCollection.SearchResult.Add(new YSearchItem()
                                                    {
                                                        AbstractText = webResult.@abstract,
                                                        Title = webResult.title,
                                                        UrlField = webResult.url
                                                    });
                semantics.ProcessContext(webResult.title, webResult.url, webResult.@abstract);
            }

            if (offset == 0)
            {
                if (semantics.Category.Equals("movie"))
                {
                    ysearchResponse = this.ProcessRequest(query + " rottentomatoes", 0, 4);
                    foreach (ysearchresponseResultset_webResult webResult in ysearchResponse.resultset_web.result)
                    {
                        if (webResult.url.StartsWith("http://www.rottentomatoes.com/m") || webResult.url.StartsWith("http://rottentomatoes.com/m"))
                        {
                            resultCollection.SearchResult.Insert(1, (new YSearchItem()
                            {
                                AbstractText = webResult.@abstract,
                                Title = webResult.title,
                                UrlField = webResult.url
                            }));
                        }
                    }
                }

            }

            return resultCollection;
        }
Exemple #2
0
        public YSearchResultCollection SearchWeb(String query, int offset, int limit, ref OmukSemantics semantics)
        {
            //semantics = new OmukSemantics();
            YSearchResultCollection resultCollection = new YSearchResultCollection();

            ysearchresponse ysearchResponse = this.ProcessRequest(query, offset, limit);

            resultCollection.NextPageUrl = ysearchResponse.nextpage;
            foreach (ysearchresponseResultset_webResult webResult in ysearchResponse.resultset_web.result)
            {
                resultCollection.SearchResult.Add(new YSearchItem()
                {
                    AbstractText = webResult.@abstract,
                    Title        = webResult.title,
                    UrlField     = webResult.url
                });
                semantics.ProcessContext(webResult.title, webResult.url, webResult.@abstract);
            }

            if (offset == 0)
            {
                if (semantics.Category.Equals("movie"))
                {
                    ysearchResponse = this.ProcessRequest(query + " rottentomatoes", 0, 4);
                    foreach (ysearchresponseResultset_webResult webResult in ysearchResponse.resultset_web.result)
                    {
                        if (webResult.url.StartsWith("http://www.rottentomatoes.com/m") || webResult.url.StartsWith("http://rottentomatoes.com/m"))
                        {
                            resultCollection.SearchResult.Insert(1, (new YSearchItem()
                            {
                                AbstractText = webResult.@abstract,
                                Title = webResult.title,
                                UrlField = webResult.url
                            }));
                        }
                    }
                }
            }

            return(resultCollection);
        }