Changeset 1885
- Timestamp:
- Apr 29, 2009, 12:41:17 PM (17 years ago)
- File:
-
- 1 edited
-
ZopeOCRFulltextSearch.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ZopeOCRFulltextSearch.py
r1877 r1885 16 16 import time 17 17 import Ft 18 import types 18 19 19 20 TEXTERPATH="http://nausikaa2.mpiwg-berlin.mpg.de/digitallibrary/servlet/Texter?" # Url of the text servlet … … 77 78 78 79 doc = amara.parse(resultXML.encode('utf-8')) 80 logging.debug(doc.xml()) 79 81 resultsList = doc.searchresult.results 80 82 #logging.error("XXX:"+repr(resultsList)) … … 124 126 logging.debug(serverUrl) 125 127 pr=xmlrpclib.ServerProxy(serverUrl) 126 128 127 129 return pr 128 130 … … 247 249 248 250 249 def searchShortThread(self,string,exactSearch="no",nopages=False,SESSION=None,showpages='',mdstring="" ):251 def searchShortThread(self,string,exactSearch="no",nopages=False,SESSION=None,showpages='',mdstring="",languages=[]): 250 252 """search for the string, a thread is started on the server, requests not for a full xml-file but for 251 253 a short form, where the results are transmitted as a text file (i.e. string representation of java hashmap) … … 261 263 262 264 #only letters are allowed 265 if type(languages) is not types.ListType: 266 languages=[languages] 267 263 268 if (not (showpages == '')) and SESSION and SESSION.has_key("sresult"): 264 269 ret = SESSION["sresult"] … … 291 296 logging.debug(self.searchMethod) 292 297 if mdstring=="": 293 ticket= getattr(pr,searchMethod).searchShortThreaded(string,self.indexName )298 ticket= getattr(pr,searchMethod).searchShortThreaded(string,self.indexName,languages) 294 299 else: 295 ticket= getattr(pr,searchMethod).searchShortMDThreaded(string,mdstring,self.indexName) 300 logging.debug("langs:"+repr(languages)) 301 ticket= getattr(pr,searchMethod).searchShortMDThreaded(string,mdstring,self.indexName,languages) 296 302 #logging.debug(resultXML) 297 303 … … 299 305 return False,ticket,"","" 300 306 301 def getSearchShortThread(self,ticket,SESSION=None,nopages=False,showpages='' ):307 def getSearchShortThread(self,ticket,SESSION=None,nopages=False,showpages='',languages=[]): 302 308 """ 303 309 @param nopages: if true page numbers are not displayed … … 337 343 return True,ret,numberOfPages,dcMD 338 344 345 def getSupportedLanguages(self): 346 pr = self.getServerProxy(); 347 348 socket.setdefaulttimeout(30) 349 searchMethod=getattr(self,"searchMethod","OCRFulltextSearchXML") 350 351 res= getattr(pr,searchMethod).getSupportedLanguages() 352 353 logging.debug("languages:"+repr(res)) 354 return res 355 339 356 def searchShort(self,string,exactSearch="no",nopages=False,SESSION=None,showpages=''): 340 357
Note: See TracChangeset
for help on using the changeset viewer.