#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/basic/BasConst_OPENTREP_Service.hpp>
#include <opentrep/Location.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 francicso rio de janero lso angles 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 &ioSQLiteDBFilepath, std::string &ioLogFilename, unsigned short &ioSearchType) |
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 21 of file opentrep-searcher.cpp.
const std::string K_OPENTREP_DEFAULT_LOG_FILENAME | ( | "opentrep-searcher.log" | ) |
Default name and location for the log file.
Referenced by readConfiguration().
const std::string K_OPENTREP_DEFAULT_QUERY_STRING | ( | "sna francicso rio de janero lso angles 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 52 of file opentrep-searcher.cpp.
Referenced by readConfiguration().
std::string createStringFromWordList | ( | const WordList_T & | iWordList | ) |
Definition at line 73 of file opentrep-searcher.cpp.
Referenced by readConfiguration().
std::ostream& operator<< | ( | std::ostream & | os, |
const std::vector< T > & | v | ||
) |
Definition at line 92 of file opentrep-searcher.cpp.
int readConfiguration | ( | int | argc, |
char * | argv[], | ||
unsigned short & | ioSpellingErrorDistance, | ||
std::string & | ioQueryString, | ||
std::string & | ioXapianDBFilepath, | ||
std::string & | ioSQLiteDBFilepath, | ||
std::string & | ioLogFilename, | ||
unsigned short & | ioSearchType | ||
) |
Read and parse the command line options.
Definition at line 102 of file opentrep-searcher.cpp.
References createStringFromWordList(), 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, and tokeniseStringIntoWordList().
Referenced by main().
std::string parseQuery | ( | OPENTREP::OPENTREP_Service & | ioOpentrepService, |
const OPENTREP::TravelQuery_T & | iTravelQuery | ||
) |
Helper function
Definition at line 226 of file opentrep-searcher.cpp.
References OPENTREP::OPENTREP_Service::interpretTravelRequest().
Referenced by main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 268 of file opentrep-searcher.cpp.
References 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 43 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 48 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 99 of file opentrep-searcher.cpp.
Referenced by main(), and readConfiguration().