#include <opentrep/bom/QuerySlices.hpp>
Public Member Functions | |
const TravelQuery_T & | getQueryString () const |
const StringPartitionList_T & | getStringPartitionList () const |
void | push_back (const StringPartition &iStringPartition) |
size_t | size () const |
bool | empty () const |
void | clear () |
void | toStream (std::ostream &ioOut) const |
void | fromStream (std::istream &ioIn) |
std::string | describeKey () const |
std::string | describe () const |
QuerySlices (const Xapian::Database &, const TravelQuery_T &, const OTransliterator &) | |
~QuerySlices () | |
Public Attributes | |
const Xapian::Database & | _database |
TravelQuery_T | _queryString |
StringPartitionList_T | _slices |
std::string | _itLeftWords |
Class allowing to slice a query string into multiple slices. Each of those slices will then give birth to the corresponding string partitions.
The initial query string is sliced in the interstices, which split apart any two consecutive words yielding no full text match.
For instance, "san francisco nce rio de janeiro" will give:
Indeed, "francisco nce" does not yield any match; hence, the query may be split right after the "francisco" word, i.e., separating the "san francisco" sub-query from the "nce rio de janeiro" one. The same way, "nce rio" does not yield any match; hence, the remaining query may be split into two sub-queries: "nce" and "rio de janeiro".
Definition at line 47 of file QuerySlices.hpp.
OPENTREP::QuerySlices::QuerySlices | ( | const Xapian::Database & | iDatabase, |
const TravelQuery_T & | iQueryString, | ||
const OTransliterator & | iTransliterator ) |
Main constructor.
const | Xapian::Database& Xapian database (index) |
const | TravelQuery_T& The string for which the partitions are sought |
const | OTransliterator& Unicode transliterator |
Definition at line 20 of file QuerySlices.cpp.
References _database, and _queryString.
OPENTREP::QuerySlices::~QuerySlices | ( | ) |
Default destructor.
Definition at line 28 of file QuerySlices.cpp.
|
inline |
Get the underlying query string.
Note that the query string has been normalised, and has therefore potentially been altered.
Definition at line 55 of file QuerySlices.hpp.
References _queryString.
|
inline |
Get the underlying list of string partitions.
Definition at line 62 of file QuerySlices.hpp.
References _slices.
void OPENTREP::QuerySlices::push_back | ( | const StringPartition & | iStringPartition | ) |
Add an item (StringPartition) into the list.
Definition at line 32 of file QuerySlices.cpp.
References _slices, and OPENTREP::StringPartition::empty().
size_t OPENTREP::QuerySlices::size | ( | ) | const |
Return the size of the list.
Definition at line 39 of file QuerySlices.cpp.
References _slices.
Referenced by BOOST_AUTO_TEST_CASE().
bool OPENTREP::QuerySlices::empty | ( | ) | const |
Return whether or not the list is empty.
Definition at line 44 of file QuerySlices.cpp.
References _slices.
void OPENTREP::QuerySlices::clear | ( | ) |
void OPENTREP::QuerySlices::toStream | ( | std::ostream & | ioOut | ) | const |
Dump the structure into an output stream.
ostream& | the output stream. |
Definition at line 90 of file QuerySlices.cpp.
References describe().
|
virtual |
Read a structure from an input stream.
istream& | the input stream. |
Reimplemented from OPENTREP::StructAbstract.
Definition at line 95 of file QuerySlices.cpp.
std::string OPENTREP::QuerySlices::describeKey | ( | ) | const |
Get a string describing the whole key (differentiating two objects at any level).
Definition at line 54 of file QuerySlices.cpp.
Referenced by describe().
|
virtual |
Get the serialised version of the structure.
Implements OPENTREP::StructAbstract.
Definition at line 61 of file QuerySlices.cpp.
References _slices, and describeKey().
Referenced by BOOST_AUTO_TEST_CASE(), and toStream().
const Xapian::Database& OPENTREP::QuerySlices::_database |
TravelQuery_T OPENTREP::QuerySlices::_queryString |
Query string having generated the set of documents.
Definition at line 158 of file QuerySlices.hpp.
Referenced by getQueryString(), and QuerySlices().
StringPartitionList_T OPENTREP::QuerySlices::_slices |
Partition, i.e., a list containing sub-lists of strings
Definition at line 163 of file QuerySlices.hpp.
Referenced by clear(), describe(), empty(), getStringPartitionList(), push_back(), and size().
std::string OPENTREP::QuerySlices::_itLeftWords |
Staging string holding the left part of the query
Definition at line 168 of file QuerySlices.hpp.