OpenTREP Logo  0.6.0
C++ Open Travel Request Parsing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
opentrep-searcher.cpp File Reference
#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 Documentation

typedef std::vector<std::string> WordList_T

Definition at line 21 of file opentrep-searcher.cpp.

Function Documentation

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().

template<class T >
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 
)
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[] 
)

Variable Documentation

const unsigned short K_OPENTREP_DEFAULT_SEARCH_TYPE = 0

Default type for the search request.

  • 0 = Full text
  • 1 = Coordinates

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().