- Timestamp:
- 2009-08-17T10:24:54+12:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
greenstone3/trunk/src/java/org/greenstone/gsdl3/service/GoogleSearch.java.tmp
r11228 r20294 32 32 import java.lang.Object; 33 33 34 import org.apache.log4j.*; 34 35 35 36 /** … … 42 43 extends AbstractSearch { 43 44 45 static Logger logger = Logger.getLogger(org.greenstone.gsdl3.service.GoogleSearch.class.getName()); 46 44 47 //Parameters connect to Proxy Server 45 48 private boolean using_proxy = false; … … 62 65 return false; 63 66 } 64 System.err.println("Configuring GoogleSearch");67 logger.info("Configuring GoogleSearch"); 65 68 Element server_elem = (Element)GSXML.getChildByTagName(info, "googleServer"); 66 69 if (server_elem == null) { 67 System.err.println("GoogleSearch.configure error:no googleServer element found");70 logger.error("no googleServer element found"); 68 71 return false; 69 72 } … … 71 74 client_key = server_elem.getAttribute("key"); 72 75 if (client_key.equals("")) { 73 System.err.println("GoogleSearch.configure error:no client_key for the googleServer element");76 logger.error("no client_key for the googleServer element"); 74 77 return false; 75 78 } … … 86 89 proxy_port = Integer.parseInt(System.getProperty("http.proxyPort").trim()); 87 90 } catch (Exception e) { 88 System.err.println("GoogleSearch.configure error:couldn't get proxy port, defaulting to 80");91 logger.error("couldn't get proxy port, defaulting to 80"); 89 92 proxy_port = 80; 90 93 } … … 127 130 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 128 131 if (param_list == null) { 129 System.err.println("GoogleSearch.processTextQuery Error::TextQuery request had no paramList.");132 logger.error("TextQuery request had no paramList."); 130 133 return result; // Return the empty result 131 134 } … … 137 140 String query = (String) params.get(QUERY_PARAM); 138 141 if (query == null || query.equals("")) { 139 System.err.println("GoogleSearch.processTextQuery Error:TextQuery request had no query string.");142 logger.error("TextQuery request had no query string."); 140 143 return result; // Return the empty result 141 144 } … … 150 153 hits_per_page = Integer.parseInt(((String)params.get(HITS_PER_PAGE_PARAM)).trim()); 151 154 } catch (Exception e) { 152 System.err.println("GoogleSearch.processTextQuery error:couldn't get hits per page param, defaulting to 10");155 logger.error("couldn't get hits per page param, defaulting to 10"); 153 156 hits_per_page = 10; 154 157 } … … 158 161 start_page = Integer.parseInt(((String) params.get(START_PAGE_PARAM)).trim()); 159 162 } catch (Exception e) { 160 System.err.println("GoogleSearch.processTextQuery error:couldn't get start page param, defaulting to 1");163 logger.error("couldn't get start page param, defaulting to 1"); 161 164 start_page = 1; 162 165 } … … 182 185 google_result = search.doSearch(); 183 186 } catch (GoogleSearchFault ex) { 184 System.err.println("GoogleSearch.processTextQuery error:the call to the Google Web APIs failed:" + ex.toString());187 logger.error("the call to the Google Web APIs failed:" + ex.toString()); 185 188 // add the error to the result 186 189 return result;
Note:
See TracChangeset
for help on using the changeset viewer.