#include <opentrep/bom/QuerySlices.hpp>
Public Member Functions | |
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 &) | |
~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 44 of file QuerySlices.hpp.
OPENTREP::QuerySlices::QuerySlices | ( | const Xapian::Database & | iDatabase, |
const TravelQuery_T & | iQueryString | ||
) |
Main constructor.
const | Xapian::Database& Xapian database (index) |
const | TravelQuery_T& The string for which the partitions are sought |
Definition at line 19 of file QuerySlices.cpp.
OPENTREP::QuerySlices::~QuerySlices | ( | ) |
Default destructor.
Definition at line 26 of file QuerySlices.cpp.
|
inline |
Get the underlying list of string partitions.
Definition at line 49 of file QuerySlices.hpp.
References _slices.
void OPENTREP::QuerySlices::push_back | ( | const StringPartition & | iStringPartition | ) |
Add an item (StringPartition) into the list.
Definition at line 30 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 37 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 42 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 88 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 93 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 52 of file QuerySlices.cpp.
Referenced by describe().
|
virtual |
Get the serialised version of the structure.
Implements OPENTREP::StructAbstract.
Definition at line 59 of file QuerySlices.cpp.
References _slices, and describeKey().
Referenced by toStream().
const Xapian::Database& OPENTREP::QuerySlices::_database |
Xapian database.
Definition at line 136 of file QuerySlices.hpp.
TravelQuery_T OPENTREP::QuerySlices::_queryString |
Query string having generated the set of documents.
Definition at line 141 of file QuerySlices.hpp.
StringPartitionList_T OPENTREP::QuerySlices::_slices |
Partition, i.e., a list containing sub-lists of strings
Definition at line 146 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 151 of file QuerySlices.hpp.