[Opentrep-svn] SF.net SVN: opentrep:[213] trunk/opentrep
Status: Beta
Brought to you by:
denis_arnaud
From: <den...@us...> - 2010-03-06 15:00:56
|
Revision: 213 http://opentrep.svn.sourceforge.net/opentrep/?rev=213&view=rev Author: denis_arnaud Date: 2010-03-06 15:00:49 +0000 (Sat, 06 Mar 2010) Log Message: ----------- [Python] Added a finalize() method. [DB] Gave more weight to Houston and Dallas. Modified Paths: -------------- trunk/opentrep/db/data/ref_place_names.csv trunk/opentrep/opentrep/batches/opentrep_indexer.cfg trunk/opentrep/opentrep/batches/opentrep_searcher.cfg trunk/opentrep/opentrep/python/pyopentrep.cpp trunk/opentrep/opentrep/python/pyopentrep.py Modified: trunk/opentrep/db/data/ref_place_names.csv =================================================================== --- trunk/opentrep/db/data/ref_place_names.csv 2010-01-23 13:49:16 UTC (rev 212) +++ trunk/opentrep/db/data/ref_place_names.csv 2010-03-06 15:00:49 UTC (rev 213) @@ -1808,7 +1808,7 @@ en,dez,deirezzor,deirezzor/sy:al en,dfi,defiance,defiance/oh/us:memorial en,dfp,drumduff,drumduff/ql/au -en,dfw,dallas fort worth,dallas/tx/us:dallas ft worth +en,dfw,dallas fort worth,dallas/tx/us:dallas ft worth,dallas,dallas en,dga,dangriga,dangriga/bz en,dgb,danger bay,danger bay/ak/us en,dgc,degahbur,degahbur/et @@ -3114,7 +3114,7 @@ en,hor,horta,horta/pt en,hos,chos malal oscar,chos malal/ne/ar:oscar reguera en,hot,hot springs,hot springs/ar/us:memorial fld -en,hou,houston hou,houston/tx/us:hobby +en,hou,houston,houston/tx/us:hobby,houston,houston en,hov,orsta volda,orsta volda/no:hovden en,how,fort kobbe,fort kobbe/pa:howard afb,air force base en,hox,homalin,homalin/mm @@ -5925,7 +5925,7 @@ en,ora,oran,oran/sa/ar en,orb,orebro airport,orebro/se:orebro airport en,orc,orocue,orocue/co -en,ord,chicago ord,chicago/il/us:o'hare intl +en,ord,chicago ord,chicago/il/us:o'hare intl,ord,ohare en,ore,orleans,orleans/fr en,orf,norfolk intl,norfolk/va/us:norfolk intl en,org,paramaribo org,paramaribo/sr:zorg en hoop Modified: trunk/opentrep/opentrep/batches/opentrep_indexer.cfg =================================================================== --- trunk/opentrep/opentrep/batches/opentrep_indexer.cfg 2010-01-23 13:49:16 UTC (rev 212) +++ trunk/opentrep/opentrep/batches/opentrep_indexer.cfg 2010-03-06 15:00:49 UTC (rev 213) @@ -1,4 +1,4 @@ -database=../../test/traveldb +database=/home/sim/deliveries/opentrep-99.99.99/share/opentrep/traveldb log=opentrep_indexer.log user=opentrep passwd=opentrep Modified: trunk/opentrep/opentrep/batches/opentrep_searcher.cfg =================================================================== --- trunk/opentrep/opentrep/batches/opentrep_searcher.cfg 2010-01-23 13:49:16 UTC (rev 212) +++ trunk/opentrep/opentrep/batches/opentrep_searcher.cfg 2010-03-06 15:00:49 UTC (rev 213) @@ -1,4 +1,4 @@ -database=../../test/traveldb +database=/home/sim/deliveries/opentrep-99.99.99/share/opentrep/traveldb log=opentrep_searcher.log user=opentrep passwd=opentrep Modified: trunk/opentrep/opentrep/python/pyopentrep.cpp =================================================================== --- trunk/opentrep/opentrep/python/pyopentrep.cpp 2010-01-23 13:49:16 UTC (rev 212) +++ trunk/opentrep/opentrep/python/pyopentrep.cpp 2010-03-06 15:00:49 UTC (rev 213) @@ -247,6 +247,31 @@ return isEverythingOK; } + /** Wrapper around the search use case. */ + bool finalize () { + bool isEverythingOK = true; + + try { + + // Finalize the context + if (_opentrepService != NULL) { + delete _opentrepService; _opentrepService = NULL; + } + + // Close the output stream + if (_logOutputStream != NULL) { + // DEBUG + *_logOutputStream << "Python wrapper finalization" << std::endl; + _logOutputStream->close(); + delete _logOutputStream; _logOutputStream = NULL; + } + + } catch (...) { + } + + return isEverythingOK; + } + private: /** Handle on the OpenTREP services (API). */ OPENTREP_Service* _opentrepService; @@ -260,5 +285,6 @@ boost::python::class_<OPENTREP::OpenTrepSearcher> ("OpenTrepSearcher") .def ("search", &OPENTREP::OpenTrepSearcher::search) .def ("searchWithFullDetails", &OPENTREP::OpenTrepSearcher::searchWithFullDetails) - .def ("init", &OPENTREP::OpenTrepSearcher::init); + .def ("init", &OPENTREP::OpenTrepSearcher::init) + .def ("finalize", &OPENTREP::OpenTrepSearcher::finalize); } Modified: trunk/opentrep/opentrep/python/pyopentrep.py =================================================================== --- trunk/opentrep/opentrep/python/pyopentrep.py 2010-01-23 13:49:16 UTC (rev 212) +++ trunk/opentrep/opentrep/python/pyopentrep.py 2010-03-06 15:00:49 UTC (rev 213) @@ -52,7 +52,7 @@ # Initialise the OpenTrep C++ library import libpyopentrep openTrepLibrary = libpyopentrep.OpenTrepSearcher() -openTrepLibrary.init('../../test/traveldb', 'pyopentrep.log', 'opentrep', 'opentrep', 'localhost', '3306', 'trep_opentrep') +openTrepLibrary.init('/home/sim/deliveries/opentrep-99.99.99/share/opentrep/traveldb', 'pyopentrep.log', 'opentrep', 'opentrep', 'localhost', '3306', 'trep_opentrep') # If no search string was supplied as arguments of the command-line, # ask the user for some @@ -126,3 +126,7 @@ #print "Locations:" #print locations + +# Free the OpenTREP library resource +openTrepLibrary.finalize() + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |