Interface for the OPENTREP Services. More...
#include <opentrep/OPENTREP_Service.hpp>
Public Types | |
typedef std::pair< const TravelDBFilePath_T, const SQLiteDBFilePath_T > | DBFilePathPair_T |
typedef std::pair< const PORFilePath_T, const DBFilePathPair_T > | FilePathSet_T |
Public Member Functions | |
NbOfDBEntries_T | getIndexSize () |
NbOfMatches_T | drawRandomLocations (const NbOfMatches_T &iNbOfDraws, LocationList_T &) |
NbOfDBEntries_T | buildSQLDB () |
NbOfDBEntries_T | buildSearchIndex () |
NbOfMatches_T | interpretTravelRequest (const std::string &iTravelQuery, LocationList_T &, WordList_T &) |
FilePathSet_T | getFilePaths () const |
OPENTREP_Service (std::ostream &ioLogStream, const TravelDBFilePath_T &, const SQLiteDBFilePath_T &) | |
OPENTREP_Service (std::ostream &ioLogStream, const PORFilePath_T &, const TravelDBFilePath_T &, const SQLiteDBFilePath_T &) | |
~OPENTREP_Service () | |
Interface for the OPENTREP Services.
Definition at line 24 of file OPENTREP_Service.hpp.
typedef std::pair<const TravelDBFilePath_T, const SQLiteDBFilePath_T> OPENTREP::OPENTREP_Service::DBFilePathPair_T |
Get the file-paths of the Xapian database/index and of the ORI-maintained POR (points of reference).
Definition at line 90 of file OPENTREP_Service.hpp.
typedef std::pair<const PORFilePath_T, const DBFilePathPair_T> OPENTREP::OPENTREP_Service::FilePathSet_T |
Definition at line 91 of file OPENTREP_Service.hpp.
OPENTREP::OPENTREP_Service::OPENTREP_Service | ( | std::ostream & | ioLogStream, |
const TravelDBFilePath_T & | iTravelDBFilePath, | ||
const SQLiteDBFilePath_T & | iSQLiteDBFilePath | ||
) |
Constructor.
std::ostream& | Output log stream (for instance, std::cout). |
const | TravelDBFilePath_T& File-path of the Xapian index/database. |
const | SQLiteDBFilePath_T& File-path of the SQLite3 database. |
Definition at line 37 of file OPENTREP_Service.cpp.
OPENTREP::OPENTREP_Service::OPENTREP_Service | ( | std::ostream & | ioLogStream, |
const PORFilePath_T & | iPORFilepath, | ||
const TravelDBFilePath_T & | iTravelDBFilePath, | ||
const SQLiteDBFilePath_T & | iSQLiteDBFilePath | ||
) |
Constructor.
std::ostream& | Output log stream (for instance, std::cout). |
const | PORFilePath_T& File-path of the file of POR (points of reference). |
const | TravelDBFilePath_T& File-path of the Xapian index/database. |
const | SQLiteDBFilePath_T& File-path of the SQLite3 database. |
Definition at line 28 of file OPENTREP_Service.cpp.
OPENTREP::OPENTREP_Service::~OPENTREP_Service | ( | ) |
Destructor.
Definition at line 55 of file OPENTREP_Service.cpp.
NbOfDBEntries_T OPENTREP::OPENTREP_Service::getIndexSize | ( | ) |
Get the number of documents within the Xapian database (index).
Definition at line 132 of file OPENTREP_Service.cpp.
References OPENTREP::OPENTREP_ServiceContext::display(), OPENTREP::BasChronometer::elapsed(), OPENTREP::OPENTREP_ServiceContext::getTravelDBFilePath(), OPENTREP_LOG_DEBUG, and OPENTREP::BasChronometer::start().
NbOfMatches_T OPENTREP::OPENTREP_Service::drawRandomLocations | ( | const NbOfMatches_T & | iNbOfDraws, |
LocationList_T & | ioLocationList | ||
) |
Return a given number of locations, all randomly draw from the Xapian database (index).
LocationList_T& | List of (geographical) locations randomly picked up from the Xapian database. |
Definition at line 161 of file OPENTREP_Service.cpp.
References OPENTREP::OPENTREP_ServiceContext::display(), OPENTREP::BasChronometer::elapsed(), OPENTREP::OPENTREP_ServiceContext::getTravelDBFilePath(), OPENTREP_LOG_DEBUG, and OPENTREP::BasChronometer::start().
NbOfDBEntries_T OPENTREP::OPENTREP_Service::buildSQLDB | ( | ) |
Build the SQL database from the file with the ORI-maintained list of POR (points of reference).
Definition at line 192 of file OPENTREP_Service.cpp.
References OPENTREP::DBManager::buildSQLDB(), OPENTREP::OPENTREP_ServiceContext::display(), OPENTREP::BasChronometer::elapsed(), OPENTREP::OPENTREP_ServiceContext::getPORFilePath(), OPENTREP::OPENTREP_ServiceContext::getSQLiteDBFilePath(), OPENTREP_LOG_DEBUG, and OPENTREP::BasChronometer::start().
Referenced by main().
NbOfDBEntries_T OPENTREP::OPENTREP_Service::buildSearchIndex | ( | ) |
Build the Xapian database (index) from the file with the ORI-maintained list of POR (points of reference).
Definition at line 223 of file OPENTREP_Service.cpp.
References OPENTREP::OPENTREP_ServiceContext::display(), OPENTREP::BasChronometer::elapsed(), OPENTREP::OPENTREP_ServiceContext::getPORFilePath(), OPENTREP::OPENTREP_ServiceContext::getTransliterator(), OPENTREP::OPENTREP_ServiceContext::getTravelDBFilePath(), OPENTREP_LOG_DEBUG, and OPENTREP::BasChronometer::start().
Referenced by main().
NbOfMatches_T OPENTREP::OPENTREP_Service::interpretTravelRequest | ( | const std::string & | iTravelQuery, |
LocationList_T & | ioLocationList, | ||
WordList_T & | ioWordList | ||
) |
Match the given string, thanks to a full-text search on the underlying Xapian index (named "database").
const | std::string& (Travel-related) query string (e.g., "sna francicso rio de janero lso angles reykyavki nce iev mow"). |
LocationList_T& | List of (geographical) locations, if any, matching the given query string. |
WordList_T& | List of non-matched words of the query string. |
Definition at line 263 of file OPENTREP_Service.cpp.
References OPENTREP::OPENTREP_ServiceContext::display(), OPENTREP::BasChronometer::elapsed(), OPENTREP::OPENTREP_ServiceContext::getTravelDBFilePath(), OPENTREP_LOG_DEBUG, OPENTREP_LOG_ERROR, and OPENTREP::BasChronometer::start().
Referenced by parseQuery().
OPENTREP_Service::FilePathSet_T OPENTREP::OPENTREP_Service::getFilePaths | ( | ) | const |
Definition at line 107 of file OPENTREP_Service.cpp.
References OPENTREP::OPENTREP_ServiceContext::getPORFilePath(), OPENTREP::OPENTREP_ServiceContext::getSQLiteDBFilePath(), and OPENTREP::OPENTREP_ServiceContext::getTravelDBFilePath().