OpenTREP Logo  0.07.18
C++ Open Travel Request Parsing Library
Loading...
Searching...
No Matches
OPENTREP Namespace Reference

Namespaces

namespace  LOG
 
namespace  PorParserHelper
 

Classes

struct  Admin1ASCIIName_T
 
struct  Admin1Code_T
 
struct  Admin1UTFName_T
 
struct  Admin2ASCIIName_T
 
struct  Admin2Code_T
 
struct  Admin2UTFName_T
 
struct  Admin3Code_T
 
struct  Admin4Code_T
 
struct  AltCountryCode_T
 
struct  AltNameShortListString_T
 
struct  ASCIIName_T
 
struct  BasChronometer
 Structure allowing measuring the time elapsed between two events. More...
 
struct  BasFileMgr
 Helper class for operations on files and on the file-system. More...
 
class  BomAbstract
 Base class for the Business Object Model (BOM) layer. More...
 
class  BomJSONExport
 Utility class to export Opentrep structures in a JSON format. More...
 
struct  BomType
 
class  BuildIndexException
 
struct  CityASCIIName_T
 
struct  CityCode_T
 
struct  CityDetails
 Class modelling the elementary details of a city. More...
 
struct  CityListString_T
 
struct  CityUTFName_T
 
class  CodeConversionException
 
class  CodeDuplicationException
 
struct  Comment_T
 
struct  CommonName_T
 
struct  ContinentCode_T
 
struct  ContinentName_T
 
struct  CountryCode_T
 
struct  CountryName_T
 
struct  CurrencyCode_T
 
struct  date_time_element
 
class  DbaAbstract
 
class  DBManager
 Class wrapping the access to an underlying SQL database. More...
 
struct  DBParams
 Structure holding the database parameters. More...
 
class  DBSessionManager
 Class handling the SOCI session. More...
 
struct  DBType
 Enumeration of database types. More...
 
struct  DistanceErrorRule
 
class  DocumentNotFoundException
 
struct  FAACode_T
 
class  FacBomAbstract
 
class  FacOpenTrepServiceContext
 Factory for an OPENTREP_ServiceContext object. More...
 
class  FacPlace
 
class  FacPlaceHolder
 
class  FacResult
 
class  FacResultCombination
 
class  FacResultHolder
 
class  FacServiceAbstract
 
class  FacSupervisor
 
class  FacWorld
 
class  FacXapianDB
 Factory for a Xapian WritableDatabase object. More...
 
struct  FeatureClass_T
 
struct  FeatureCode_T
 
struct  FeatureName_T
 
class  FileException
 
class  FileExtensionUnknownException
 
class  FileManager
 Class wrapping utilities for file-system access. More...
 
class  FileNotFoundException
 
struct  FilePath_T
 
class  FileUncompressingErrorException
 
struct  Filter
 Class filtering out the words not suitable for indexing and/or searching, when part of greater strings. Hence, most of the methods take as parameter the "initial"/greater string. More...
 
struct  IATACode_T
 
struct  IATAType
 Enumeration of place/location types with respect to their use for transportation purposes. More...
 
struct  ICAOCode_T
 
class  IndexBuilder
 Command wrapping the travel request process. More...
 
class  InterpreterUseCaseException
 
class  InterpreteTravelRequestException
 
class  KeyAbstract
 Base class for the Business Object Model (KEY) layer. More...
 
struct  Language
 
struct  LanguageCode_T
 
class  LanguageCodeNotDefinedInNameTableException
 
class  Levenshtein
 
struct  ListGenerator
 
struct  Location
 Structure modelling a (geographical) location. More...
 
class  LocationExchange
 Utility class to export Opentrep structures in a Protobuf format. More...
 
struct  LocationKey
 Class modelling the primary key of a location/POR (point of reference). More...
 
struct  LocationName_T
 
class  Logger
 
class  MemoryAllocationException
 
class  MultipleRowsForASingleDocIDException
 
struct  NameMatrix
 
struct  Names
 
class  NoBestMatchingResultHolderException
 
class  NonInitialisedServiceException
 
class  NumSep
 
class  ObjectNotFoundException
 
struct  OPENTREP_Abstract
 
class  OPENTREP_Service
 Interface for the OPENTREP Services. More...
 
class  OPENTREP_ServiceContext
 Class holding the context of the OpenTrep services. More...
 
struct  OpenTrepSearcher
 API wrapper around the OpenTREP C++ API, so that Python scripts can use it seamlessly. More...
 
class  OTransliterator
 
struct  OutputFormat
 Enumeration of output formats. More...
 
class  ParserException
 
class  Place
 Class modelling a place/POR (point of reference). More...
 
class  PlaceHolder
 
class  PORFileHelper
 Utility class to ease the access to the POR (points of reference) file. More...
 
class  PORFileParser
 
class  PorFileParsingException
 
struct  PORFilePath_T
 
class  PORParser
 
class  PORStringParser
 
class  PRFileParsingException
 
struct  QuerySlices
 
struct  RawDataString_T
 
class  RequestInterpreter
 Command wrapping the travel request process. More...
 
class  Result
 Class wrapping a set of Xapian documents having matched a given query string. More...
 
class  ResultCombination
 Class wrapping functions on a list of ResultHolder objects. More...
 
class  ResultHolder
 Class wrapping functions on a list of Result objects. More...
 
class  RootException
 Root of the OpenTREP exceptions. More...
 
struct  ScoreBoard
 Structure holding a board for all the types of score/matching having been performed. More...
 
struct  ScoreType
 Enumeration of score types. More...
 
class  SerDeException
 
class  ServiceAbstract
 
class  ServiceUtilities
 
struct  short_bool_policies
 
class  SQLDatabaseConnectionReleaseException
 
class  SQLDatabaseConnectionStringParsingException
 
class  SQLDatabaseElementNotFoundException
 
class  SQLDatabaseException
 
class  SQLDatabaseFileCannotBeCreatedException
 
class  SQLDatabaseImpossibleConnectionException
 
class  SQLDatabaseIndexCreationException
 
class  SQLDatabaseTableCreationException
 
class  SQLDatabaseUserCreationException
 
struct  SQLDBConnectionString_T
 
struct  SQLiteDBFilePath_T
 
struct  StateCode_T
 
struct  StringPartition
 
struct  StringSet
 Class holding a set of strings, e.g., {"rio", "de", "janeiro"}. More...
 
struct  StructAbstract
 Base class for the light structures. More...
 
struct  TCLIDCode_T
 
struct  TimeZone_T
 
struct  TravelDBFilePath_T
 
class  TravelRequestEmptyException
 
struct  TvlPORListString_T
 
class  UnicodeException
 
class  UnicodeTransliteratorCreationException
 
struct  UNLOCode_T
 
class  UTF8Handler
 Utility class for basic handling of UTF-8 encoded strings. More...
 
struct  WACName_T
 
struct  WikiLink_T
 
struct  WordCombinationHolder
 
class  WordHolder
 Class wrapping utility functions to transform back and forth strings from and into a list of words. More...
 
class  World
 
class  XapianDatabaseFailureException
 
class  XapianException
 
class  XapianIndexManager
 Command wrapping utilities for the management of the Xapian (database) index. More...
 
class  XapianTravelDatabaseEmptyException
 
class  XapianTravelDatabaseWrongPathnameException
 

Typedefs

typedef std::istreambuf_iterator< char > base_iterator_t
 
typedef boost::spirit::multi_pass< base_iterator_titerator_t
 
typedef boost::spirit::classic::position_iterator2< iterator_tpos_iterator_t
 
typedef boost::spirit::qi::uint_parser< int, 10, 1, 1 > uint1_p_t
 
typedef boost::spirit::qi::uint_parser< int, 10, 2, 2 > uint2_p_t
 
typedef boost::spirit::qi::uint_parser< int, 10, 1, 2 > int1_2_p_t
 
typedef boost::spirit::qi::uint_parser< int, 10, 4, 4 > uint4_p_t
 
typedef boost::spirit::qi::int_parser< int, 10, 1, 5 > int1_5_p_t
 
typedef boost::spirit::qi::int_parser< int, 10, 0, 5 > int0_5_p_t
 
typedef boost::spirit::qi::uint_parser< int, 10, 1, 4 > uint1_4_p_t
 
typedef boost::spirit::qi::uint_parser< int, 10, 1, 9 > uint1_9_p_t
 
typedef boost::spirit::qi::uint_parser< int, 10, 0, 9 > uint0_9_p_t
 
typedef boost::spirit::qi::uint_parser< hour_t, 10, 2, 2 > hour_p_t
 
typedef boost::spirit::qi::uint_parser< minute_t, 10, 2, 2 > minute_p_t
 
typedef boost::spirit::qi::uint_parser< second_t, 10, 2, 2 > second_p_t
 
typedef boost::spirit::qi::uint_parser< year_t, 10, 4, 4 > year_p_t
 
typedef boost::spirit::qi::uint_parser< month_t, 10, 2, 2 > month_p_t
 
typedef boost::spirit::qi::uint_parser< day_t, 10, 2, 2 > day_p_t
 
typedef boost::spirit::qi::bool_parser< bool, short_bool_policiesboolean_p_t
 
typedef long unsigned int u_int32_t
 
typedef std::map< const std::string, std::string > StringMap_T
 
typedef std::pair< BomType::EN_BomType, BomAbstract * > GenericBom_T
 
typedef std::map< std::size_t, GenericBom_TGenericBomList_T
 
typedef std::multimap< std::string, Place * > PlaceList_T
 
typedef std::list< Place * > PlaceOrderedList_T
 
typedef std::pair< Xapian::Document, ScoreBoardXapianDocumentPair_T
 
typedef std::list< XapianDocumentPair_TDocumentList_T
 
typedef std::map< Xapian::docid, XapianDocumentPair_TDocumentMap_T
 
typedef std::list< ResultHolder * > ResultHolderList_T
 
typedef std::list< Result * > ResultList_T
 
typedef std::list< StringPartitionStringPartitionList_T
 
typedef std::size_t WorldID_T
 
typedef std::list< CityDetailsCityDetailsList_T
 A list of cities, for instance the list of cities served by a travel-/transport-related POR (point of reference), such as an airport, a railway/bus station or a ferry/maritime port.
 
typedef std::list< std::string > DBParamsNameList_T
 
typedef std::list< LocationLocationList_T
 
typedef std::list< std::string > NameList_T
 
typedef std::map< LanguageCode_T, NamesNameMatrix_T
 
typedef date_time_element< 0, 23 > hour_t
 
typedef date_time_element< 0, 59 > minute_t
 
typedef date_time_element< 0, 59 > second_t
 
typedef date_time_element< 1900, 2100 > year_t
 
typedef date_time_element< 1, 12 > month_t
 
typedef date_time_element< 1, 31 > day_t
 
typedef unsigned short DeploymentNumber_T
 
typedef bool shouldIndexNonIATAPOR_T
 
typedef bool shouldIndexPORInXapian_T
 
typedef bool shouldAddPORInSQLDB_T
 
typedef std::list< IATACode_TIATACodeList_T
 
typedef std::list< ICAOCode_TICAOCodeList_T
 
typedef unsigned int GeonamesID_T
 
typedef std::list< GeonamesID_TGeonamesIDList_T
 
typedef unsigned int EnvelopeID_T
 
typedef std::list< UNLOCode_TUNLOCodeList_T
 
typedef unsigned int UICCode_T
 
typedef std::list< UICCode_TUICCodeList_T
 
typedef std::list< AltNameShortListString_TAltNameShortList_T
 
typedef unsigned int WAC_T
 
typedef std::list< FeatureName_TFeatureNameList_T
 
typedef double GeoCoord_T
 
typedef GeoCoord_T Latitude_T
 
typedef GeoCoord_T Longitude_T
 
typedef boost::gregorian::date Date_T
 
typedef unsigned int Population_T
 
typedef int Elevation_T
 
typedef int GTopo30_T
 
typedef float GMTOffset_T
 
typedef float DSTOffset_T
 
typedef float RawOffset_T
 
typedef double PageRank_T
 
typedef bool IsGeonames_T
 
typedef bool IsAirport_T
 
typedef bool IsCommercial_T
 
typedef unsigned int XapianDocID_T
 
typedef unsigned short Weight_T
 
typedef std::string TravelQuery_T
 
typedef double MatchingPercentage_T
 
typedef double Percentage_T
 
typedef double Score_T
 
typedef unsigned int NbOfDBEntries_T
 
typedef std::string Word_T
 
typedef std::list< Word_TWordList_T
 
typedef std::set< std::string > WordSet_T
 
typedef std::set< std::string > BlackList_T
 
typedef unsigned int NbOfLetters_T
 
typedef unsigned short NbOfWords_T
 
typedef unsigned short NbOfMatches_T
 
typedef unsigned short NbOfErrors_T
 
typedef std::map< NbOfLetters_T, NbOfErrors_TDistanceErrorScale_T
 
typedef boost::array< NbOfLetters_T, 5 > DistanceErrorScaleArray_T
 

Functions

const std::string DEFAULT_OPENTREP_POR_FILEPATH (OPENTREP_POR_DATA_DIR "/test_optd_por_public.csv")
 
const std::string DEFAULT_OPENTREP_XAPIAN_DB_FILEPATH ("/tmp/opentrep/xapian_traveldb")
 
const bool DEFAULT_OPENTREP_SQLITE_DB_FILLING_INDICATOR (false)
 
const std::string DEFAULT_OPENTREP_SQL_DB_TYPE ("nodb")
 
const std::string DEFAULT_OPENTREP_SQLITE_DB_FILEPATH ("/tmp/opentrep/sqlite_travel.db")
 
const std::string DEFAULT_OPENTREP_MYSQL_DB_USER ("trep")
 
const std::string DEFAULT_OPENTREP_MYSQL_DB_PASSWD ("trep")
 
const std::string DEFAULT_OPENTREP_MYSQL_DB_DBNAME ("trep_trep")
 
const std::string DEFAULT_OPENTREP_MYSQL_DB_HOST ("localhost")
 
const std::string DEFAULT_OPENTREP_MYSQL_DB_PORT ("3306")
 
const unsigned short DEFAULT_OPENTREP_DEPLOYMENT_NUMBER (0)
 
const unsigned short DEFAULT_OPENTREP_DEPLOYMENT_NUMBER_SIZE (2)
 
const bool DEFAULT_OPENTREP_INCLUDE_NONIATA_POR (false)
 
const bool DEFAULT_OPENTREP_INDEX_IN_XAPIAN (true)
 
const bool DEFAULT_OPENTREP_ADD_IN_DB (false)
 
const std::string DEFAULT_DATE_STR ("1970-01-01")
 
const NbOfMatches_T K_DEFAULT_XAPIAN_MATCHING_SET_SIZE (30)
 
const Weight_T K_DEFAULT_INDEXING_STD_WEIGHT (1)
 
const Weight_T K_DEFAULT_INDEXING_EXTRA_WEIGHT (2)
 
const Percentage_T K_DEFAULT_MODIFIED_MATCHING_PCT (100.0)
 
const Percentage_T K_DEFAULT_PAGE_RANK (0.10)
 
const Percentage_T K_DEFAULT_ENVELOPE_PCT (K_DEFAULT_PAGE_RANK)
 
const Percentage_T K_DEFAULT_FULL_CODE_MATCH_PCT (11000/K_DEFAULT_PAGE_RANK)
 
const Percentage_T K_DEFAULT_ATTENUATION_FCTR (850.0)
 
const NbOfErrors_T K_DEFAULT_SIZE_FOR_SPELLING_ERROR_UNIT (4)
 
const NbOfWords_T K_DEFAULT_MAXIMUM_NUMBER_OF_WORDS_IN_STRING (14)
 
bool check (const UErrorCode &iStatus, const char *iMsg)
 
icu::UnicodeString & appendHex (const uint32_t iNumber, int8_t ioDigits, icu::UnicodeString &ioTarget)
 
icu::UnicodeString escape (const icu::UnicodeString &iSource)
 
std::string getUTF8 (const icu::UnicodeString &iString)
 
void tokeniseStringIntoWordList (const std::string &iPhrase, WordList_T &ioWordList)
 
std::string createStringFromWordList (const WordList_T &iWordList, const NbOfWords_T iSplitIdx, const bool iFromBeginningFlag)
 
StringMap_T parseMySQLConnectionString (const SQLDBConnectionString_T &iSQLDBConnStr)
 
SQLDBConnectionString_T buildMySQLConnectionString (const StringMap_T &iStringMap, const DeploymentNumber_T &iDeploymentNumber)
 
std::string displayMySQLConnectionString (const StringMap_T &iStringMap, const DeploymentNumber_T &iDeploymentNumber)
 
std::string parseAndDisplayConnectionString (const DBType &iDBType, const std::string &iSQLDBConnStr, const DeploymentNumber_T &iDeploymentNumber)
 
bool hasGoodSize (const std::string &iWord, const NbOfLetters_T &iMinWordLength)
 
bool isBlackListed (const std::string &iWord)
 
void rtrim (WordList_T &ioWordList, const NbOfLetters_T &iMinWordLength)
 
void ltrim (WordList_T &ioWordList, const NbOfLetters_T &iMinWordLength)
 
void trim (WordList_T &ioWordList, const NbOfLetters_T &iMinWordLength)
 
static unsigned int calculateEditDistance (const TravelQuery_T &iPhrase)
 Helper function.
 
bool doesMatch (const Xapian::Database &iDatabase, const std::string &iWord1, const std::string &iWord2)
 Helper function to query for a Xapian-based full text match.
 
static unsigned int calculateEditDistance (const TravelQuery_T &iPhrase)
 Helper function.
 
static const boost::char_separator< char > AllSepatorList (" .,;:|+-*/_=!@#$%`~^&(){}[]?'<>\"")
 
static const boost::char_separator< char > DocSepatorList (" ,-%")
 
void baseTokeniseStringIntoWordList (const std::string &iPhrase, WordList_T &ioWordList, const boost::char_separator< char > &iSepatorList)
 
void addToXapian (const Place &iPlace, Xapian::Document &ioDocument, Xapian::WritableDatabase &ioDatabase)
 
void addUnmatchedWord (const TravelQuery_T &iQueryString, WordList_T &ioWordList, WordSet_T &ioWordSet)
 
void createPlaces (const ResultCombination &iResultCombination, PlaceHolder &ioPlaceHolder)
 
void searchString (const StringPartition &iStringPartition, const Xapian::Database &iDatabase, ResultCombination &ioResultCombination, WordList_T &ioWordList)
 
void chooseBestMatchingResultHolder (ResultCombination &ioResultCombination)
 
Location getBestMatchingLocation (const LocationList_T &iLocationList)
 
NbOfMatches_T getLocationList (const DBType &iSQLDBType, const SQLDBConnectionString_T &iSQLDBConnStr, const WordList_T &iCodeList, LocationList_T &ioLocationList, WordList_T &ioWordList)
 
boost::filesystem::path checkTravelDBFilePath (const TravelDBFilePath_T &iTravelDBFilePath)
 
template<int MIN, int MAX>
date_time_element< MIN, MAX > operator* (const date_time_element< MIN, MAX > &o1, const date_time_element< MIN, MAX > &o2)
 
template<int MIN, int MAX>
date_time_element< MIN, MAX > operator+ (const date_time_element< MIN, MAX > &o1, const date_time_element< MIN, MAX > &o2)
 
void logInit (const LOG::EN_LogLevel iLogLevel, std::ostream &ioLogOutputFile)
 
SQLDBConnectionString_T getSQLConnStr (const DBType &iSQLDBType, const SQLDBConnectionString_T &iSQLDBConnStr)
 

Variables

const std::tm DEFAULT_DATE_TM
 
const char * K_ICU_ACCENT_REMOVAL_RULE = "NFD; [:M:] Remove; NFC;"
 
const char * K_ICU_QUOTATION_REMOVAL_RULE
 
const char * K_ICU_PUNCTUATION_REMOVAL_RULE = "[:P:] Remove;"
 
const char * K_ICU_GENERIC_TRANSLITERATOR_RULE
 
const BlackList_T K_BLACK_LIST = ListGenerator::createBlackList()
 
const NbOfMatches_T K_DEFAULT_XAPIAN_MATCHING_SET_SIZE
 
const Weight_T K_DEFAULT_INDEXING_STD_WEIGHT
 
const Weight_T K_DEFAULT_INDEXING_EXTRA_WEIGHT
 
const Percentage_T K_DEFAULT_MODIFIED_MATCHING_PCT
 
const Percentage_T K_DEFAULT_PAGE_RANK
 
const Percentage_T K_DEFAULT_ENVELOPE_PCT
 
const Percentage_T K_DEFAULT_FULL_CODE_MATCH_PCT
 
const Percentage_T K_DEFAULT_ATTENUATION_FCTR
 
const NbOfErrors_T K_DEFAULT_SIZE_FOR_SPELLING_ERROR_UNIT
 
const NbOfWords_T K_DEFAULT_MAXIMUM_NUMBER_OF_WORDS_IN_STRING
 
const std::string DEFAULT_DATE_STR
 
const std::string DEFAULT_OPENTREP_POR_FILEPATH
 
const std::string DEFAULT_OPENTREP_XAPIAN_DB_FILEPATH
 
const bool DEFAULT_OPENTREP_SQLITE_DB_FILLING_INDICATOR
 
const std::string DEFAULT_OPENTREP_SQL_DB_TYPE
 
const std::string DEFAULT_OPENTREP_MYSQL_CONN_STRING
 
const std::string DEFAULT_OPENTREP_SQLITE_DB_FILEPATH
 
const std::string DEFAULT_OPENTREP_MYSQL_DB_USER
 
const std::string DEFAULT_OPENTREP_MYSQL_DB_PASSWD
 
const std::string DEFAULT_OPENTREP_MYSQL_DB_DBNAME
 
const std::string DEFAULT_OPENTREP_MYSQL_DB_HOST
 
const std::string DEFAULT_OPENTREP_MYSQL_DB_PORT
 
const unsigned short DEFAULT_OPENTREP_DEPLOYMENT_NUMBER
 
const unsigned short DEFAULT_OPENTREP_DEPLOYMENT_NUMBER_SIZE
 
const bool DEFAULT_OPENTREP_INCLUDE_NONIATA_POR
 
const bool DEFAULT_OPENTREP_INDEX_IN_XAPIAN
 
const bool DEFAULT_OPENTREP_ADD_IN_DB
 
static const u_int32_t offsetsFromUTF8 [6]
 
static const char trailingBytesForUTF8 [256]
 
static const DistanceErrorScaleArray_T K_DEFAULT_ERROR_SCALE
 

Typedef Documentation

◆ base_iterator_t

typedef std::istreambuf_iterator<char> OPENTREP::base_iterator_t

Definition at line 27 of file BasParserTypes.hpp.

◆ iterator_t

typedef boost::spirit::multi_pass<base_iterator_t> OPENTREP::iterator_t

Definition at line 28 of file BasParserTypes.hpp.

◆ pos_iterator_t

typedef boost::spirit::classic::position_iterator2<iterator_t> OPENTREP::pos_iterator_t

Definition at line 31 of file BasParserTypes.hpp.

◆ uint1_p_t

typedef boost::spirit::qi::uint_parser<int, 10, 1, 1> OPENTREP::uint1_p_t

1-digit-integer parser

Definition at line 40 of file BasParserTypes.hpp.

◆ uint2_p_t

typedef boost::spirit::qi::uint_parser<int, 10, 2, 2> OPENTREP::uint2_p_t

2-digit-integer parser

Definition at line 43 of file BasParserTypes.hpp.

◆ int1_2_p_t

typedef boost::spirit::qi::uint_parser<int, 10, 1, 2> OPENTREP::int1_2_p_t

Up-to-2-digit-integer parser

Definition at line 46 of file BasParserTypes.hpp.

◆ uint4_p_t

typedef boost::spirit::qi::uint_parser<int, 10, 4, 4> OPENTREP::uint4_p_t

4-digit-integer parser

Definition at line 49 of file BasParserTypes.hpp.

◆ int1_5_p_t

typedef boost::spirit::qi::int_parser<int, 10, 1, 5> OPENTREP::int1_5_p_t

Up-to-5-digit-integer parser

Definition at line 52 of file BasParserTypes.hpp.

◆ int0_5_p_t

typedef boost::spirit::qi::int_parser<int, 10, 0, 5> OPENTREP::int0_5_p_t

Definition at line 53 of file BasParserTypes.hpp.

◆ uint1_4_p_t

typedef boost::spirit::qi::uint_parser<int, 10, 1, 4> OPENTREP::uint1_4_p_t

Up-to-4-digit-integer parser

Definition at line 56 of file BasParserTypes.hpp.

◆ uint1_9_p_t

typedef boost::spirit::qi::uint_parser<int, 10, 1, 9> OPENTREP::uint1_9_p_t

Up-to-9-digit-integer parser

Definition at line 59 of file BasParserTypes.hpp.

◆ uint0_9_p_t

typedef boost::spirit::qi::uint_parser<int, 10, 0, 9> OPENTREP::uint0_9_p_t

Definition at line 60 of file BasParserTypes.hpp.

◆ hour_p_t

typedef boost::spirit::qi::uint_parser<hour_t, 10, 2, 2> OPENTREP::hour_p_t

Date & time element parsers

Definition at line 63 of file BasParserTypes.hpp.

◆ minute_p_t

typedef boost::spirit::qi::uint_parser<minute_t, 10, 2, 2> OPENTREP::minute_p_t

Definition at line 64 of file BasParserTypes.hpp.

◆ second_p_t

typedef boost::spirit::qi::uint_parser<second_t, 10, 2, 2> OPENTREP::second_p_t

Definition at line 65 of file BasParserTypes.hpp.

◆ year_p_t

typedef boost::spirit::qi::uint_parser<year_t, 10, 4, 4> OPENTREP::year_p_t

Definition at line 66 of file BasParserTypes.hpp.

◆ month_p_t

typedef boost::spirit::qi::uint_parser<month_t, 10, 2, 2> OPENTREP::month_p_t

Definition at line 67 of file BasParserTypes.hpp.

◆ day_p_t

typedef boost::spirit::qi::uint_parser<day_t, 10, 2, 2> OPENTREP::day_p_t

Definition at line 68 of file BasParserTypes.hpp.

◆ boolean_p_t

typedef boost::spirit::qi::bool_parser<bool, short_bool_policies> OPENTREP::boolean_p_t

Definition at line 101 of file BasParserTypes.hpp.

◆ u_int32_t

typedef long unsigned int OPENTREP::u_int32_t

32-bit unsigned integer

Definition at line 16 of file UTF8Handler.cpp.

◆ StringMap_T

typedef std::map<const std::string, std::string> OPENTREP::StringMap_T

Map for character strings

Definition at line 43 of file Utilities.hpp.

◆ GenericBom_T

A generic BOM is a pair of a BOM type (enumeration) and a BOM object pointer.

Definition at line 19 of file GenericBom.hpp.

◆ GenericBomList_T

typedef std::map<std::size_t, GenericBom_T> OPENTREP::GenericBomList_T

List of generic BOM objects.

Definition at line 22 of file GenericBom.hpp.

◆ PlaceList_T

typedef std::multimap<std::string, Place*> OPENTREP::PlaceList_T

Definition at line 20 of file PlaceList.hpp.

◆ PlaceOrderedList_T

typedef std::list<Place*> OPENTREP::PlaceOrderedList_T

Definition at line 21 of file PlaceList.hpp.

◆ XapianDocumentPair_T

typedef std::pair<Xapian::Document, ScoreBoard> OPENTREP::XapianDocumentPair_T

Pair of a Xapian document and its associated score board.

Definition at line 30 of file Result.hpp.

◆ DocumentList_T

(STL) List of Xapian documents and their associated score board.

Definition at line 35 of file Result.hpp.

◆ DocumentMap_T

typedef std::map<Xapian::docid, XapianDocumentPair_T> OPENTREP::DocumentMap_T

(STL) Map of Xapian documents and their associated score board.

Definition at line 40 of file Result.hpp.

◆ ResultHolderList_T

List of ResultHolder objects.

Definition at line 18 of file ResultHolderList.hpp.

◆ ResultList_T

typedef std::list<Result*> OPENTREP::ResultList_T

List of Result objects.

Definition at line 18 of file ResultList.hpp.

◆ StringPartitionList_T

Type gathering all the partitions of a string.

Definition at line 166 of file StringPartition.hpp.

◆ WorldID_T

typedef std::size_t OPENTREP::WorldID_T

Definition at line 92 of file World.hpp.

◆ CityDetailsList_T

A list of cities, for instance the list of cities served by a travel-/transport-related POR (point of reference), such as an airport, a railway/bus station or a ferry/maritime port.

For instance, Bradley International Airport serves HFD/Hartford, BDL/Windsor Locks and SFY/Springfield in Connecticut (CT), United States (US).

Definition at line 25 of file CityDetailsList.hpp.

◆ DBParamsNameList_T

typedef std::list<std::string> OPENTREP::DBParamsNameList_T

List of database parameters, as character strings

Definition at line 20 of file DBParams.hpp.

◆ LocationList_T

typedef std::list<Location> OPENTREP::LocationList_T

List of (geographical) location structures.

Definition at line 18 of file LocationList.hpp.

◆ NameList_T

typedef std::list<std::string> OPENTREP::NameList_T

Definition at line 20 of file Names.hpp.

◆ NameMatrix_T

Matrix of place names: for each of the language, the place gets a corresponding list of names.

For instance, MUC corresponds to Munich in English, München in German, Munique in French, Мюнхен in Russian, etc.

Definition at line 149 of file Names.hpp.

◆ hour_t

Type definitions for the date and time elements.

Definition at line 60 of file OPENTREP_ParserHelperTypes.hpp.

◆ minute_t

Definition at line 61 of file OPENTREP_ParserHelperTypes.hpp.

◆ second_t

Definition at line 62 of file OPENTREP_ParserHelperTypes.hpp.

◆ year_t

typedef date_time_element<1900, 2100> OPENTREP::year_t

Definition at line 63 of file OPENTREP_ParserHelperTypes.hpp.

◆ month_t

Definition at line 64 of file OPENTREP_ParserHelperTypes.hpp.

◆ day_t

Definition at line 65 of file OPENTREP_ParserHelperTypes.hpp.

◆ DeploymentNumber_T

typedef unsigned short OPENTREP::DeploymentNumber_T

Number/version of the current deployment.

The idea is to have at least two pieces of infrastructure (SQL database, Xapian index) in parallel:

  • one is used by the production;
  • the other one used as a staging platform in order to test and validate a new version.
  • Once the new version has been validated, the two pieces of infrastructure can then be interverted, ie, the production becomes the new version, and the older version ends up in staging.
  • It means that all programs have to choose which version they want to work on. That version may even be toggled in live.
  • That method to deploy in production through a staging process is even more needed by the fact that indexing a new POR data file takes up to 30 minutes in the worst case. So, we cannot afford 30-45 minutes of downtime everytime a new POR data file is released (potentially every day).
  • With that staging process, it is even possible to fully automate the re-indexing after a new POR data file release: once the new release has been cleared by QA on staging, it becomes production.

Definition at line 108 of file OPENTREP_Types.hpp.

◆ shouldIndexNonIATAPOR_T

Whether or not the non-IATA-referenced POR should be included (and indexed).

By default, and historically, only the POR, which are referenced by IATA (ie, which have a specific IATA code), are indexed (and may be searched for) in OpenTREP.

POR are also referenced by other international organizations, such as ICAO, UN/LOCODE or UIC, and may not be referenced by IATA (in which case their IATA code is left empty).

As of August 2018, there are around 110,000 POR in OpenTravelData (OPTD), the reference data source for OpenTREP:

  • Around 20,000 POR are referenced by IATA
  • Around 90,000 POR are not referenced by IATA, but referenced by other international organizations (eg, ICAO, UN/LOCODE, UIC)

Indexing 20,000 POR takes already a few minutes on standard hardware. Indexing 110,000 POR would take 15 to 20 minutes.

Once indexed, all those POR become searchable. That flag is therefore only used at indexing time.

Definition at line 136 of file OPENTREP_Types.hpp.

◆ shouldIndexPORInXapian_T

Whether or not to add the POR, or list of POR, into the Xapian index.

Definition at line 141 of file OPENTREP_Types.hpp.

◆ shouldAddPORInSQLDB_T

Whether or not to add the POR, or list of POR, into the SQL database.

Definition at line 146 of file OPENTREP_Types.hpp.

◆ IATACodeList_T

List of IATA three-letter codes.

Definition at line 161 of file OPENTREP_Types.hpp.

◆ ICAOCodeList_T

List of ICAO four-letter codes.

Definition at line 177 of file OPENTREP_Types.hpp.

◆ GeonamesID_T

typedef unsigned int OPENTREP::GeonamesID_T

Geonames ID.

Definition at line 182 of file OPENTREP_Types.hpp.

◆ GeonamesIDList_T

List of Geonames IDs.

Definition at line 186 of file OPENTREP_Types.hpp.

◆ EnvelopeID_T

typedef unsigned int OPENTREP::EnvelopeID_T

Envelope ID.

Definition at line 191 of file OPENTREP_Types.hpp.

◆ UNLOCodeList_T

Definition at line 229 of file OPENTREP_Types.hpp.

◆ UICCode_T

typedef unsigned int OPENTREP::UICCode_T

UIC code (e.g., 87747006).

UIC is the International Union of Railways (Union Internationale des Chemins de fer in French) The corresponding alternate name code in Geonames is uicn.

Definition at line 238 of file OPENTREP_Types.hpp.

◆ UICCodeList_T

typedef std::list<UICCode_T> OPENTREP::UICCodeList_T

List of UIC codes.

Definition at line 242 of file OPENTREP_Types.hpp.

◆ AltNameShortList_T

Definition at line 283 of file OPENTREP_Types.hpp.

◆ WAC_T

typedef unsigned int OPENTREP::WAC_T

US DOT World Area Code (WAC) (e.g., 1 for Alaska, US, or 427 for France)

Those US DOT WAC codes are maintained by the BTS, part of the US DOT.

Definition at line 403 of file OPENTREP_Types.hpp.

◆ FeatureNameList_T

Definition at line 557 of file OPENTREP_Types.hpp.

◆ GeoCoord_T

typedef double OPENTREP::GeoCoord_T

Geographical coordinate (e.g., -10.45 or 56.7).

Definition at line 562 of file OPENTREP_Types.hpp.

◆ Latitude_T

Definition at line 563 of file OPENTREP_Types.hpp.

◆ Longitude_T

Definition at line 564 of file OPENTREP_Types.hpp.

◆ Date_T

typedef boost::gregorian::date OPENTREP::Date_T

Date (e.g., modification date).

It corresponds to the date when the place was last modified on Geonames.

Definition at line 579 of file OPENTREP_Types.hpp.

◆ Population_T

typedef unsigned int OPENTREP::Population_T

Population (e.g., 400,000).

It corresponds to the population size as curated by Geonames.

Definition at line 586 of file OPENTREP_Types.hpp.

◆ Elevation_T

typedef int OPENTREP::Elevation_T

Geographical elevation (e.g., 300).

It corresponds to the elevation as curated by Geonames.

Definition at line 593 of file OPENTREP_Types.hpp.

◆ GTopo30_T

typedef int OPENTREP::GTopo30_T

Geographical topology 30.

It corresponds to the topology value as curated by Geonames.

Definition at line 600 of file OPENTREP_Types.hpp.

◆ GMTOffset_T

typedef float OPENTREP::GMTOffset_T

GMT offset (e.g., 1)

Definition at line 613 of file OPENTREP_Types.hpp.

◆ DSTOffset_T

typedef float OPENTREP::DSTOffset_T

DST offset (e.g., 2)

Definition at line 618 of file OPENTREP_Types.hpp.

◆ RawOffset_T

typedef float OPENTREP::RawOffset_T

Raw offset (e.g., 1)

Definition at line 623 of file OPENTREP_Types.hpp.

◆ PageRank_T

typedef double OPENTREP::PageRank_T

PageRank (e.g., 94.66%).

That value is derived from the frequency of trips to/from the place.

Definition at line 630 of file OPENTREP_Types.hpp.

◆ IsGeonames_T

typedef bool OPENTREP::IsGeonames_T

Whether or not that place is referenced by Geonames

Definition at line 635 of file OPENTREP_Types.hpp.

◆ IsAirport_T

typedef bool OPENTREP::IsAirport_T

Whether or not that place is an airport

Definition at line 640 of file OPENTREP_Types.hpp.

◆ IsCommercial_T

Whether or not that place is for commercial use

Definition at line 645 of file OPENTREP_Types.hpp.

◆ XapianDocID_T

typedef unsigned int OPENTREP::XapianDocID_T

Xapian document ID.

Definition at line 650 of file OPENTREP_Types.hpp.

◆ Weight_T

typedef unsigned short OPENTREP::Weight_T

Weight when indexing terms of a Xapian document.

Definition at line 655 of file OPENTREP_Types.hpp.

◆ TravelQuery_T

typedef std::string OPENTREP::TravelQuery_T

Travel search query.

Definition at line 660 of file OPENTREP_Types.hpp.

◆ MatchingPercentage_T

Xapian percentage.

Definition at line 665 of file OPENTREP_Types.hpp.

◆ Percentage_T

typedef double OPENTREP::Percentage_T

Matching percentage for a Xapian document.

Definition at line 670 of file OPENTREP_Types.hpp.

◆ Score_T

typedef double OPENTREP::Score_T

Score (e.g., matching percentage) for a document/POR (point of reference).

Definition at line 675 of file OPENTREP_Types.hpp.

◆ NbOfDBEntries_T

typedef unsigned int OPENTREP::NbOfDBEntries_T

Number of entries in the Xapian database.

Definition at line 680 of file OPENTREP_Types.hpp.

◆ Word_T

typedef std::string OPENTREP::Word_T

Word, which is the atomic element of a query string.

Definition at line 685 of file OPENTREP_Types.hpp.

◆ WordList_T

typedef std::list<Word_T> OPENTREP::WordList_T

List of words.

Definition at line 690 of file OPENTREP_Types.hpp.

◆ WordSet_T

typedef std::set<std::string> OPENTREP::WordSet_T

Set of words.

Definition at line 695 of file OPENTREP_Types.hpp.

◆ BlackList_T

typedef std::set<std::string> OPENTREP::BlackList_T

List of (black-listed) words.

Definition at line 700 of file OPENTREP_Types.hpp.

◆ NbOfLetters_T

typedef unsigned int OPENTREP::NbOfLetters_T

Number of letters in a word or phrase.

Definition at line 705 of file OPENTREP_Types.hpp.

◆ NbOfWords_T

typedef unsigned short OPENTREP::NbOfWords_T

Number of words in a list.

Definition at line 710 of file OPENTREP_Types.hpp.

◆ NbOfMatches_T

typedef unsigned short OPENTREP::NbOfMatches_T

Number of matching documents.

Definition at line 715 of file OPENTREP_Types.hpp.

◆ NbOfErrors_T

typedef unsigned short OPENTREP::NbOfErrors_T

Number of errors.

Definition at line 720 of file OPENTREP_Types.hpp.

◆ DistanceErrorScale_T

Number of (distance) errors allowed for a given number of letters.

Definition at line 725 of file OPENTREP_Types.hpp.

◆ DistanceErrorScaleArray_T

Number of (distance) errors allowed for a given number of letters.

Definition at line 730 of file OPENTREP_Types.hpp.

Function Documentation

◆ DEFAULT_OPENTREP_POR_FILEPATH()

const std::string OPENTREP::DEFAULT_OPENTREP_POR_FILEPATH ( OPENTREP_POR_DATA_DIR "/test_optd_por_public.csv" )

Default file-path for the OPTD-maintained POR (points of reference) file.

◆ DEFAULT_OPENTREP_XAPIAN_DB_FILEPATH()

const std::string OPENTREP::DEFAULT_OPENTREP_XAPIAN_DB_FILEPATH ( "/tmp/opentrep/xapian_traveldb" )

Default file-path for the Xapian database/index.

◆ DEFAULT_OPENTREP_SQLITE_DB_FILLING_INDICATOR()

const bool OPENTREP::DEFAULT_OPENTREP_SQLITE_DB_FILLING_INDICATOR ( false )

Default boolean indicator for the SQLite3 database filling.

◆ DEFAULT_OPENTREP_SQL_DB_TYPE()

const std::string OPENTREP::DEFAULT_OPENTREP_SQL_DB_TYPE ( "nodb" )

Default type for the SQL database (e.g., "nodb", i.e., no SQL database).

◆ DEFAULT_OPENTREP_SQLITE_DB_FILEPATH()

const std::string OPENTREP::DEFAULT_OPENTREP_SQLITE_DB_FILEPATH ( "/tmp/opentrep/sqlite_travel.db" )

Default name and location for the SQLite3 database.

◆ DEFAULT_OPENTREP_MYSQL_DB_USER()

const std::string OPENTREP::DEFAULT_OPENTREP_MYSQL_DB_USER ( "trep" )

Default name and location for the MySQL database (if existing).

◆ DEFAULT_OPENTREP_MYSQL_DB_PASSWD()

const std::string OPENTREP::DEFAULT_OPENTREP_MYSQL_DB_PASSWD ( "trep" )

◆ DEFAULT_OPENTREP_MYSQL_DB_DBNAME()

const std::string OPENTREP::DEFAULT_OPENTREP_MYSQL_DB_DBNAME ( "trep_trep" )

◆ DEFAULT_OPENTREP_MYSQL_DB_HOST()

const std::string OPENTREP::DEFAULT_OPENTREP_MYSQL_DB_HOST ( "localhost" )

◆ DEFAULT_OPENTREP_MYSQL_DB_PORT()

const std::string OPENTREP::DEFAULT_OPENTREP_MYSQL_DB_PORT ( "3306" )

◆ DEFAULT_OPENTREP_DEPLOYMENT_NUMBER()

const unsigned short OPENTREP::DEFAULT_OPENTREP_DEPLOYMENT_NUMBER ( 0 )

Number/version of the current deployment.

By default, set to 0. If all the processes use the default deployment number/version, then the deployment is direct in production, there is no staging process.

◆ DEFAULT_OPENTREP_DEPLOYMENT_NUMBER_SIZE()

const unsigned short OPENTREP::DEFAULT_OPENTREP_DEPLOYMENT_NUMBER_SIZE ( 2 )

Size of the pieces of infrastructure for the deployment staging principle.

By default, set to 2, one for production and one for staging.

◆ DEFAULT_OPENTREP_INCLUDE_NONIATA_POR()

const bool OPENTREP::DEFAULT_OPENTREP_INCLUDE_NONIATA_POR ( false )

Whether or not the non-IATA-referenced POR should be included (and indexed).

By default, and historically, only the POR, which are referenced by IATA (ie, which have a specific IATA code), are indexed (and may be searched for) in OpenTREP.

◆ DEFAULT_OPENTREP_INDEX_IN_XAPIAN()

const bool OPENTREP::DEFAULT_OPENTREP_INDEX_IN_XAPIAN ( true )

Whether or not to add the POR, or list of POR, in the Xapian index.

By default, index the POR in Xapian.

◆ DEFAULT_OPENTREP_ADD_IN_DB()

const bool OPENTREP::DEFAULT_OPENTREP_ADD_IN_DB ( false )

Whether or not to add the POR, or list of POR, in the SQL database.

By default, do not insert the POR in the SQL database.

◆ DEFAULT_DATE_STR()

const std::string OPENTREP::DEFAULT_DATE_STR ( "1970-01-01" )

Default date-time with std::string as type.

◆ K_DEFAULT_XAPIAN_MATCHING_SET_SIZE()

const NbOfMatches_T OPENTREP::K_DEFAULT_XAPIAN_MATCHING_SET_SIZE ( 30 )

Default size of matching set for Xapian (e.g., 30)

◆ K_DEFAULT_INDEXING_STD_WEIGHT()

const Weight_T OPENTREP::K_DEFAULT_INDEXING_STD_WEIGHT ( 1 )

Default indexing weight for standard terms (e.g., 1)

◆ K_DEFAULT_INDEXING_EXTRA_WEIGHT()

const Weight_T OPENTREP::K_DEFAULT_INDEXING_EXTRA_WEIGHT ( 2 )

Default indexing weight for some terms like IATA/ICAO/FAA codes (e.g., 2)

◆ K_DEFAULT_MODIFIED_MATCHING_PCT()

const Percentage_T OPENTREP::K_DEFAULT_MODIFIED_MATCHING_PCT ( 100. 0)

Default modified matching percentage (e.g., 99.999% == 0.99999)

◆ K_DEFAULT_PAGE_RANK()

const Percentage_T OPENTREP::K_DEFAULT_PAGE_RANK ( 0. 10)

Default PageRank (e.g., 0.10% == 0.001)

◆ K_DEFAULT_ENVELOPE_PCT()

const Percentage_T OPENTREP::K_DEFAULT_ENVELOPE_PCT ( K_DEFAULT_PAGE_RANK )

Default envelope percentage (e.g., 0.10% == 0.001). Usually equal to K_DEFAULT_PAGE_RANK.

References K_DEFAULT_PAGE_RANK.

◆ K_DEFAULT_FULL_CODE_MATCH_PCT()

const Percentage_T OPENTREP::K_DEFAULT_FULL_CODE_MATCH_PCT ( 11000/ K_DEFAULT_PAGE_RANK)

Default full match percentage for a IATA/ICAO code (e.g., 11,000,000% == 110,000 == 110 / 0.001). Usually equal to 100 * 1.1 / (K_DEFAULT_PAGE_RANK / 100).

References K_DEFAULT_PAGE_RANK.

◆ K_DEFAULT_ATTENUATION_FCTR()

const Percentage_T OPENTREP::K_DEFAULT_ATTENUATION_FCTR ( 850. 0)

Default attenuation factor (e.g., 850.0). It weighs down a set of strings when compared to the single string. For instance, the {"paris", "texas"} combination is weighed down, so that it is ranked less than "paris texas".

◆ K_DEFAULT_SIZE_FOR_SPELLING_ERROR_UNIT()

const NbOfErrors_T OPENTREP::K_DEFAULT_SIZE_FOR_SPELLING_ERROR_UNIT ( 4 )

Default number of characters by allowable spelling error unit

◆ K_DEFAULT_MAXIMUM_NUMBER_OF_WORDS_IN_STRING()

const NbOfWords_T OPENTREP::K_DEFAULT_MAXIMUM_NUMBER_OF_WORDS_IN_STRING ( 14 )

Maximum number of words a string may have (e.g., 14). The issue typically arises with Bangkok (BKK): http://www.geonames.org/1609350

◆ check()

bool OPENTREP::check ( const UErrorCode & iStatus,
const char * iMsg )

Verify that the given status corresponds to a successful operation.

Parameters
constUErrorCode& The status of the last Unicode operation
constchar* Error message
Returns
bool Whether or not the operation was successful

Definition at line 18 of file icu_util.cpp.

References OPENTREP_LOG_ERROR.

◆ appendHex()

icu::UnicodeString & OPENTREP::appendHex ( const uint32_t iNumber,
int8_t ioDigits,
icu::UnicodeString & ioTarget )

Definition at line 34 of file icu_util.cpp.

Referenced by escape().

◆ escape()

icu::UnicodeString OPENTREP::escape ( const icu::UnicodeString & )

Replace non-printable characters with Unicode escapes.

Parameters
constUnicodeString& ICU Unicode string
Returns
UnicodeString ICU Unicode string with escaped characters

Definition at line 45 of file icu_util.cpp.

References appendHex().

◆ getUTF8()

std::string OPENTREP::getUTF8 ( const icu::UnicodeString & )

Get a STL string from the given UnicodeString.

Parameters
constUnicodeString& ICU Unicode string
Returns
std::string STL string

Definition at line 65 of file icu_util.cpp.

Referenced by OPENTREP::OTransliterator::normalise(), OPENTREP::OTransliterator::transliterate(), OPENTREP::OTransliterator::unaccent(), OPENTREP::OTransliterator::unpunctuate(), and OPENTREP::OTransliterator::unquote().

◆ tokeniseStringIntoWordList()

void OPENTREP::tokeniseStringIntoWordList ( const std::string & iPhrase,
WordList_T &  )

Split a string into a list of tokens.

Definition at line 19 of file Utilities.cpp.

Referenced by OPENTREP::Filter::trim().

◆ createStringFromWordList()

std::string OPENTREP::createStringFromWordList ( const WordList_T & ,
const NbOfWords_T iSplitIdx = 0,
const bool iFromBeginningFlag = true )

Create a string from a list of words.

The string is made of the words up until a given index. The default value of that index (0) means that the string will be made by all the words of the list.

If the flag is set to false, the string is made of the words from the given index up until the end of the list.

Definition at line 43 of file Utilities.cpp.

Referenced by OPENTREP::Filter::trim().

◆ parseMySQLConnectionString()

StringMap_T OPENTREP::parseMySQLConnectionString ( const SQLDBConnectionString_T & )

Parse the connection string.

Typically, the SQL connection string is like 'db=trep_trep user=trep password=trep'.

  • First, split the connection string by the space character (' '), which leads to key-value pairs.
  • Then, split each of those key-value pairs by the equal sign ('='), which leads to the key and the corresponding value.
Parameters
constSQLDBConnectionString_T& Connection string for MySQL/MariaDB
Returns
StringMap_T Connection details to the MySQL/MariaDB

Definition at line 107 of file Utilities.cpp.

References OPENTREP_LOG_ERROR.

Referenced by parseAndDisplayConnectionString().

◆ buildMySQLConnectionString()

SQLDBConnectionString_T OPENTREP::buildMySQLConnectionString ( const StringMap_T & ,
const DeploymentNumber_T &  )

Recompose the connection string.

For instance, 'db=trep_trep0 user=trep password=trep'

Parameters
constStringMap_T& Connection details to the MySQL/MariaDB
constconst DeploymentNumber_T& Deployment number
Returns
SQLDBConnectionString_T Connection string for MySQL/MariaDB

Definition at line 215 of file Utilities.cpp.

◆ displayMySQLConnectionString()

std::string OPENTREP::displayMySQLConnectionString ( const StringMap_T & ,
const DeploymentNumber_T & iDN = DEFAULT_OPENTREP_DEPLOYMENT_NUMBER_SIZE )
Parameters
constStringMap_T& Connection details to the MySQL/MariaDB
constconst DeploymentNumber_T& Deployment number
Returns
std::string String displaying the connection string

Definition at line 251 of file Utilities.cpp.

References DEFAULT_OPENTREP_DEPLOYMENT_NUMBER_SIZE.

Referenced by parseAndDisplayConnectionString().

◆ parseAndDisplayConnectionString()

std::string OPENTREP::parseAndDisplayConnectionString ( const DBType & ,
const std::string & iSQLDBConnStr,
const DeploymentNumber_T &  )

Parse the connection string, and re-build it taking into account the deployment number/version.

Parameters
constSQLDBConnectionString_T& Connection string for MySQL/MariaDB
constconst DeploymentNumber_T& Deployment number
Returns
std::string String displaying the connection string

Definition at line 273 of file Utilities.cpp.

References displayMySQLConnectionString(), OPENTREP::DBType::MYSQL, OPENTREP::DBType::NODB, parseMySQLConnectionString(), and OPENTREP::DBType::SQLITE3.

Referenced by readConfiguration(), readConfiguration(), and readConfiguration().

◆ hasGoodSize()

bool OPENTREP::hasGoodSize ( const std::string & iWord,
const NbOfLetters_T & iMinWordLength )

Helper function to check whether the word should be kept.

If the word has no more than <iMinWordLength> letters (e.g., 'de', 'san'), it should be filtered out. Indeed, when 'san' is part of 'san francisco', for instance, it should not be indexed/searched alone (in a search, the resulting match score will be zero).

Definition at line 39 of file Filter.cpp.

Referenced by ltrim(), rtrim(), and OPENTREP::Filter::shouldKeep().

◆ isBlackListed()

bool OPENTREP::isBlackListed ( const std::string & iWord)

Helper function to check whether the given word is black-listed.

Definition at line 53 of file Filter.cpp.

References K_BLACK_LIST.

Referenced by ltrim(), rtrim(), and OPENTREP::Filter::shouldKeep().

◆ rtrim()

void OPENTREP::rtrim ( WordList_T & ioWordList,
const NbOfLetters_T & iMinWordLength )

Helper function to trim the non-relevant right outer words.

Definition at line 72 of file Filter.cpp.

References hasGoodSize(), isBlackListed(), and rtrim().

Referenced by rtrim(), and trim().

◆ ltrim()

void OPENTREP::ltrim ( WordList_T & ioWordList,
const NbOfLetters_T & iMinWordLength )

Helper function to trim the non-relevant left outer words.

Definition at line 97 of file Filter.cpp.

References hasGoodSize(), isBlackListed(), and ltrim().

Referenced by ltrim(), and trim().

◆ trim()

void OPENTREP::trim ( WordList_T & ioWordList,
const NbOfLetters_T & iMinWordLength )

Helper function to trim the non-relevant left and right outer words.

Definition at line 122 of file Filter.cpp.

References ltrim(), and rtrim().

Referenced by OPENTREP::Filter::trim().

◆ calculateEditDistance() [1/2]

static unsigned int OPENTREP::calculateEditDistance ( const TravelQuery_T & iPhrase)
static

Helper function.

Given the size of the phrase, determine the allowed edit distance for spelling purpose. For instance, if K_DEFAULT_SIZE_FOR_SPELLING_ERROR_UNIT is equal to 4:

  • An edit distance of 1 will be allowed on a 4-letter word
  • While an edit distance of 3 will be allowed on an 11-letter word.

Definition at line 110 of file QuerySlices.cpp.

References K_DEFAULT_SIZE_FOR_SPELLING_ERROR_UNIT.

Referenced by calculateEditDistance(), and doesMatch().

◆ doesMatch()

bool OPENTREP::doesMatch ( const Xapian::Database & iDatabase,
const std::string & iWord1,
const std::string & iWord2 )

Helper function to query for a Xapian-based full text match.

Definition at line 123 of file QuerySlices.cpp.

References calculateEditDistance(), OPENTREP::Levenshtein::getDistance(), and OPENTREP_LOG_ERROR.

◆ calculateEditDistance() [2/2]

static unsigned int OPENTREP::calculateEditDistance ( const TravelQuery_T & iPhrase)
static

Helper function.

Given the size of the phrase, determine the allowed edit distance for spelling purpose. For instance, if K_DEFAULT_SIZE_FOR_SPELLING_ERROR_UNIT is equal to 4:

  • An edit distance of 1 will be allowed on a 4-letter word
  • While an edit distance of 3 will be allowed on an 11-letter word.

Definition at line 248 of file Result.cpp.

References calculateEditDistance(), and K_DEFAULT_SIZE_FOR_SPELLING_ERROR_UNIT.

◆ AllSepatorList()

static const boost::char_separator< char > OPENTREP::AllSepatorList ( " .,
;:|+- */ _ = !@#$%`~^&(){}[]?'<>\"" )
static

◆ DocSepatorList()

static const boost::char_separator< char > OPENTREP::DocSepatorList ( " ,
-%"  )
static

◆ baseTokeniseStringIntoWordList()

void OPENTREP::baseTokeniseStringIntoWordList ( const std::string & iPhrase,
WordList_T & ioWordList,
const boost::char_separator< char > & iSepatorList )

◆ addToXapian()

void OPENTREP::addToXapian ( const Place & iPlace,
Xapian::Document & ioDocument,
Xapian::WritableDatabase & ioDatabase )

◆ addUnmatchedWord()

void OPENTREP::addUnmatchedWord ( const TravelQuery_T & iQueryString,
WordList_T & ioWordList,
WordSet_T & ioWordSet )

Helper function to add the given string to the list of unknown words, only when that given string is made of a single word. Otherwise, the given string is simply ignored.

Parameters
constTravelQuery_T& The given string
WordList_T&ioWordList The list to which the given single-word string should be added (if needed).
WordSet_T&A (STL) set of words, allowing to keep track of the already added words.

Definition at line 50 of file RequestInterpreter.cpp.

References OPENTREP::Filter::shouldKeep(), and OPENTREP::WordHolder::tokeniseStringIntoWordList().

Referenced by searchString().

◆ createPlaces()

◆ searchString()

void OPENTREP::searchString ( const StringPartition & iStringPartition,
const Xapian::Database & iDatabase,
ResultCombination & ioResultCombination,
WordList_T & ioWordList )

For all the elements (StringSet) of the string partitions, derived from the given travel query, perform a Xapian-based full-text match. Each Xapian-based full-text match gives (potentially) a full set of matches, some with the highest matching percentage and some with a lower percentage.

Parameters
TravelQuery_T&The query string.
constXapian::Database& The Xapian index/database.
ResultCombination&List of ResultHolder objects.
WordList_T&List of non-matched words of the query string.

Definition at line 131 of file RequestInterpreter.cpp.

References OPENTREP::StringPartition::_partition, OPENTREP::StringSet::_set, addUnmatchedWord(), OPENTREP::FacResult::create(), OPENTREP::FacResultHolder::create(), OPENTREP::StringSet::describe(), OPENTREP::Result::fullTextMatch(), OPENTREP::FacResultHolder::initLinkWithResult(), OPENTREP::FacResultCombination::initLinkWithResultHolder(), OPENTREP::FacResult::instance(), OPENTREP::FacResultHolder::instance(), OPENTREP_LOG_DEBUG, OPENTREP_LOG_ERROR, and OPENTREP::ResultHolder::toString().

◆ chooseBestMatchingResultHolder()

void OPENTREP::chooseBestMatchingResultHolder ( ResultCombination & ioResultCombination)

Select the best matching string partition, based on the results of several rules, that are all materialised by weighting percentages:

  • Xapian-based full-text match. Score type: XAPIAN_PCT
  • Schedule-derived PageRank for the point of reference (POR). Score type: PAGE_RANK
  • Heuristic. Score type: HEURISTIC
See also
ScoreType.hpp for the various types of score.

The score for the combination (score type: COMBINATION) is simply the product of all the scores/weighting percentages.

Parameters
ResultCombination&List of ResultHolder objects.

Definition at line 226 of file RequestInterpreter.cpp.

References OPENTREP::ResultCombination::chooseBestMatchingResultHolder(), OPENTREP::ResultCombination::describeShortKey(), OPENTREP::ResultHolder::describeShortKey(), OPENTREP::ResultCombination::getBestMatchingResultHolder(), OPENTREP::ResultCombination::getBestMatchingWeight(), OPENTREP::ResultCombination::getCorrectedStringSet(), and OPENTREP_LOG_DEBUG.

◆ getBestMatchingLocation()

Location OPENTREP::getBestMatchingLocation ( const LocationList_T & iLocationList)

Retrieve the location matching the best, i.e., having the highest score for some rules. In practice, that score is usually the PageRank value. When two or morer Location structures have the same highest score, the first one is taken from the given input list.

Definition at line 303 of file RequestInterpreter.cpp.

References OPENTREP::Location::getPageRank().

◆ getLocationList()

NbOfMatches_T OPENTREP::getLocationList ( const DBType & iSQLDBType,
const SQLDBConnectionString_T & iSQLDBConnStr,
const WordList_T & iCodeList,
LocationList_T & ioLocationList,
WordList_T & ioWordList )

Return the list of locations/places corresponding to the given IATA/ICAO/UNLOCODE codes or Geonames IDs.

Parameters
constDBType& SQL database type (can be no database at all).
constSQLDBConnectionString_T& SQL DB connection string.
constWordList_T& List of IATA/ICAO/UNLOCODE codes or Geonames ID (e.g., "sna 5391989 6299418 los chi cnshg lso rek lfmn iev mow").
LocationList_T&The matching (geographical) locations, if any, are added to that list.
WordList_T&List of non-matched words of the query string.
Returns
NbOfMatches_T Number of matches.

Definition at line 336 of file RequestInterpreter.cpp.

References OPENTREP::DBType::describe(), OPENTREP::DBManager::getPORByGeonameID(), OPENTREP::DBManager::getPORByIATACode(), OPENTREP::DBManager::getPORByICAOCode(), OPENTREP::DBManager::getPORByUNLOCode(), OPENTREP::DBManager::initSQLDBSession(), and OPENTREP_LOG_ERROR.

◆ checkTravelDBFilePath()

boost::filesystem::path OPENTREP::checkTravelDBFilePath ( const TravelDBFilePath_T & iTravelDBFilePath)

Definition at line 27 of file XapianIndexManager.cpp.

References OPENTREP_LOG_ERROR.

◆ operator*()

template<int MIN, int MAX>
date_time_element< MIN, MAX > OPENTREP::operator* ( const date_time_element< MIN, MAX > & o1,
const date_time_element< MIN, MAX > & o2 )
inline

Operator* overload.

Definition at line 46 of file OPENTREP_ParserHelperTypes.hpp.

References OPENTREP::date_time_element< MIN, MAX >::_value.

◆ operator+()

template<int MIN, int MAX>
date_time_element< MIN, MAX > OPENTREP::operator+ ( const date_time_element< MIN, MAX > & o1,
const date_time_element< MIN, MAX > & o2 )
inline

Operator+ overload.

Definition at line 54 of file OPENTREP_ParserHelperTypes.hpp.

References OPENTREP::date_time_element< MIN, MAX >::_value.

◆ logInit()

void OPENTREP::logInit ( const LOG::EN_LogLevel iLogLevel,
std::ostream & ioLogOutputFile )

◆ getSQLConnStr()

SQLDBConnectionString_T OPENTREP::getSQLConnStr ( const DBType & iSQLDBType,
const SQLDBConnectionString_T & iSQLDBConnStr )

Variable Documentation

◆ DEFAULT_DATE_TM

const std::tm OPENTREP::DEFAULT_DATE_TM
Initial value:

Default date-time with std::tm structure as type.

Default std::tm (date-time) structure (e.g., 1970-JAN-01).

Definition at line 98 of file BasConst.cpp.

◆ K_ICU_ACCENT_REMOVAL_RULE

const char * OPENTREP::K_ICU_ACCENT_REMOVAL_RULE = "NFD; [:M:] Remove; NFC;"

Default Unicode transliterator rule (e.g., "NFD; [:M:] Remove; NFC;")

Default Unicode transliterator rule for the removal of accents (e.g., "NFD; [:M:] Remove; NFC;").

Definition at line 110 of file BasConst.cpp.

◆ K_ICU_QUOTATION_REMOVAL_RULE

const char * OPENTREP::K_ICU_QUOTATION_REMOVAL_RULE
Initial value:

Default Unicode transliterator rule for the removal of quotes (e.g., "[\\u02B9] > \\u0027; [\\u002D] > \\u0020;")

Definition at line 116 of file BasConst.cpp.

◆ K_ICU_PUNCTUATION_REMOVAL_RULE

const char * OPENTREP::K_ICU_PUNCTUATION_REMOVAL_RULE = "[:P:] Remove;"

Default Unicode transliterator rule for the removal of punctuation (e.g., "[:P:] Remove;")

Definition at line 123 of file BasConst.cpp.

◆ K_ICU_GENERIC_TRANSLITERATOR_RULE

const char * OPENTREP::K_ICU_GENERIC_TRANSLITERATOR_RULE
Initial value:

Default Unicode transliterator rule for the removal of punctuation (e.g., "Any-Latin;")

Definition at line 129 of file BasConst.cpp.

◆ K_BLACK_LIST

const BlackList_T OPENTREP::K_BLACK_LIST = ListGenerator::createBlackList()

Black list, i.e., a list of words which should not be indexed and/or searched for (e.g., "airport", "international").

Definition at line 196 of file BasConst.cpp.

Referenced by isBlackListed().

◆ K_DEFAULT_XAPIAN_MATCHING_SET_SIZE

const NbOfMatches_T OPENTREP::K_DEFAULT_XAPIAN_MATCHING_SET_SIZE
extern

Default size of matching set for Xapian (e.g., 30)

◆ K_DEFAULT_INDEXING_STD_WEIGHT

const Weight_T OPENTREP::K_DEFAULT_INDEXING_STD_WEIGHT
extern

Default indexing weight for standard terms (e.g., 1)

Referenced by OPENTREP::Place::buildIndexSets().

◆ K_DEFAULT_INDEXING_EXTRA_WEIGHT

const Weight_T OPENTREP::K_DEFAULT_INDEXING_EXTRA_WEIGHT
extern

Default indexing weight for some terms like IATA/ICAO/FAA codes (e.g., 2)

Referenced by OPENTREP::Place::buildIndexSets().

◆ K_DEFAULT_MODIFIED_MATCHING_PCT

const Percentage_T OPENTREP::K_DEFAULT_MODIFIED_MATCHING_PCT
extern

Default modified matching percentage (e.g., 99.999% == 0.99999)

Referenced by OPENTREP::Result::calculateCodeMatches(), and OPENTREP::ScoreBoard::setScore().

◆ K_DEFAULT_PAGE_RANK

const Percentage_T OPENTREP::K_DEFAULT_PAGE_RANK
extern

◆ K_DEFAULT_ENVELOPE_PCT

const Percentage_T OPENTREP::K_DEFAULT_ENVELOPE_PCT
extern

Default envelope percentage (e.g., 0.10% == 0.001). Usually equal to K_DEFAULT_PAGE_RANK.

Referenced by OPENTREP::ScoreBoard::setScore().

◆ K_DEFAULT_FULL_CODE_MATCH_PCT

const Percentage_T OPENTREP::K_DEFAULT_FULL_CODE_MATCH_PCT
extern

Default full match percentage for a IATA/ICAO code (e.g., 11,000,000% == 110,000 == 110 / 0.001). Usually equal to 100 * 1.1 / (K_DEFAULT_PAGE_RANK / 100).

Referenced by OPENTREP::Result::calculateCodeMatches(), and OPENTREP::ScoreBoard::setScore().

◆ K_DEFAULT_ATTENUATION_FCTR

const Percentage_T OPENTREP::K_DEFAULT_ATTENUATION_FCTR
extern

Default attenuation factor (e.g., 850.0). It weighs down a set of strings when compared to the single string. For instance, the {"paris", "texas"} combination is weighed down, so that it is ranked less than "paris texas".

Referenced by OPENTREP::ResultHolder::calculateCombinedWeights().

◆ K_DEFAULT_SIZE_FOR_SPELLING_ERROR_UNIT

const NbOfErrors_T OPENTREP::K_DEFAULT_SIZE_FOR_SPELLING_ERROR_UNIT
extern

Default number of characters by allowable spelling error unit

Referenced by calculateEditDistance().

◆ K_DEFAULT_MAXIMUM_NUMBER_OF_WORDS_IN_STRING

const NbOfWords_T OPENTREP::K_DEFAULT_MAXIMUM_NUMBER_OF_WORDS_IN_STRING
extern

Maximum number of words a string may have (e.g., 14). The issue typically arises with Bangkok (BKK): http://www.geonames.org/1609350

◆ DEFAULT_DATE_STR

const std::string OPENTREP::DEFAULT_DATE_STR
extern

Default date-time with std::string as type (e.g., "1970-01-01").

Referenced by soci::type_conversion< OPENTREP::Place >::from_base().

◆ DEFAULT_OPENTREP_POR_FILEPATH

const std::string OPENTREP::DEFAULT_OPENTREP_POR_FILEPATH
extern

Default file-path for the OPTD-maintained POR (points of reference) file.

Usually, the default file-path on Linux/Unix is <installation directory>/share/opentrep/data/por/optd_por_public.csv where <installation directory> may be:

  • /usr when installed as root (e.g., with the RPM)
  • $HOME/dev/deliveries/opentrep-<version>

Referenced by readConfiguration(), and readConfiguration().

◆ DEFAULT_OPENTREP_XAPIAN_DB_FILEPATH

const std::string OPENTREP::DEFAULT_OPENTREP_XAPIAN_DB_FILEPATH
extern

Default file-path for the Xapian database/index.

Usually, the default file-path on Linux/Unix is /tmp/opentrep/traveldb

Referenced by readConfiguration(), readConfiguration(), and readConfiguration().

◆ DEFAULT_OPENTREP_SQLITE_DB_FILLING_INDICATOR

const bool OPENTREP::DEFAULT_OPENTREP_SQLITE_DB_FILLING_INDICATOR
extern

Default boolean indicator for the SQLite3 database filling.

Usually, the SQLite3 database is not filled at the same time as the Xapian database/index. Indeed, SQLite3 database filling takes a lot of time on some configurations (e.g., CentOS 6.x VM).

◆ DEFAULT_OPENTREP_SQL_DB_TYPE

const std::string OPENTREP::DEFAULT_OPENTREP_SQL_DB_TYPE
extern

Default type for the SQL database (e.g., "nodb", i.e., no SQL database).

Referenced by readConfiguration(), readConfiguration(), and readConfiguration().

◆ DEFAULT_OPENTREP_MYSQL_CONN_STRING

const std::string OPENTREP::DEFAULT_OPENTREP_MYSQL_CONN_STRING
extern

Default connection string for the MySQL/MariaDB database.

Usually, the default parameters are

  • Database user name: trep
  • Database user password: trep
  • Database name: trep_trep
  • Server hostname: localhost
  • Server port: 3306

Default connection string for the MySQL/MariaDB database.

Referenced by getSQLConnStr(), readConfiguration(), readConfiguration(), and readConfiguration().

◆ DEFAULT_OPENTREP_SQLITE_DB_FILEPATH

const std::string OPENTREP::DEFAULT_OPENTREP_SQLITE_DB_FILEPATH
extern

Default name and location for the SQLite3 database.

Usually, the default file-path on Linux/Unix is /tmp/opentrep/sqlite_travel.db

Referenced by getSQLConnStr(), readConfiguration(), readConfiguration(), and readConfiguration().

◆ DEFAULT_OPENTREP_MYSQL_DB_USER

const std::string OPENTREP::DEFAULT_OPENTREP_MYSQL_DB_USER
extern

Default name and location for the MySQL database (if existing; currently, it does not).

Usually, the default MySQL database details are:

  • User: trep
  • Passwd: trep
  • DB name: trep_trep
  • Server hostname: localhost
  • Server port: 3306

Referenced by OPENTREP::DBManager::createSQLDBUser().

◆ DEFAULT_OPENTREP_MYSQL_DB_PASSWD

const std::string OPENTREP::DEFAULT_OPENTREP_MYSQL_DB_PASSWD
extern

◆ DEFAULT_OPENTREP_MYSQL_DB_DBNAME

const std::string OPENTREP::DEFAULT_OPENTREP_MYSQL_DB_DBNAME
extern

◆ DEFAULT_OPENTREP_MYSQL_DB_HOST

const std::string OPENTREP::DEFAULT_OPENTREP_MYSQL_DB_HOST
extern

◆ DEFAULT_OPENTREP_MYSQL_DB_PORT

const std::string OPENTREP::DEFAULT_OPENTREP_MYSQL_DB_PORT
extern

◆ DEFAULT_OPENTREP_DEPLOYMENT_NUMBER

const unsigned short OPENTREP::DEFAULT_OPENTREP_DEPLOYMENT_NUMBER
extern

Number/version of the current deployment.

By default, set to 0. If all the processes use the default deployment number/version, then the deployment is direct in production, there is no staging process.

Referenced by readConfiguration(), readConfiguration(), readConfiguration(), and OPENTREP::OPENTREP_Service::toggleDeploymentNumber().

◆ DEFAULT_OPENTREP_DEPLOYMENT_NUMBER_SIZE

const unsigned short OPENTREP::DEFAULT_OPENTREP_DEPLOYMENT_NUMBER_SIZE
extern

Size of the pieces of infrastructure for the deployment staging principle.

By default, set to 2, one for production and one for staging.

Referenced by displayMySQLConnectionString(), main(), and OPENTREP::OPENTREP_Service::toggleDeploymentNumber().

◆ DEFAULT_OPENTREP_INCLUDE_NONIATA_POR

const bool OPENTREP::DEFAULT_OPENTREP_INCLUDE_NONIATA_POR
extern

Whether or not the non-IATA-referenced POR should be included (and indexed).

By default, and historically, only the POR, which are referenced by IATA (ie, which have a specific IATA code) are indexed (and may be searched for) in OpenTREP.

Referenced by readConfiguration().

◆ DEFAULT_OPENTREP_INDEX_IN_XAPIAN

const bool OPENTREP::DEFAULT_OPENTREP_INDEX_IN_XAPIAN
extern

Whether or not to add the POR, or list of POR, in the Xapian index.

By default, index the POR in Xapian.

Referenced by readConfiguration(), and readConfiguration().

◆ DEFAULT_OPENTREP_ADD_IN_DB

const bool OPENTREP::DEFAULT_OPENTREP_ADD_IN_DB
extern

Whether or not to add the POR, or list of POR, in the SQL database.

By default, do not insert the POR in the SQL database.

Referenced by readConfiguration(), and readConfiguration().

◆ offsetsFromUTF8

const u_int32_t OPENTREP::offsetsFromUTF8[6]
static
Initial value:

Definition at line 19 of file UTF8Handler.cpp.

Referenced by OPENTREP::UTF8Handler::toWideString().

◆ trailingBytesForUTF8

const char OPENTREP::trailingBytesForUTF8[256]
static
Initial value:

Definition at line 25 of file UTF8Handler.cpp.

Referenced by OPENTREP::UTF8Handler::toWideString().

◆ K_DEFAULT_ERROR_SCALE

const DistanceErrorScaleArray_T OPENTREP::K_DEFAULT_ERROR_SCALE
static
Initial value:

Default distance error scale.

Allowed error for a given number of letters:

  • < 4 => 0
  • < 7 => 1
  • < 10 => 2
  • < 15 => 3
  • < 20 => 4
  • >= 20 => (nb of letters) / 5

Definition at line 35 of file DistanceErrorRule.hpp.