OpenTREP Logo  0.07.4
C++ Open Travel Request Parsing Library
RequestInterpreter.cpp
Go to the documentation of this file.
1 // //////////////////////////////////////////////////////////////////////
2 // Import section
3 // //////////////////////////////////////////////////////////////////////
4 // STL
5 #include <cassert>
6 #include <sstream>
7 #include <string>
8 #include <vector>
9 #include <exception>
10 // Boost
11 #include <boost/filesystem.hpp>
12 #include <boost/regex.hpp>
13 // SOCI
14 #include <soci/soci.h>
15 // OpenTrep
16 #include <opentrep/DBType.hpp>
18 #include <opentrep/bom/Filter.hpp>
20 #include <opentrep/bom/Place.hpp>
23 #include <opentrep/bom/Result.hpp>
35 
36 namespace OPENTREP {
37 
49  // //////////////////////////////////////////////////////////////////////
50  void addUnmatchedWord (const TravelQuery_T& iQueryString,
51  WordList_T& ioWordList, WordSet_T& ioWordSet) {
52  // Token-ise the given string
53  WordList_T lQueryStringWordList;
55  lQueryStringWordList);
56  if (lQueryStringWordList.size() == 1) {
57  // Add the unmatched/unknown word, only when that latter has not
58  // already been stored, and when it is not black-listed.
59  const bool shouldBeKept = Filter::shouldKeep ("", iQueryString);
60  //const bool shouldBeKept = true;
61 
62  WordSet_T::const_iterator itWord = ioWordSet.find (iQueryString);
63  if (shouldBeKept == true && itWord == ioWordSet.end()) {
64  ioWordSet.insert (iQueryString);
65  ioWordList.push_back (iQueryString);
66  }
67  }
68  }
69 
70  // //////////////////////////////////////////////////////////////////////
71  void createPlaces (const ResultCombination& iResultCombination,
72  PlaceHolder& ioPlaceHolder) {
73 
74  // Retrieve the best matching ResultHolder object.
75  const ResultHolder& lResultHolder =
76  iResultCombination.getBestMatchingResultHolder();
77 
78  // Browse the list of result objects
79  const ResultList_T& lResultList = lResultHolder.getResultList();
80  for (ResultList_T::const_iterator itResult = lResultList.begin();
81  itResult != lResultList.end(); ++itResult) {
82  // Retrieve the result object
83  const Result* lResult_ptr = *itResult;
84  assert (lResult_ptr != NULL);
85 
90  const bool hasFullTextMatched = lResult_ptr->hasFullTextMatched();
91  if (hasFullTextMatched == false) {
92  continue;
93  }
94  assert (hasFullTextMatched == true);
95 
96  // Retrieve the Xapian document data (string)
97  const std::string& lDocDataStr = lResult_ptr->getBestDocData();
98  const RawDataString_T& lDocData = RawDataString_T (lDocDataStr);
99 
100  // Parse the POR details and create the corresponding Location structure
101  const Location& lLocation = Result::retrieveLocation (lDocData);
102 
103  // Instanciate an empty place object, which will be filled from the
104  // rows retrieved from the database.
105  Place& lPlace = FacPlace::instance().create (lLocation);
106 
107  // Insert the Place object within the PlaceHolder object
108  FacPlaceHolder::initLinkWithPlace (ioPlaceHolder, lPlace);
109 
110  // Fill the place with the remaining of the Result details.
111  lResult_ptr->fillPlace (lPlace);
112 
113  // DEBUG
114  OPENTREP_LOG_DEBUG ("Retrieved Document: " << lPlace.toString());
115  }
116  }
117 
130  // //////////////////////////////////////////////////////////////////////
131  void searchString (const StringPartition& iStringPartition,
132  const Xapian::Database& iDatabase,
133  ResultCombination& ioResultCombination,
134  WordList_T& ioWordList) {
135 
136  // Catch any thrown Xapian::Error exceptions
137  try {
138 
139  // Set of unknown words (just to eliminate the duplicates)
140  WordSet_T lWordSet;
141 
142  // Browse the partitions
143  for (StringPartition::StringPartition_T::const_iterator itSet =
144  iStringPartition._partition.begin();
145  itSet != iStringPartition._partition.end(); ++itSet) {
146  const StringSet& lStringSet = *itSet;
147 
148  // DEBUG
149  OPENTREP_LOG_DEBUG (" ==========");
150  OPENTREP_LOG_DEBUG (" String set: " << lStringSet);
151 
152  // Create a ResultHolder object.
153  ResultHolder& lResultHolder =
154  FacResultHolder::instance().create (lStringSet.describe(), iDatabase);
155 
156  // Add the ResultHolder object to the dedicated list.
158  lResultHolder);
159 
160  // Browse through all the word combinations of the partition
161  for (StringSet::StringSet_T::const_iterator itString =
162  lStringSet._set.begin();
163  itString != lStringSet._set.end(); ++itString) {
164  //
165  const std::string lQueryString (*itString);
166 
167  // DEBUG
168  OPENTREP_LOG_DEBUG (" --------");
169  OPENTREP_LOG_DEBUG (" Query string: '" << lQueryString << "'");
170 
171  // Create an empty Result object
172  Result& lResult = FacResult::instance().create (lQueryString,
173  iDatabase);
174 
175  // Add the Result object to the dedicated list.
176  FacResultHolder::initLinkWithResult (lResultHolder, lResult);
177 
178  // Perform the Xapian-based full-text match: the set of
179  // matching documents is filled.
180  const std::string& lMatchedString =
181  lResult.fullTextMatch (iDatabase, lQueryString);
182 
183  // When a single-word string is unmatched/unknown by/from Xapian,
184  // add it to the dedicated list (i.e., ioWordList).
185  if (lMatchedString.empty() == true) {
186  OPENTREP::addUnmatchedWord (lQueryString, ioWordList, lWordSet);
187  }
188  }
189 
190  // DEBUG
191  OPENTREP_LOG_DEBUG (std::endl
192  << "========================================="
193  << std::endl << "Result holder: "
194  << lResultHolder.toString() << std::endl
195  << "========================================="
196  << std::endl << std::endl);
197  }
198 
199  // DEBUG
200  OPENTREP_LOG_DEBUG ("*********************");
201 
202  } catch (const Xapian::Error& error) {
203  // Error
204  OPENTREP_LOG_ERROR ("Exception: " << error.get_msg());
205  throw XapianException (error.get_msg());
206  }
207  }
208 
225  // //////////////////////////////////////////////////////////////////////
226  void chooseBestMatchingResultHolder (ResultCombination& ioResultCombination) {
227 
228  // Calculate the weights for the full-text matches
229  const bool doesBestMatchingResultHolderExist =
230  ioResultCombination.chooseBestMatchingResultHolder();
231 
232  if (doesBestMatchingResultHolderExist == true) {
233  const ResultHolder& lBestMatchingResultHolder =
234  ioResultCombination.getBestMatchingResultHolder();
235 
236  // DEBUG
237  const StringSet& lCorrectedStringSet =
238  ioResultCombination.getCorrectedStringSet();
239  OPENTREP_LOG_DEBUG ("The best matching string partition for '"
240  << ioResultCombination.describeShortKey() << "' is "
241  << lBestMatchingResultHolder.describeShortKey()
242  << ", and has got a weight of "
243  << ioResultCombination.getBestMatchingWeight()
244  << "%. The corrected string set is: "
245  << lCorrectedStringSet);
246 
247  } else {
248  // DEBUG
249  OPENTREP_LOG_DEBUG ("There is no match for '"
250  << ioResultCombination.describeShortKey() << "'");
251  }
252  }
253 
254  // //////////////////////////////////////////////////////////////////////
255  bool RequestInterpreter::areAllCodeOrGeoID (const TravelQuery_T& iQueryString,
256  WordList_T& ioWordList) {
257  bool areAllWordsCodes = true;
258 
259  // Token-ise the given string
260  WordHolder::tokeniseStringIntoWordList (iQueryString, ioWordList);
261  for (WordList_T::const_iterator itWord = ioWordList.begin();
262  itWord != ioWordList.end(); ++itWord) {
263  const std::string& lWord = *itWord;
264 
265  // IATA code: alpha{3}
266  const boost::regex lIATACodeExp ("^[[:alpha:]]{3}$");
267  const bool lMatchesWithIATACode = regex_match (lWord, lIATACodeExp);
268 
269  // ICAO code: (alpha|digit){4}
270  const boost::regex lICAOCodeExp ("^([[:alpha:]]|[[:digit:]]){4}$");
271  const bool lMatchesWithICAOCode = regex_match (lWord, lICAOCodeExp);
272 
273  // Geonames ID: digit{1,11}
274  const boost::regex lGeoIDCodeExp ("^[[:digit:]]{1,11}$");
275  const bool lMatchesWithGeoID = regex_match (lWord, lGeoIDCodeExp);
276 
277  // If the word is neither a IATA/ICAO code or a Geonames ID,
278  // there is nothing more to be done at that stage. The query string
279  // will have to be fully analysed.
280  // Otherwise, we go on analysing the other words.
281  if (lMatchesWithIATACode == false && lMatchesWithICAOCode == false
282  && lMatchesWithGeoID == false) {
283  areAllWordsCodes = false;
284  break;
285  }
286  }
287 
288  return areAllWordsCodes;
289  }
290 
304  // //////////////////////////////////////////////////////////////////////
306  const SQLDBConnectionString_T& iSQLDBConnStr,
307  const WordList_T& iCodeList,
308  LocationList_T& ioLocationList,
309  WordList_T& ioWordList) {
310  NbOfMatches_T oNbOfMatches = 0;
311 
312  // Connect to the SQL database/file
313  soci::session* lSociSession_ptr =
314  DBManager::initSQLDBSession (iSQLDBType, iSQLDBConnStr);
315  if (lSociSession_ptr == NULL) {
316  std::ostringstream oStr;
317  oStr << "The " << iSQLDBType.describe()
318  << " database is not accessible. Connection string: "
319  << iSQLDBConnStr << std::endl
320  << "Hint: launch the 'opentrep-dbmgr' program and "
321  << "see the 'tutorial' command.";
322  OPENTREP_LOG_ERROR (oStr.str());
323  throw SQLDatabaseImpossibleConnectionException (oStr.str());
324  }
325  assert (lSociSession_ptr != NULL);
326 
327  // Browse the list of words/items
328  for (WordList_T::const_iterator itWord = iCodeList.begin();
329  itWord != iCodeList.end(); ++itWord) {
330  const std::string& lWord = *itWord;
331 
332  // Check for IATA code: alpha{3}
333  const boost::regex lIATACodeExp ("^[[:alpha:]]{3}$");
334  const bool lMatchesWithIATACode = regex_match (lWord, lIATACodeExp);
335  if (lMatchesWithIATACode == true) {
336  // Perform the select statement on the underlying SQL database
337  const IATACode_T lIATACode (lWord);
338  const bool lUniqueEntry = true;
339  const NbOfDBEntries_T& lNbOfEntries =
340  DBManager::getPORByIATACode (*lSociSession_ptr, lIATACode,
341  ioLocationList, lUniqueEntry);
342  oNbOfMatches += lNbOfEntries;
343  continue;
344  }
345 
346  // Check for ICAO code: (alpha|digit){4}
347  const boost::regex lICAOCodeExp ("^([[:alpha:]]|[[:digit:]]){4}$");
348  const bool lMatchesWithICAOCode = regex_match (lWord, lICAOCodeExp);
349  if (lMatchesWithICAOCode == true) {
350  // Perform the select statement on the underlying SQL database
351  const ICAOCode_T lICAOCode (lWord);
352  const NbOfDBEntries_T& lNbOfEntries =
353  DBManager::getPORByICAOCode (*lSociSession_ptr, lICAOCode,
354  ioLocationList);
355  oNbOfMatches += lNbOfEntries;
356  continue;
357  }
358 
359  // Check for Geonames ID: digit{1,11}
360  const boost::regex lGeoIDCodeExp ("^[[:digit:]]{1,11}$");
361  const bool lMatchesWithGeoID = regex_match (lWord, lGeoIDCodeExp);
362  if (lMatchesWithGeoID == true) {
363  try {
364  // Convert the character string into a number
365  const GeonamesID_T lGeonamesID =
366  boost::lexical_cast<GeonamesID_T> (lWord);
367 
368  // Perform the select statement on the underlying SQL database
369  const NbOfDBEntries_T& lNbOfEntries =
370  DBManager::getPORByGeonameID (*lSociSession_ptr, lGeonamesID,
371  ioLocationList);
372  oNbOfMatches += lNbOfEntries;
373 
374  } catch (boost::bad_lexical_cast& eCast) {
375  OPENTREP_LOG_ERROR ("The Geoname ID ('" << lWord
376  << "') cannot be understood.");
377  }
378  }
379  }
380 
381  return oNbOfMatches;
382  }
383 
384  // //////////////////////////////////////////////////////////////////////
385  NbOfMatches_T RequestInterpreter::
386  interpretTravelRequest (const TravelDBFilePath_T& iTravelDBFilePath,
387  const DBType& iSQLDBType,
388  const SQLDBConnectionString_T& iSQLDBConnStr,
389  const TravelQuery_T& iTravelQuery,
390  LocationList_T& ioLocationList,
391  WordList_T& ioWordList,
392  const OTransliterator& iTransliterator) {
393  NbOfMatches_T oNbOfMatches = 0;
394 
395  // Sanity check
396  assert (iTravelQuery.empty() == false);
397 
398  // Check whether the file-path to the Xapian database/index exists
399  // and is a directory.
400  boost::filesystem::path lTravelDBFilePath (iTravelDBFilePath.begin(),
401  iTravelDBFilePath.end());
402  if (!(boost::filesystem::exists (lTravelDBFilePath)
403  && boost::filesystem::is_directory (lTravelDBFilePath))) {
404  std::ostringstream oStr;
405  oStr << "The file-path to the Xapian database/index ('"
406  << iTravelDBFilePath << "') does not exist or is not a directory.";
407  OPENTREP_LOG_ERROR (oStr.str());
408  throw FileNotFoundException (oStr.str());
409  }
410 
411  // Open the Xapian database
412  Xapian::Database lXapianDatabase (iTravelDBFilePath);
413 
414  // DEBUG
415  OPENTREP_LOG_DEBUG (std::endl
416  << "=========================================");
417 
418  // First, cut the travel query in slices and calculate all the partitions
419  // for each of those query slices
420  QuerySlices lQuerySlices (lXapianDatabase, iTravelQuery, iTransliterator);
421 
422  // DEBUG
423  OPENTREP_LOG_DEBUG ("+=+=+=+=+=+=+=+=+=+=+=+=+=+=+");
424  OPENTREP_LOG_DEBUG ("Travel query: `" << iTravelQuery << "'");
425  const TravelQuery_T& lNormalisedQueryString = lQuerySlices.getQueryString();
426  if (!(iTravelQuery == lNormalisedQueryString)) {
427  OPENTREP_LOG_DEBUG ("Normalised travel query: `" << lNormalisedQueryString
428  << "'");
429  }
430  OPENTREP_LOG_DEBUG ("Query slices: `" << lQuerySlices << "'");
431 
432  // Browse the travel query slices
433  const StringPartitionList_T& lStringPartitionList =
434  lQuerySlices.getStringPartitionList();
435  for (StringPartitionList_T::const_iterator itSlice =
436  lStringPartitionList.begin();
437  itSlice != lStringPartitionList.end(); ++itSlice) {
438  StringPartition lStringPartition = *itSlice;
439  const std::string& lTravelQuerySlice = lStringPartition.getInitialString();
440 
446  ResultCombination& lResultCombination =
447  FacResultCombination::instance().create (lTravelQuerySlice);
448 
449  // DEBUG
450  // DEBUG
451  OPENTREP_LOG_DEBUG ("+++++++++++++++++++++");
452  OPENTREP_LOG_DEBUG ("Travel query slice: `" << lTravelQuerySlice << "'");
453  OPENTREP_LOG_DEBUG ("Partitions: " << lStringPartition);
454 
455 
460  WordList_T lCodeList;
461  const bool areAllWordsCodes =
462  areAllCodeOrGeoID (lTravelQuerySlice, lCodeList);
463 
464  NbOfMatches_T lNbOfMatches = 0;
465  if (areAllWordsCodes == true && !(iSQLDBType == DBType::NODB)) {
472  // DEBUG
473  OPENTREP_LOG_DEBUG ("The travel query string (" << lTravelQuerySlice
474  << ") is made only of IATA/ICAO codes "
475  << "or Geonames ID. The " << iSQLDBType.describe()
476  << " SQL database (" << iSQLDBConnStr
477  << ") will be used. "
478  << "The Xapian database will not be used");
479 
480  lNbOfMatches = OPENTREP::getLocationList (iSQLDBType, iSQLDBConnStr,
481  lCodeList,
482  ioLocationList, ioWordList);
483  }
484 
485  if (lNbOfMatches == 0) {
496  // DEBUG
497  if (iSQLDBType == DBType::NODB) {
498  OPENTREP_LOG_DEBUG ("No SQL database may be used. "
499  << "The Xapian database will be used instead");
500  } else {
501  OPENTREP_LOG_DEBUG ("The travel query string (" << lTravelQuerySlice
502  << ") has got items/words, which are neither "
503  << "IATA/ICAO codes nor Geonames ID. "
504  << "The Xapian database/index will be used");
505  }
506 
511  OPENTREP::searchString (lTravelQuerySlice, lXapianDatabase,
512  lResultCombination, ioWordList);
513 
517  lResultCombination.calculateAllWeights();
518 
522  OPENTREP::chooseBestMatchingResultHolder (lResultCombination);
523 
529  // Create a PlaceHolder object, to collect the matching Place objects
530  PlaceHolder& lPlaceHolder = FacPlaceHolder::instance().create();
531  createPlaces (lResultCombination, lPlaceHolder);
532 
533  // DEBUG
534  OPENTREP_LOG_DEBUG (std::endl
535  << "========================================="
536  << std::endl << "Summary:" << std::endl
537  << lPlaceHolder.toShortString() << std::endl
538  << "========================================="
539  << std::endl);
540 
545  lPlaceHolder.createLocations (ioLocationList);
546  }
547  }
548 
549  oNbOfMatches = ioLocationList.size();
550  return oNbOfMatches;
551  }
552 
553 }
OPENTREP::ResultHolder::getResultList
const ResultList_T & getResultList() const
Definition: ResultHolder.hpp:41
FacResultHolder.hpp
OPENTREP::TravelQuery_T
std::string TravelQuery_T
Definition: OPENTREP_Types.hpp:660
OPENTREP::chooseBestMatchingResultHolder
void chooseBestMatchingResultHolder(ResultCombination &ioResultCombination)
Definition: RequestInterpreter.cpp:226
OPENTREP::FacPlace::create
Place & create()
Definition: FacPlace.cpp:41
FacResult.hpp
OPENTREP::FacPlaceHolder::instance
static FacPlaceHolder & instance()
Definition: FacPlaceHolder.cpp:31
OPENTREP::StringSet::_set
StringSet_T _set
Definition: StringSet.hpp:118
DBManager.hpp
OPENTREP::Result::getBestDocData
const RawDataString_T & getBestDocData() const
Definition: Result.hpp:132
Filter.hpp
OPENTREP::NbOfDBEntries_T
unsigned int NbOfDBEntries_T
Definition: OPENTREP_Types.hpp:680
ResultCombination.hpp
OPENTREP::SQLDatabaseImpossibleConnectionException
Definition: OPENTREP_exceptions.hpp:334
OPENTREP::FacPlaceHolder::create
PlaceHolder & create()
Definition: FacPlaceHolder.cpp:43
OPENTREP::WordList_T
std::list< Word_T > WordList_T
Definition: OPENTREP_Types.hpp:690
Result.hpp
OPENTREP::FacResultCombination::initLinkWithResultHolder
static void initLinkWithResultHolder(ResultCombination &, ResultHolder &)
Definition: FacResultCombination.cpp:58
StringPartition.hpp
Place.hpp
WordHolder.hpp
OPENTREP::DBType::describe
const std::string describe() const
Definition: DBType.cpp:131
OPENTREP::DBManager::getPORByIATACode
static NbOfDBEntries_T getPORByIATACode(soci::session &, const IATACode_T &, LocationList_T &, const bool iUniqueEntry)
Definition: DBManager.cpp:1190
OPENTREP::FacPlaceHolder::initLinkWithPlace
static void initLinkWithPlace(PlaceHolder &, Place &)
Definition: FacPlaceHolder.cpp:56
OPENTREP::Result
Class wrapping a set of Xapian documents having matched a given query string.
Definition: Result.hpp:48
OPENTREP::DBManager::initSQLDBSession
static soci::session * initSQLDBSession(const DBType &, const SQLDBConnectionString_T &)
Definition: DBManager.cpp:318
OPENTREP::FacResultHolder::create
ResultHolder & create(const TravelQuery_T &iQueryString, const Xapian::Database &iDatabase)
Definition: FacResultHolder.cpp:43
OPENTREP::StringSet
Class holding a set of strings, e.g., {"rio", "de", "janeiro"}.
Definition: StringSet.hpp:19
OPENTREP::ICAOCode_T
Definition: OPENTREP_Types.hpp:170
OPENTREP::addUnmatchedWord
void addUnmatchedWord(const TravelQuery_T &iQueryString, WordList_T &ioWordList, WordSet_T &ioWordSet)
Definition: RequestInterpreter.cpp:50
OPENTREP::StringSet::describe
std::string describe() const
Definition: StringSet.cpp:88
OPENTREP::ResultCombination::chooseBestMatchingResultHolder
bool chooseBestMatchingResultHolder()
Definition: ResultCombination.cpp:229
OPENTREP::IATACode_T
Definition: OPENTREP_Types.hpp:154
OPENTREP::SQLDBConnectionString_T
Definition: OPENTREP_Types.hpp:56
OPENTREP::FacResultCombination::instance
static FacResultCombination & instance()
Definition: FacResultCombination.cpp:31
OPENTREP::NbOfMatches_T
unsigned short NbOfMatches_T
Definition: OPENTREP_Types.hpp:715
OPENTREP::DBType::NODB
Definition: DBType.hpp:20
OPENTREP::DBManager::getPORByICAOCode
static NbOfDBEntries_T getPORByICAOCode(soci::session &, const ICAOCode_T &, LocationList_T &)
Definition: DBManager.cpp:1285
OPENTREP::searchString
void searchString(const StringPartition &iStringPartition, const Xapian::Database &iDatabase, ResultCombination &ioResultCombination, WordList_T &ioWordList)
Definition: RequestInterpreter.cpp:131
OPENTREP::RawDataString_T
Definition: OPENTREP_Types.hpp:76
OPENTREP_LOG_DEBUG
#define OPENTREP_LOG_DEBUG(iToBeLogged)
Definition: Logger.hpp:33
OPENTREP::FacResultHolder::instance
static FacResultHolder & instance()
Definition: FacResultHolder.cpp:31
OPENTREP::Location
Structure modelling a (geographical) location.
Definition: Location.hpp:25
OPENTREP::LocationList_T
std::list< Location > LocationList_T
Definition: LocationList.hpp:13
OPENTREP::getLocationList
NbOfMatches_T getLocationList(const DBType &iSQLDBType, const SQLDBConnectionString_T &iSQLDBConnStr, const WordList_T &iCodeList, LocationList_T &ioLocationList, WordList_T &ioWordList)
Definition: RequestInterpreter.cpp:305
OPENTREP::StringPartition::_partition
StringPartition_T _partition
Definition: StringPartition.hpp:158
OPENTREP::Filter::shouldKeep
static bool shouldKeep(const std::string &iPhrase, const std::string &iWord)
Definition: Filter.cpp:144
OPENTREP::ResultHolder::toString
std::string toString() const
Definition: ResultHolder.cpp:49
OPENTREP::ResultCombination::describeShortKey
std::string describeShortKey() const
Definition: ResultCombination.cpp:73
OPENTREP::DBManager::getPORByGeonameID
static NbOfDBEntries_T getPORByGeonameID(soci::session &, const GeonamesID_T &, LocationList_T &)
Definition: DBManager.cpp:1529
QuerySlices.hpp
OPENTREP::StringPartitionList_T
std::list< StringPartition > StringPartitionList_T
Definition: StringPartition.hpp:166
OPENTREP
Definition: BasChronometer.cpp:10
ResultHolder.hpp
OPENTREP::StringPartition
Definition: StringPartition.hpp:35
OPENTREP::PlaceHolder
Definition: PlaceHolder.hpp:16
OPENTREP::Result::retrieveLocation
static Location retrieveLocation(const Xapian::Document &)
Definition: Result.cpp:266
OPENTREP::ResultCombination::getCorrectedStringSet
StringSet getCorrectedStringSet() const
Definition: ResultCombination.cpp:66
OPENTREP::ResultCombination
Class wrapping functions on a list of ResultHolder objects.
Definition: ResultCombination.hpp:25
OPENTREP::Place::toString
std::string toString() const
Definition: Place.cpp:85
OPENTREP::ResultCombination::getBestMatchingWeight
const Percentage_T & getBestMatchingWeight() const
Definition: ResultCombination.cpp:59
OTransliterator.hpp
OPENTREP::FacResultCombination::create
ResultCombination & create(const TravelQuery_T &iQueryString)
Definition: FacResultCombination.cpp:44
OPENTREP::FacResult::instance
static FacResult & instance()
Definition: FacResult.cpp:29
OPENTREP::ResultCombination::getBestMatchingResultHolder
const ResultHolder & getBestMatchingResultHolder() const
Definition: ResultCombination.cpp:46
DBType.hpp
OPENTREP::ResultHolder
Class wrapping functions on a list of Result objects.
Definition: ResultHolder.hpp:26
Logger.hpp
OPENTREP::ResultList_T
std::list< Result * > ResultList_T
Definition: ResultList.hpp:13
OPENTREP::createPlaces
void createPlaces(const ResultCombination &iResultCombination, PlaceHolder &ioPlaceHolder)
Definition: RequestInterpreter.cpp:71
OPENTREP::WordSet_T
std::set< std::string > WordSet_T
Definition: OPENTREP_Types.hpp:695
PlaceHolder.hpp
OPENTREP::FacResult::create
Result & create(const TravelQuery_T &, const Xapian::Database &)
Definition: FacResult.cpp:41
FacPlace.hpp
RequestInterpreter.hpp
OPENTREP::ResultHolder::describeShortKey
std::string describeShortKey() const
Definition: ResultHolder.cpp:37
OPENTREP::Place
Class modelling a place/POR (point of reference).
Definition: Place.hpp:29
OPENTREP::Result::fillPlace
void fillPlace(Place &) const
Definition: Result.cpp:205
FacResultCombination.hpp
OPENTREP::FacPlace::instance
static FacPlace & instance()
Definition: FacPlace.cpp:29
OPENTREP::DBType
Enumeration of database types.
Definition: DBType.hpp:17
OPENTREP::Result::hasFullTextMatched
bool hasFullTextMatched() const
Definition: Result.hpp:71
OPENTREP_LOG_ERROR
#define OPENTREP_LOG_ERROR(iToBeLogged)
Definition: Logger.hpp:24
OPENTREP::FacResultHolder::initLinkWithResult
static void initLinkWithResult(ResultHolder &, Result &)
Definition: FacResultHolder.cpp:57
OPENTREP::XapianException
Definition: OPENTREP_exceptions.hpp:239
OPENTREP::GeonamesID_T
unsigned int GeonamesID_T
Definition: OPENTREP_Types.hpp:182
WordList_T
std::vector< std::string > WordList_T
Definition: opentrep-indexer.cpp:23
FacPlaceHolder.hpp
OPENTREP::Result::fullTextMatch
std::string fullTextMatch(const Xapian::Database &, const TravelQuery_T &)
Definition: Result.cpp:515
OPENTREP::WordHolder::tokeniseStringIntoWordList
static void tokeniseStringIntoWordList(const TravelQuery_T &, WordList_T &)
Definition: WordHolder.cpp:37