HCE project C++ developers source code library  1.1.1
HCE project developer library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
HCE::sphinx::SphinxSearcher Class Reference

#include <SphinxSearcher.hpp>

Inheritance diagram for HCE::sphinx::SphinxSearcher:
Collaboration diagram for HCE::sphinx::SphinxSearcher:

Public Member Functions

 SphinxSearcher (SphinxFunctionalObject &fObj, bool startSearchd=false, bool stopSearchd_=false)
virtual ~SphinxSearcher (void)
bool easyStart (int matchMode=SPH_MATCH_EXTENDED2, int sortMode=SPH_SORT_RELEVANCE, int rankingMode=SPH_RANK_DEFAULT, const std::string &rankexpr="")
bool startSearchd (void)
bool stopSearchd (void)
bool isActiveSearchd (void)
bool isConnected (void) const
std::string Process (const std::string &json)
SphinxOutputJsonMessage Process (SphinxInputJsonMessage &inputJsonMessage)
bool open (void)
bool close (void)
void setServerHost (const std::string &serverHost_)
std::string getServerHost (void) const
void setServerPort (int serverPort_)
int getServerPort (void) const
bool setFieldWeights (std::vector< std::pair< std::string, int > > &Vec)
bool setIndexWeights (std::vector< std::pair< std::string, int > > &Vec)
void getFieldWeights (std::vector< std::pair< std::string, int > > &Vec)
void getIndexWeights (std::vector< std::pair< std::string, int > > &Vec)
bool addField (const std::string &name, int weight=0)
bool setField (const std::string &name, int weight)
bool delField (const std::string &name)
bool addIndexFile (const std::string &name, int weight=0)
bool setIndexFile (const std::string &name, int weight)
bool delIndexFile (const std::string &name)
bool isExistField (const std::string &name)
bool isExistIndexFile (const std::string &name)
int getFieldWeight (const std::string &name)
int getIndexWeight (const std::string &name)
bool setMatchMode (int mode)
bool setSortMode (int mode, const std::string &sortby="")
bool setRankingMode (int ranker, const std::string &rankexpr="")
size_t getFieldsCount (void) const
size_t getIndexesCount (void) const
bool setIndexFileName (const std::string &indexFileName_)
std::string getIndexFileName (void) const
unsigned long long getTimeoutedRequests (void) const
void resetTimeoutedRequests (void)
void setDefaultRequestTimeout (unsigned long defaultRequestTimeout_)
unsigned long getDefaultRequestTimeout (void) const
void resizeResultData (size_t matchesCount, size_t attributesCount)
bool searchDocument (const std::string &query, SphinxResultDataMemoryManager &resultMemoryManager, SphinxRequestInfo &requestInfo)
- Public Member Functions inherited from HCE::sphinx::SphinxSearchInterface
 SphinxSearchInterface (void)
virtual ~SphinxSearchInterface (void)
void setErrorMsg (const std::string &errorMsg_)
std::string getErrorMsg (void) const
void setErrorCode (unsigned int errorCode_)
unsigned int getErrorCode (void) const
void isError (bool isError_)
bool isError (void) const

Protected Member Functions

bool addFilter (const std::string &attrName, long long value, bool exclude=false)
bool addFilter (const std::string &attrName, std::vector< long long > &values, bool exclude=false)
bool addFilterRange (const std::string &attrName, long long umin, long long umax, bool exclude=false)
bool addFilterFloatRange (const std::string &attrName, float fmin, float fmax, bool exclude=false)
void resetFilters (void)
void setMaxResultsNumber (unsigned int maxResultsNumber) throw (Poco::Exception)
void setLimits (unsigned int offset, unsigned int limit, unsigned int maxMatches, unsigned int cutoff=0) throw (Poco::Exception)
void applyFilter (Poco::SharedPtr< SphinxFilter > pFilter) throw (Poco::Exception)
void setMaxQueryTime (unsigned long maxQueryTime) throw (Poco::Exception)
std::string makeSearchCommand (const std::string &json) throw (Poco::Exception, std::exception)
void cleanup (char **&names, int *&weights, size_t &count)
bool setWeights (char **&names, int *&weights, size_t &count, std::vector< std::pair< std::string, int > > &Vec)
void getWeights (char **&names, int *&weights, size_t &count, std::vector< std::pair< std::string, int > > &Vec)
std::vector< std::pair
< std::string, int >
>::iterator 
find (std::vector< std::pair< std::string, int > > &Vec, const std::string &name)
void setAllowedFields (std::vector< std::string > &queryExtendedFields)
std::set< std::string > & getAlloedFields (void)
bool isAllowedFields (const std::string &extendedFieldName)
void setFullSchemaNames (std::vector< std::string > &schemaNames)
std::set< std::string > & getFullSchemaNames (void)
bool isExistSchemaNames (const std::string &schemaName)
- Protected Member Functions inherited from HCE::sphinx::SphinxSearchInterface
bool insensitiveCompare (const std::string &lhs, const std::string &rhs)

Protected Attributes

SphinxFunctionalObjectfObj
CustomMessagemessage
std::string serverHost
int serverPort
std::string indexFileName
bool _StopSearchd
bool _isConnected
unsigned long long timeoutedRequests
unsigned long defaultRequestTimeout
std::set< std::string > allowedFields
std::set< std::string > fullSchemaNames
SphinxRequestInfo requestInfo
SphinxResultData resultData
SphinxResultDataSerializator resultSerializator
SphinxResultDataMemoryManager resultMemoryManager
- Protected Attributes inherited from HCE::sphinx::SphinxSearchInterface
std::string errorMsg
unsigned int errorCode
bool _isError

Friends

class SphinxFunctionalObject

Additional Inherited Members

- Static Public Member Functions inherited from HCE::sphinx::SphinxSearchInterface
static size_t getTimeInterval (timeval &start, timeval &stop)

Detailed Description

Definition at line 35 of file SphinxSearcher.hpp.

Constructor & Destructor Documentation

HCE::sphinx::SphinxSearcher::SphinxSearcher ( SphinxFunctionalObject fObj,
bool  startSearchd = false,
bool  stopSearchd_ = false 
)
explicit

Definition at line 26 of file SphinxSearcher.cpp.

HCE::sphinx::SphinxSearcher::~SphinxSearcher ( void  )
virtual

Definition at line 39 of file SphinxSearcher.cpp.

Here is the call graph for this function:

Member Function Documentation

bool HCE::sphinx::SphinxSearcher::addField ( const std::string &  name,
int  weight = 0 
)

Definition at line 529 of file SphinxSearcher.cpp.

Here is the call graph for this function:

bool HCE::sphinx::SphinxSearcher::addFilter ( const std::string &  attrName,
long long  value,
bool  exclude = false 
)
protected

Definition at line 873 of file SphinxSearcher.cpp.

bool HCE::sphinx::SphinxSearcher::addFilter ( const std::string &  attrName,
std::vector< long long > &  values,
bool  exclude = false 
)
protected

Definition at line 878 of file SphinxSearcher.cpp.

bool HCE::sphinx::SphinxSearcher::addFilterFloatRange ( const std::string &  attrName,
float  fmin,
float  fmax,
bool  exclude = false 
)
protected

Definition at line 897 of file SphinxSearcher.cpp.

bool HCE::sphinx::SphinxSearcher::addFilterRange ( const std::string &  attrName,
long long  umin,
long long  umax,
bool  exclude = false 
)
protected

Definition at line 892 of file SphinxSearcher.cpp.

bool HCE::sphinx::SphinxSearcher::addIndexFile ( const std::string &  name,
int  weight = 0 
)

Definition at line 592 of file SphinxSearcher.cpp.

Here is the call graph for this function:

void HCE::sphinx::SphinxSearcher::applyFilter ( Poco::SharedPtr< SphinxFilter pFilter) throw (Poco::Exception)
protected

Definition at line 226 of file SphinxSearcher.cpp.

void HCE::sphinx::SphinxSearcher::cleanup ( char **&  names,
int *&  weights,
size_t &  count 
)
protected

Definition at line 390 of file SphinxSearcher.cpp.

Here is the caller graph for this function:

bool HCE::sphinx::SphinxSearcher::close ( void  )

Definition at line 366 of file SphinxSearcher.cpp.

Here is the caller graph for this function:

bool HCE::sphinx::SphinxSearcher::delField ( const std::string &  name)

Definition at line 571 of file SphinxSearcher.cpp.

Here is the call graph for this function:

bool HCE::sphinx::SphinxSearcher::delIndexFile ( const std::string &  name)

Definition at line 634 of file SphinxSearcher.cpp.

Here is the call graph for this function:

bool HCE::sphinx::SphinxSearcher::easyStart ( int  matchMode = SPH_MATCH_EXTENDED2,
int  sortMode = SPH_SORT_RELEVANCE,
int  rankingMode = SPH_RANK_DEFAULT,
const std::string &  rankexpr = "" 
)

Definition at line 280 of file SphinxSearcher.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< std::pair< std::string, int > >::iterator HCE::sphinx::SphinxSearcher::find ( std::vector< std::pair< std::string, int > > &  Vec,
const std::string &  name 
)
protected

Definition at line 483 of file SphinxSearcher.cpp.

Here is the caller graph for this function:

std::set<std::string>& HCE::sphinx::SphinxSearcher::getAlloedFields ( void  )
inlineprotected

Definition at line 168 of file SphinxSearcher.hpp.

unsigned long HCE::sphinx::SphinxSearcher::getDefaultRequestTimeout ( void  ) const
inline

Definition at line 129 of file SphinxSearcher.hpp.

Here is the caller graph for this function:

size_t HCE::sphinx::SphinxSearcher::getFieldsCount ( void  ) const
inline

Definition at line 119 of file SphinxSearcher.hpp.

int HCE::sphinx::SphinxSearcher::getFieldWeight ( const std::string &  name)

Definition at line 511 of file SphinxSearcher.cpp.

Here is the call graph for this function:

void HCE::sphinx::SphinxSearcher::getFieldWeights ( std::vector< std::pair< std::string, int > > &  Vec)

Definition at line 473 of file SphinxSearcher.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::set<std::string>& HCE::sphinx::SphinxSearcher::getFullSchemaNames ( void  )
inlineprotected

Definition at line 172 of file SphinxSearcher.hpp.

size_t HCE::sphinx::SphinxSearcher::getIndexesCount ( void  ) const
inline

Definition at line 120 of file SphinxSearcher.hpp.

std::string HCE::sphinx::SphinxSearcher::getIndexFileName ( void  ) const
inline

Definition at line 123 of file SphinxSearcher.hpp.

Here is the caller graph for this function:

int HCE::sphinx::SphinxSearcher::getIndexWeight ( const std::string &  name)

Definition at line 520 of file SphinxSearcher.cpp.

Here is the call graph for this function:

void HCE::sphinx::SphinxSearcher::getIndexWeights ( std::vector< std::pair< std::string, int > > &  Vec)

Definition at line 478 of file SphinxSearcher.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string HCE::sphinx::SphinxSearcher::getServerHost ( void  ) const
inline

Definition at line 62 of file SphinxSearcher.hpp.

Here is the caller graph for this function:

int HCE::sphinx::SphinxSearcher::getServerPort ( void  ) const
inline

Definition at line 65 of file SphinxSearcher.hpp.

Here is the caller graph for this function:

unsigned long long HCE::sphinx::SphinxSearcher::getTimeoutedRequests ( void  ) const
inline

Definition at line 125 of file SphinxSearcher.hpp.

Here is the caller graph for this function:

void HCE::sphinx::SphinxSearcher::getWeights ( char **&  names,
int *&  weights,
size_t &  count,
std::vector< std::pair< std::string, int > > &  Vec 
)
protected

Definition at line 463 of file SphinxSearcher.cpp.

Here is the caller graph for this function:

bool HCE::sphinx::SphinxSearcher::isActiveSearchd ( void  )

Definition at line 191 of file SphinxSearcher.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool HCE::sphinx::SphinxSearcher::isAllowedFields ( const std::string &  extendedFieldName)
protected

Definition at line 61 of file SphinxSearcher.cpp.

Here is the caller graph for this function:

bool HCE::sphinx::SphinxSearcher::isConnected ( void  ) const
inline

Definition at line 53 of file SphinxSearcher.hpp.

Here is the caller graph for this function:

bool HCE::sphinx::SphinxSearcher::isExistField ( const std::string &  name)

Definition at line 495 of file SphinxSearcher.cpp.

Here is the call graph for this function:

bool HCE::sphinx::SphinxSearcher::isExistIndexFile ( const std::string &  name)

Definition at line 503 of file SphinxSearcher.cpp.

Here is the call graph for this function:

bool HCE::sphinx::SphinxSearcher::isExistSchemaNames ( const std::string &  schemaName)
protected

Definition at line 73 of file SphinxSearcher.cpp.

std::string HCE::sphinx::SphinxSearcher::makeSearchCommand ( const std::string &  json) throw (Poco::Exception, std::exception)
protected

Definition at line 959 of file SphinxSearcher.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool HCE::sphinx::SphinxSearcher::open ( void  )

Definition at line 335 of file SphinxSearcher.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string HCE::sphinx::SphinxSearcher::Process ( const std::string &  json)
virtual

Implements HCE::sphinx::SphinxSearchInterface.

Definition at line 907 of file SphinxSearcher.cpp.

Here is the call graph for this function:

SphinxOutputJsonMessage HCE::sphinx::SphinxSearcher::Process ( SphinxInputJsonMessage inputJsonMessage)
virtual

Implements HCE::sphinx::SphinxSearchInterface.

Definition at line 1093 of file SphinxSearcher.cpp.

Here is the call graph for this function:

void HCE::sphinx::SphinxSearcher::resetFilters ( void  )
protected

Definition at line 902 of file SphinxSearcher.cpp.

void HCE::sphinx::SphinxSearcher::resetTimeoutedRequests ( void  )
inline

Definition at line 126 of file SphinxSearcher.hpp.

Here is the caller graph for this function:

void HCE::sphinx::SphinxSearcher::resizeResultData ( size_t  matchesCount,
size_t  attributesCount 
)

Definition at line 49 of file SphinxSearcher.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool HCE::sphinx::SphinxSearcher::searchDocument ( const std::string &  query,
SphinxResultDataMemoryManager resultMemoryManager,
SphinxRequestInfo requestInfo 
)

Definition at line 762 of file SphinxSearcher.cpp.

Here is the call graph for this function:

void HCE::sphinx::SphinxSearcher::setAllowedFields ( std::vector< std::string > &  queryExtendedFields)
protected

Definition at line 54 of file SphinxSearcher.cpp.

void HCE::sphinx::SphinxSearcher::setDefaultRequestTimeout ( unsigned long  defaultRequestTimeout_)
inline

Definition at line 128 of file SphinxSearcher.hpp.

Here is the caller graph for this function:

bool HCE::sphinx::SphinxSearcher::setField ( const std::string &  name,
int  weight 
)

Definition at line 550 of file SphinxSearcher.cpp.

Here is the call graph for this function:

bool HCE::sphinx::SphinxSearcher::setFieldWeights ( std::vector< std::pair< std::string, int > > &  Vec)

Definition at line 434 of file SphinxSearcher.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::sphinx::SphinxSearcher::setFullSchemaNames ( std::vector< std::string > &  schemaNames)
protected

Definition at line 66 of file SphinxSearcher.cpp.

Here is the caller graph for this function:

bool HCE::sphinx::SphinxSearcher::setIndexFile ( const std::string &  name,
int  weight 
)

Definition at line 613 of file SphinxSearcher.cpp.

Here is the call graph for this function:

bool HCE::sphinx::SphinxSearcher::setIndexFileName ( const std::string &  indexFileName_)

Definition at line 740 of file SphinxSearcher.cpp.

Here is the caller graph for this function:

bool HCE::sphinx::SphinxSearcher::setIndexWeights ( std::vector< std::pair< std::string, int > > &  Vec)

Definition at line 447 of file SphinxSearcher.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::sphinx::SphinxSearcher::setLimits ( unsigned int  offset,
unsigned int  limit,
unsigned int  maxMatches,
unsigned int  cutoff = 0 
) throw (Poco::Exception)
protected

Definition at line 217 of file SphinxSearcher.cpp.

bool HCE::sphinx::SphinxSearcher::setMatchMode ( int  mode)

Definition at line 654 of file SphinxSearcher.cpp.

Here is the caller graph for this function:

void HCE::sphinx::SphinxSearcher::setMaxQueryTime ( unsigned long  maxQueryTime) throw (Poco::Exception)
protected

Definition at line 731 of file SphinxSearcher.cpp.

void HCE::sphinx::SphinxSearcher::setMaxResultsNumber ( unsigned int  maxResultsNumber) throw (Poco::Exception)
protected

Definition at line 208 of file SphinxSearcher.cpp.

bool HCE::sphinx::SphinxSearcher::setRankingMode ( int  ranker,
const std::string &  rankexpr = "" 
)

Definition at line 703 of file SphinxSearcher.cpp.

Here is the caller graph for this function:

void HCE::sphinx::SphinxSearcher::setServerHost ( const std::string &  serverHost_)
inline

Definition at line 61 of file SphinxSearcher.hpp.

Here is the caller graph for this function:

void HCE::sphinx::SphinxSearcher::setServerPort ( int  serverPort_)
inline

Definition at line 64 of file SphinxSearcher.hpp.

Here is the caller graph for this function:

bool HCE::sphinx::SphinxSearcher::setSortMode ( int  mode,
const std::string &  sortby = "" 
)

Definition at line 675 of file SphinxSearcher.cpp.

Here is the caller graph for this function:

bool HCE::sphinx::SphinxSearcher::setWeights ( char **&  names,
int *&  weights,
size_t &  count,
std::vector< std::pair< std::string, int > > &  Vec 
)
protected

Definition at line 410 of file SphinxSearcher.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool HCE::sphinx::SphinxSearcher::startSearchd ( void  )

Definition at line 78 of file SphinxSearcher.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool HCE::sphinx::SphinxSearcher::stopSearchd ( void  )

Definition at line 146 of file SphinxSearcher.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class SphinxFunctionalObject
friend

Definition at line 183 of file SphinxSearcher.hpp.

Member Data Documentation

bool HCE::sphinx::SphinxSearcher::_isConnected
protected

Definition at line 158 of file SphinxSearcher.hpp.

bool HCE::sphinx::SphinxSearcher::_StopSearchd
protected

Definition at line 157 of file SphinxSearcher.hpp.

std::set<std::string> HCE::sphinx::SphinxSearcher::allowedFields
protected

Definition at line 175 of file SphinxSearcher.hpp.

unsigned long HCE::sphinx::SphinxSearcher::defaultRequestTimeout
protected

Definition at line 160 of file SphinxSearcher.hpp.

SphinxFunctionalObject& HCE::sphinx::SphinxSearcher::fObj
protected

Definition at line 149 of file SphinxSearcher.hpp.

std::set<std::string> HCE::sphinx::SphinxSearcher::fullSchemaNames
protected

Definition at line 176 of file SphinxSearcher.hpp.

std::string HCE::sphinx::SphinxSearcher::indexFileName
protected

Definition at line 155 of file SphinxSearcher.hpp.

CustomMessage& HCE::sphinx::SphinxSearcher::message
protected

Definition at line 150 of file SphinxSearcher.hpp.

SphinxRequestInfo HCE::sphinx::SphinxSearcher::requestInfo
protected

Definition at line 178 of file SphinxSearcher.hpp.

SphinxResultData HCE::sphinx::SphinxSearcher::resultData
protected

Definition at line 179 of file SphinxSearcher.hpp.

SphinxResultDataMemoryManager HCE::sphinx::SphinxSearcher::resultMemoryManager
protected

Definition at line 181 of file SphinxSearcher.hpp.

SphinxResultDataSerializator HCE::sphinx::SphinxSearcher::resultSerializator
protected

Definition at line 180 of file SphinxSearcher.hpp.

std::string HCE::sphinx::SphinxSearcher::serverHost
protected

Definition at line 152 of file SphinxSearcher.hpp.

int HCE::sphinx::SphinxSearcher::serverPort
protected

Definition at line 153 of file SphinxSearcher.hpp.

unsigned long long HCE::sphinx::SphinxSearcher::timeoutedRequests
protected

Definition at line 159 of file SphinxSearcher.hpp.


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