Examples of GoogleSearchService


Examples of com.googlecode.mashups.services.google.api.GoogleSearchService

                writer.writeAttribute(ComponentConstants.ID_ATTRIBUTE, googleSearchList.getClientId(context),
                                      ComponentConstants.ID_ATTRIBUTE);

                // get the component attributes.
                List<ServiceParameter> parameters          = new ArrayList<ServiceParameter>();
                GoogleSearchService    googleSearchService = GoogleServicesFactory.getGoogleSearchService();

                parameters.add(new ServiceParameter(GoogleSearchServiceParameters.VERSION, "1.0"));
                parameters.add(new ServiceParameter(GoogleSearchServiceParameters.QUERY, googleSearchList.getSearchQuery()));

                parameters.add(new ServiceParameter(GoogleSearchServiceParameters.START, googleSearchList.getStartResultIndex().toString()));
                parameters.add(new ServiceParameter(GoogleSearchServiceParameters.RSZ, googleSearchList.getResultSetSize()));
                parameters.add(new ServiceParameter(GoogleSearchServiceParameters.HL, googleSearchList.getHostLanguage()));

                if (googleSearchList.getKey() != null) {
                    parameters.add(new ServiceParameter(GoogleSearchServiceParameters.KEY, googleSearchList.getKey()));
                }

                // perform the actual video search on youTube.
                List<GoogleSearchResultItem> googleSearchResults = googleSearchService.getWebSearchResultList(parameters);

                // encode results .
                UIComponent itemFacet = googleSearchList.getFacet(GOOGLE_RESULT_ITEM);

                if (itemFacet == null) {
View Full Code Here

Examples of com.googlecode.mashups.services.google.api.GoogleSearchService

import com.googlecode.mashups.services.google.api.GoogleSearchServiceParameters;

public class GoogleSearchServiceTest extends TestCase {
    public void testGetWebSearchResults() throws Exception {
        List<ServiceParameter> parameters           = new ArrayList<ServiceParameter>();    
        GoogleSearchService    googleSearchService  = GoogleServicesFactory.getGoogleSearchService();
      
        parameters.add(new ServiceParameter(GoogleSearchServiceParameters.VERSION, "1.0"));     
        parameters.add(new ServiceParameter(GoogleSearchServiceParameters.RSZ, "large"));
        parameters.add(new ServiceParameter(GoogleSearchServiceParameters.QUERY, "Egypt Algeria"));       
        
        try {
            List<GoogleSearchResultItem> webSearchResults = googleSearchService.getWebSearchResultList(parameters);
           
            for (GoogleSearchResultItem searchItem : webSearchResults) {
                System.out.println("Web news: " + searchItem);
            }
           
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.