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

#include <opentrep/bom/QuerySlices.hpp>

+ Inheritance diagram for OPENTREP::QuerySlices:

Public Member Functions

const TravelQuery_TgetQueryString () const
 
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 &, const OTransliterator &)
 
 ~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 47 of file QuerySlices.hpp.

Constructor & Destructor Documentation

◆ QuerySlices()

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

Main constructor.

Parameters
constXapian::Database& Xapian database (index)
constTravelQuery_T& The string for which the partitions are sought
constOTransliterator& Unicode transliterator

Definition at line 20 of file QuerySlices.cpp.

References _database, and _queryString.

◆ ~QuerySlices()

OPENTREP::QuerySlices::~QuerySlices ( )

Default destructor.

Definition at line 28 of file QuerySlices.cpp.

Member Function Documentation

◆ getQueryString()

const TravelQuery_T & OPENTREP::QuerySlices::getQueryString ( ) const
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.

◆ getStringPartitionList()

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

Get the underlying list of string partitions.

Definition at line 62 of file QuerySlices.hpp.

References _slices.

◆ push_back()

void OPENTREP::QuerySlices::push_back ( const StringPartition & iStringPartition)

Add an item (StringPartition) into the list.

Note
When the given string set is empty (zero-length), it is (obviously) not added to the list

Definition at line 32 of file QuerySlices.cpp.

References _slices, and OPENTREP::StringPartition::empty().

◆ size()

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

◆ empty()

bool OPENTREP::QuerySlices::empty ( ) const

Return whether or not the list is empty.

Definition at line 44 of file QuerySlices.cpp.

References _slices.

◆ clear()

void OPENTREP::QuerySlices::clear ( )

Empty the list.

Definition at line 49 of file QuerySlices.cpp.

References _slices.

◆ toStream()

void OPENTREP::QuerySlices::toStream ( std::ostream & ioOut) const

Dump the structure into an output stream.

Parameters
ostream&the output stream.

Definition at line 90 of file QuerySlices.cpp.

References describe().

◆ fromStream()

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

Read a structure from an input stream.

Parameters
istream&the input stream.

Reimplemented from OPENTREP::StructAbstract.

Definition at line 95 of file QuerySlices.cpp.

◆ describeKey()

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

◆ describe()

std::string OPENTREP::QuerySlices::describe ( ) const
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().

Member Data Documentation

◆ _database

const Xapian::Database& OPENTREP::QuerySlices::_database

Xapian database.

Definition at line 153 of file QuerySlices.hpp.

Referenced by QuerySlices().

◆ _queryString

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

◆ _slices

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

◆ _itLeftWords

std::string OPENTREP::QuerySlices::_itLeftWords

Staging string holding the left part of the query

Definition at line 168 of file QuerySlices.hpp.


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