strusPython  0.14
Public Member Functions | List of all members
strus::Context Class Reference

Object holding the global context of the strus information retrieval engine. More...

#include <bindingObjects.hpp>

Public Member Functions

 Context ()
 Constructor for local mode with own module loader. More...
 
 Context (unsigned int maxNofThreads)
 Constructor for local mode with own module loader. More...
 
 Context (unsigned int maxNofThreads, const String &tracecfg)
 Constructor for local mode with own module loader and logging of all method call traces. More...
 
 Context (const String &connectionstring)
 Constructor for remote mode (objects of the context are living on a server connected via RPC) More...
 
 Context (const String &connectionstring, unsigned int maxNofThreads)
 Constructor for remote mode (objects of the context are living on a server connected via RPC) More...
 
 Context (const Context &o)
 Copy constructor. More...
 
 ~Context ()
 Destructor. More...
 
void checkErrors () const
 Check if there has an error occurred and throw if yes. More...
 
void loadModule (const String &name_)
 Load a module. More...
 
void addModulePath (const String &paths_)
 Add a path from where to try to load modules from. More...
 
void addResourcePath (const String &paths_)
 Define where to load analyzer resource files from. More...
 
StatisticsProcessor createStatisticsProcessor (const String &name)
 Create a statistics message processor instance. More...
 
StorageClient createStorageClient ()
 Create a storage client instance of the the default storage. More...
 
StorageClient createStorageClient (const String &config_)
 Create a storage client instance. More...
 
VectorStorageClient createVectorStorageClient ()
 Create a storage client instance of the the default remote storage of the RPC server. More...
 
VectorStorageClient createVectorStorageClient (const String &config_)
 Create a vector storage client instance. More...
 
void createStorage (const String &config_)
 Create a new storage (physically) described by config. More...
 
void createVectorStorage (const String &config_)
 Create a new storage (physically) described by config. More...
 
void destroyStorage (const String &config_)
 Delete the storage (physically) described by config. More...
 
DocumentClass detectDocumentClass (const String &content)
 Detect the type of document from its content. More...
 
DocumentAnalyzer createDocumentAnalyzer (const String &segmentername_="")
 Create a document analyzer instance. More...
 
QueryAnalyzer createQueryAnalyzer ()
 Create a query analyzer instance. More...
 
QueryEval createQueryEval ()
 Create a query evaluation instance. More...
 
void close ()
 Force cleanup to circumvent object pooling mechanisms in an interpreter context. More...
 

Detailed Description

Object holding the global context of the strus information retrieval engine.

Note
There a two modes of this context object operating on a different base. If you create this object without parameter, then the context is local. In a local context you can load modules, define resources, etc. If you create this object with a connection string as parameter, then all object created by this context reside on the server (strusRpcServer) addressed with the connection string. In this case loaded modules and resources are ignored. What modules to use is then specified on server startup.

Constructor & Destructor Documentation

strus::Context::Context ( )

Constructor for local mode with own module loader.

strus::Context::Context ( unsigned int  maxNofThreads)
explicit

Constructor for local mode with own module loader.

Parameters
[in]maxNofThreadsthe maximum number of threads used (for error handler context), 0 for default
strus::Context::Context ( unsigned int  maxNofThreads,
const String &  tracecfg 
)
explicit

Constructor for local mode with own module loader and logging of all method call traces.

Parameters
[in]maxNofThreadsthe maximum number of threads used (for error handler context), 0 for default
[in]tracecfgconfiguration for generating method call traces
strus::Context::Context ( const String &  connectionstring)
explicit

Constructor for remote mode (objects of the context are living on a server connected via RPC)

Parameters
[in]connectionstringRPC server connection string
Warning
The RPC mode is only desinged for trusted clients. It is highly insecure if not strictly used in a private network only.
strus::Context::Context ( const String &  connectionstring,
unsigned int  maxNofThreads 
)

Constructor for remote mode (objects of the context are living on a server connected via RPC)

Parameters
[in]connectionstringRPC server connection string
[in]maxNofThreadsthe maximum number of threads used (for error handler context), 0 for default
Warning
The RPC mode is only desinged for trusted clients. It is highly insecure if not strictly used in a private network only.
strus::Context::Context ( const Context o)

Copy constructor.

strus::Context::~Context ( )
inline

Destructor.

Member Function Documentation

void strus::Context::addModulePath ( const String &  paths_)

Add a path from where to try to load modules from.

Parameters
[in]paths_semicolon separated list of module search paths
Remarks
Only implemented in local mode with own module loader (see constructors)
void strus::Context::addResourcePath ( const String &  paths_)

Define where to load analyzer resource files from.

Parameters
[in]paths_semicolon separated list of resource search paths
Remarks
Only implemented in local mode with own module loader (see constructors)
void strus::Context::checkErrors ( ) const

Check if there has an error occurred and throw if yes.

Remarks
Some bindings have coroutines and with a coroutine switch an error message might get lost, because error context is per thread. So if a coroutine switch is done without the last error fetched it might happen that the second coroutine gets the error of the first one. Call this function after calling some method without return value before a state where a context switch is possible.
void strus::Context::close ( )

Force cleanup to circumvent object pooling mechanisms in an interpreter context.

DocumentAnalyzer strus::Context::createDocumentAnalyzer ( const String &  segmentername_ = "")

Create a document analyzer instance.

Parameters
[in]segmentername_name of the segmenter to use (if empty then the default segmenter is used)
QueryAnalyzer strus::Context::createQueryAnalyzer ( )

Create a query analyzer instance.

QueryEval strus::Context::createQueryEval ( )

Create a query evaluation instance.

StatisticsProcessor strus::Context::createStatisticsProcessor ( const String &  name)

Create a statistics message processor instance.

Returns
the processor
void strus::Context::createStorage ( const String &  config_)

Create a new storage (physically) described by config.

Parameters
[in]config_storage configuration
Remarks
Fails if the storage already exists
StorageClient strus::Context::createStorageClient ( )

Create a storage client instance of the the default storage.

StorageClient strus::Context::createStorageClient ( const String &  config_)

Create a storage client instance.

Parameters
[in]config_configuration string of the storage client or empty, if the default remote storage of the RPC server is chosen,
void strus::Context::createVectorStorage ( const String &  config_)

Create a new storage (physically) described by config.

Parameters
[in]config_storage configuration
Remarks
Fails if the storage already exists
VectorStorageClient strus::Context::createVectorStorageClient ( )

Create a storage client instance of the the default remote storage of the RPC server.

VectorStorageClient strus::Context::createVectorStorageClient ( const String &  config_)

Create a vector storage client instance.

Parameters
[in]config_configuration string of the storage client or empty for the default storage
void strus::Context::destroyStorage ( const String &  config_)

Delete the storage (physically) described by config.

Note
works also on vector storages
Parameters
[in]config_storage description
Note
Handle this function carefully
DocumentClass strus::Context::detectDocumentClass ( const String &  content)

Detect the type of document from its content.

Parameters
[in]contentthe document content to classify
Returns
the document class
void strus::Context::loadModule ( const String &  name_)

Load a module.

Parameters
[in]name_name of the module to load
Remarks
Only implemented in local mode with own module loader (see constructors)

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