OpenTREP Logo  0.6.0
C++ Open Travel Request Parsing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OPENTREP::QuerySlices Struct Reference

#include <opentrep/bom/QuerySlices.hpp>

+ Inheritance diagram for OPENTREP::QuerySlices:

Public Member Functions

const StringPartitionList_TgetStringPartitionList () 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

Detailed Description

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:

  • [
    • 0. { {"san francisco"} }
    • 1. { {"nce"} }
    • 2. { {"rio de janeiro"} }
  • ]

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.

Constructor & Destructor Documentation

OPENTREP::QuerySlices::QuerySlices ( const Xapian::Database &  iDatabase,
const TravelQuery_T iQueryString 

Main constructor.

constXapian::Database& Xapian database (index)
constTravelQuery_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.

Member Function Documentation

const StringPartitionList_T& OPENTREP::QuerySlices::getStringPartitionList ( ) const

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.

When the given string set is empty (zero-length), it is (obviously) not added to 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 ( )

Empty the list.

Definition at line 47 of file QuerySlices.cpp.

References _slices.

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

void OPENTREP::QuerySlices::fromStream ( std::istream &  ioIn)

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

std::string OPENTREP::QuerySlices::describe ( ) const

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

Member Data Documentation

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.

The documentation for this struct was generated from the following files: