#include <cassert>
#include <iostream>
#include <sstream>
#include <fstream>
#include <vector>
#include <string>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/tokenizer.hpp>
#include <boost/program_options.hpp>
#include <opentrep/OPENTREP_Service.hpp>
#include <opentrep/DBType.hpp>
#include <opentrep/basic/BasConst_OPENTREP_Service.hpp>
#include <opentrep/basic/Utilities.hpp>
#include <opentrep/Location.hpp>
#include <opentrep/CityDetails.hpp>
#include <opentrep/config/opentrep-paths.hpp>
Go to the source code of this file.
Typedefs | |
typedef std::vector< std::string > | WordList_T |
Functions | |
const std::string | K_OPENTREP_DEFAULT_LOG_FILENAME ("opentrep-searcher.log") |
const std::string | K_OPENTREP_DEFAULT_QUERY_STRING ("sna francisco rio de janero los angeles reykyavki") |
void | tokeniseStringIntoWordList (const std::string &iPhrase, WordList_T &ioWordList) |
std::string | createStringFromWordList (const WordList_T &iWordList) |
template<class T> | |
std::ostream & | operator<< (std::ostream &os, const std::vector< T > &v) |
int | readConfiguration (int argc, char *argv[], unsigned short &ioSpellingErrorDistance, std::string &ioQueryString, std::string &ioXapianDBFilepath, std::string &ioSQLDBTypeString, std::string &ioSQLDBConnectionString, unsigned short &ioDeploymentNumber, std::string &ioLogFilename, unsigned short &ioSearchType, std::ostringstream &oStr) |
std::string | parseQuery (OPENTREP::OPENTREP_Service &ioOpentrepService, const OPENTREP::TravelQuery_T &iTravelQuery) |
int | main (int argc, char *argv[]) |
Variables | |
const unsigned short | K_OPENTREP_DEFAULT_SEARCH_TYPE = 0 |
const unsigned short | K_OPENTREP_DEFAULT_SPELLING_ERROR_DISTANCE = 3 |
const int | K_OPENTREP_EARLY_RETURN_STATUS = 99 |
typedef std::vector<std::string> WordList_T |
Definition at line 24 of file opentrep-searcher.cpp.
const std::string K_OPENTREP_DEFAULT_LOG_FILENAME | ( | "opentrep-searcher.log" | ) |
Default name and location for the log file.
const std::string K_OPENTREP_DEFAULT_QUERY_STRING | ( | "sna francisco rio de janero los angeles reykyavki" | ) |
Default travel query string, to be seached against the Xapian database.
Referenced by readConfiguration().
void tokeniseStringIntoWordList | ( | const std::string & | iPhrase, |
WordList_T & | ioWordList ) |
Definition at line 55 of file opentrep-searcher.cpp.
Referenced by OPENTREP::Place::addNameToXapianSets(), and readConfiguration().
std::string createStringFromWordList | ( | const WordList_T & | iWordList | ) |
Definition at line 76 of file opentrep-searcher.cpp.
Referenced by OPENTREP::Place::addNameToXapianSets(), and readConfiguration().
std::ostream & operator<< | ( | std::ostream & | os, |
const std::vector< T > & | v ) |
Definition at line 95 of file opentrep-searcher.cpp.
int readConfiguration | ( | int | argc, |
char * | argv[], | ||
unsigned short & | ioSpellingErrorDistance, | ||
std::string & | ioQueryString, | ||
std::string & | ioXapianDBFilepath, | ||
std::string & | ioSQLDBTypeString, | ||
std::string & | ioSQLDBConnectionString, | ||
unsigned short & | ioDeploymentNumber, | ||
std::string & | ioLogFilename, | ||
unsigned short & | ioSearchType, | ||
std::ostringstream & | oStr ) |
Read and parse the command line options.
Definition at line 105 of file opentrep-searcher.cpp.
References createStringFromWordList(), OPENTREP::DEFAULT_OPENTREP_DEPLOYMENT_NUMBER, OPENTREP::DEFAULT_OPENTREP_MYSQL_CONN_STRING, OPENTREP::DEFAULT_OPENTREP_SQL_DB_TYPE, OPENTREP::DEFAULT_OPENTREP_SQLITE_DB_FILEPATH, OPENTREP::DEFAULT_OPENTREP_XAPIAN_DB_FILEPATH, K_OPENTREP_DEFAULT_LOG_FILENAME(), K_OPENTREP_DEFAULT_QUERY_STRING(), K_OPENTREP_DEFAULT_SEARCH_TYPE, K_OPENTREP_DEFAULT_SPELLING_ERROR_DISTANCE, K_OPENTREP_EARLY_RETURN_STATUS, OPENTREP::DBType::MYSQL, OPENTREP::DBType::NODB, OPENTREP::parseAndDisplayConnectionString(), OPENTREP::DBType::SQLITE3, and tokeniseStringIntoWordList().
Referenced by main().
std::string parseQuery | ( | OPENTREP::OPENTREP_Service & | ioOpentrepService, |
const OPENTREP::TravelQuery_T & | iTravelQuery ) |
Helper function
Definition at line 274 of file opentrep-searcher.cpp.
References OPENTREP::OPENTREP_Service::interpretTravelRequest().
Referenced by main().
int main | ( | int | argc, |
char * | argv[] ) |
Definition at line 316 of file opentrep-searcher.cpp.
References OPENTREP::OPENTREP_Service::checkXapianDBOnFileSystem(), OPENTREP::OPENTREP_Service::getFilePaths(), K_OPENTREP_EARLY_RETURN_STATUS, parseQuery(), and readConfiguration().
const unsigned short K_OPENTREP_DEFAULT_SEARCH_TYPE = 0 |
Default type for the search request.
Definition at line 46 of file opentrep-searcher.cpp.
Referenced by readConfiguration().
const unsigned short K_OPENTREP_DEFAULT_SPELLING_ERROR_DISTANCE = 3 |
Default error distance for spelling corrections.
Definition at line 51 of file opentrep-searcher.cpp.
Referenced by readConfiguration().
const int K_OPENTREP_EARLY_RETURN_STATUS = 99 |
Early return status (so that it can be differentiated from an error).
Definition at line 102 of file opentrep-searcher.cpp.