# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.13
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
"""
Xapian is a highly adaptable toolkit which allows developers to easily
add advanced indexing and search facilities to their own applications.
It has built-in support for several families of weighting models
and also supports a rich set of boolean query operators.
In addition to the doc strings provided by this python library, you
may wish to look at the library's overall documentation, either
installed along with the bindings or online at
<https://xapian.org/docs/bindings/python/>, as well as the library's
documentation, possibly installed with the library or with its
development files, or again online at <https://xapian.org/docs/>.
"""
from . import _xapian
def _swig_setattr(self, class_type, name, value):
if (name == "thisown"):
return self.this.own(value)
if (name == "this"):
if type(value).__name__ == 'SwigPyObject':
self.__dict__[name] = value
return
method = class_type.__swig_setmethods__.get(name, None)
if method:
return method(self, value)
object.__setattr__(self, name, value)
def _swig_getattr(self, class_type, name):
if (name == "thisown"):
return self.this.own()
method = class_type.__swig_getmethods__.get(name, None)
if method:
return method(self)
raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
def _swig_repr(self):
strthis = ""
if hasattr(self.this, '__repr__'):
strthis = "proxy of " + self.this.__repr__()
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
from weakref import proxy as weakref_proxy
__version__ = '1.4.11'
class SwigPyIterator(object):
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined - class is abstract")
__repr__ = _swig_repr
__swig_destroy__ = _xapian.delete_SwigPyIterator
def __iter__(self):
return self
SwigPyIterator.value = _xapian.SWIG_PyInstanceMethod_New(_xapian.SwigPyIterator_value)
SwigPyIterator.incr = _xapian.SWIG_PyInstanceMethod_New(_xapian.SwigPyIterator_incr)
SwigPyIterator.decr = _xapian.SWIG_PyInstanceMethod_New(_xapian.SwigPyIterator_decr)
SwigPyIterator.distance = _xapian.SWIG_PyInstanceMethod_New(_xapian.SwigPyIterator_distance)
SwigPyIterator.equal = _xapian.SWIG_PyInstanceMethod_New(_xapian.SwigPyIterator_equal)
SwigPyIterator.copy = _xapian.SWIG_PyInstanceMethod_New(_xapian.SwigPyIterator_copy)
SwigPyIterator.next = _xapian.SWIG_PyInstanceMethod_New(_xapian.SwigPyIterator_next)
SwigPyIterator.__next__ = _xapian.SWIG_PyInstanceMethod_New(_xapian.SwigPyIterator___next__)
SwigPyIterator.previous = _xapian.SWIG_PyInstanceMethod_New(_xapian.SwigPyIterator_previous)
SwigPyIterator.advance = _xapian.SWIG_PyInstanceMethod_New(_xapian.SwigPyIterator_advance)
SwigPyIterator.__eq__ = _xapian.SWIG_PyInstanceMethod_New(_xapian.SwigPyIterator___eq__)
SwigPyIterator.__ne__ = _xapian.SWIG_PyInstanceMethod_New(_xapian.SwigPyIterator___ne__)
SwigPyIterator.__iadd__ = _xapian.SWIG_PyInstanceMethod_New(_xapian.SwigPyIterator___iadd__)
SwigPyIterator.__isub__ = _xapian.SWIG_PyInstanceMethod_New(_xapian.SwigPyIterator___isub__)
SwigPyIterator.__add__ = _xapian.SWIG_PyInstanceMethod_New(_xapian.SwigPyIterator___add__)
SwigPyIterator.__sub__ = _xapian.SWIG_PyInstanceMethod_New(_xapian.SwigPyIterator___sub__)
SwigPyIterator_swigregister = _xapian.SwigPyIterator_swigregister
SwigPyIterator_swigregister(SwigPyIterator)
[docs]class Error(Exception):
"""
All exceptions thrown by Xapian are subclasses of Xapian::Error.
This class can not be instantiated directly - instead a subclass
should be used.
"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Error, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Error, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def get_type(self):
"""
The type of this error (e.g. "DocNotFoundError".)
const char* Xapian::Error::get_type() const
"""
return _xapian.Error_get_type(self)
def get_msg(self):
"""
Message giving details of the error, intended for human consumption.
const std::string& Xapian::Error::get_msg() const
"""
return _xapian.Error_get_msg(self)
def get_context(self):
"""
Optional context information.
const std::string& Xapian::Error::get_context() const
This context is intended for use by Xapian::ErrorHandler (for example
so it can know which remote server is unreliable and report the
problem and remove that server from those being searched). But it's
typically a plain-text string, and so also fit for human consumption.
"""
return _xapian.Error_get_context(self)
def get_error_string(self):
"""
Returns any system error string associated with this exception.
const char* Xapian::Error::get_error_string() const
The system error string may come from errno, h_errno (on UNIX), or
GetLastError() (on MS Windows). If there is no associated system error
string, NULL is returned.
"""
return _xapian.Error_get_error_string(self)
__swig_destroy__ = _xapian.delete_Error
Error.get_type = _xapian.SWIG_PyInstanceMethod_New(_xapian.Error_get_type)
Error.get_msg = _xapian.SWIG_PyInstanceMethod_New(_xapian.Error_get_msg)
Error.get_context = _xapian.SWIG_PyInstanceMethod_New(_xapian.Error_get_context)
Error.get_error_string = _xapian.SWIG_PyInstanceMethod_New(_xapian.Error_get_error_string)
Error.__str__ = _xapian.SWIG_PyInstanceMethod_New(_xapian.Error___str__)
Error_swigregister = _xapian.Error_swigregister
Error_swigregister(Error)
[docs]class LogicError(Error):
"""
The base class for exceptions indicating errors in the program logic.
A subclass of LogicError will be thrown if Xapian detects a violation
of a class invariant or a logical precondition or postcondition, etc.
"""
__swig_setmethods__ = {}
for _s in [Error]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, LogicError, name, value)
__swig_getmethods__ = {}
for _s in [Error]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, LogicError, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
__swig_destroy__ = _xapian.delete_LogicError
LogicError_swigregister = _xapian.LogicError_swigregister
LogicError_swigregister(LogicError)
[docs]class RuntimeError(Error):
"""
The base class for exceptions indicating errors only detectable at
runtime.
A subclass of RuntimeError will be thrown if Xapian detects an error
which is exception derived from RuntimeError is thrown when an error
is caused by problems with the data or environment rather than a
programming mistake.
"""
__swig_setmethods__ = {}
for _s in [Error]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, RuntimeError, name, value)
__swig_getmethods__ = {}
for _s in [Error]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, RuntimeError, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
__swig_destroy__ = _xapian.delete_RuntimeError
RuntimeError_swigregister = _xapian.RuntimeError_swigregister
RuntimeError_swigregister(RuntimeError)
[docs]class AssertionError(LogicError):
"""
AssertionError is thrown if a logical assertion inside Xapian fails.
In a debug build of Xapian, a failed assertion in the core library
code will cause AssertionError to be thrown.
This represents a bug in Xapian (either an invariant, precondition,
etc has been violated, or the assertion is incorrect!)
"""
__swig_setmethods__ = {}
for _s in [LogicError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, AssertionError, name, value)
__swig_getmethods__ = {}
for _s in [LogicError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, AssertionError, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct from message and errno value.
Xapian::AssertionError::AssertionError(const std::string &msg_, int
errno_)
Parameters:
-----------
msg_: Message giving details of the error, intended for human
consumption.
errno_: Optional errno value associated with this error.
"""
_xapian.AssertionError_swiginit(self, _xapian.new_AssertionError(*args))
__swig_destroy__ = _xapian.delete_AssertionError
AssertionError_swigregister = _xapian.AssertionError_swigregister
AssertionError_swigregister(AssertionError)
[docs]class InvalidArgumentError(LogicError):
"""
InvalidArgumentError indicates an invalid parameter value was passed
to the API.
"""
__swig_setmethods__ = {}
for _s in [LogicError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, InvalidArgumentError, name, value)
__swig_getmethods__ = {}
for _s in [LogicError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, InvalidArgumentError, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct from message and errno value.
Xapian::InvalidArgumentError::InvalidArgumentError(const std::string
&msg_, int errno_)
Parameters:
-----------
msg_: Message giving details of the error, intended for human
consumption.
errno_: Optional errno value associated with this error.
"""
_xapian.InvalidArgumentError_swiginit(self, _xapian.new_InvalidArgumentError(*args))
__swig_destroy__ = _xapian.delete_InvalidArgumentError
InvalidArgumentError_swigregister = _xapian.InvalidArgumentError_swigregister
InvalidArgumentError_swigregister(InvalidArgumentError)
[docs]class InvalidOperationError(LogicError):
"""
InvalidOperationError indicates the API was used in an invalid way.
"""
__swig_setmethods__ = {}
for _s in [LogicError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, InvalidOperationError, name, value)
__swig_getmethods__ = {}
for _s in [LogicError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, InvalidOperationError, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct from message and errno value.
Xapian::InvalidOperationError::InvalidOperationError(const std::string
&msg_, int errno_)
Parameters:
-----------
msg_: Message giving details of the error, intended for human
consumption.
errno_: Optional errno value associated with this error.
"""
_xapian.InvalidOperationError_swiginit(self, _xapian.new_InvalidOperationError(*args))
__swig_destroy__ = _xapian.delete_InvalidOperationError
InvalidOperationError_swigregister = _xapian.InvalidOperationError_swigregister
InvalidOperationError_swigregister(InvalidOperationError)
[docs]class UnimplementedError(LogicError):
"""
UnimplementedError indicates an attempt to use an unimplemented
feature.
"""
__swig_setmethods__ = {}
for _s in [LogicError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, UnimplementedError, name, value)
__swig_getmethods__ = {}
for _s in [LogicError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, UnimplementedError, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct from message and errno value.
Xapian::UnimplementedError::UnimplementedError(const std::string
&msg_, int errno_)
Parameters:
-----------
msg_: Message giving details of the error, intended for human
consumption.
errno_: Optional errno value associated with this error.
"""
_xapian.UnimplementedError_swiginit(self, _xapian.new_UnimplementedError(*args))
__swig_destroy__ = _xapian.delete_UnimplementedError
UnimplementedError_swigregister = _xapian.UnimplementedError_swigregister
UnimplementedError_swigregister(UnimplementedError)
[docs]class DatabaseError(RuntimeError):
"""
DatabaseError indicates some sort of database related error.
"""
__swig_setmethods__ = {}
for _s in [RuntimeError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseError, name, value)
__swig_getmethods__ = {}
for _s in [RuntimeError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, DatabaseError, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct from message and errno value.
Xapian::DatabaseError::DatabaseError(const std::string &msg_, int
errno_)
Parameters:
-----------
msg_: Message giving details of the error, intended for human
consumption.
errno_: Optional errno value associated with this error.
"""
_xapian.DatabaseError_swiginit(self, _xapian.new_DatabaseError(*args))
__swig_destroy__ = _xapian.delete_DatabaseError
DatabaseError_swigregister = _xapian.DatabaseError_swigregister
DatabaseError_swigregister(DatabaseError)
[docs]class DatabaseCorruptError(DatabaseError):
"""
DatabaseCorruptError indicates database corruption was detected.
"""
__swig_setmethods__ = {}
for _s in [DatabaseError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseCorruptError, name, value)
__swig_getmethods__ = {}
for _s in [DatabaseError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, DatabaseCorruptError, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct from message and errno value.
Xapian::DatabaseCorruptError::DatabaseCorruptError(const std::string
&msg_, int errno_)
Parameters:
-----------
msg_: Message giving details of the error, intended for human
consumption.
errno_: Optional errno value associated with this error.
"""
_xapian.DatabaseCorruptError_swiginit(self, _xapian.new_DatabaseCorruptError(*args))
__swig_destroy__ = _xapian.delete_DatabaseCorruptError
DatabaseCorruptError_swigregister = _xapian.DatabaseCorruptError_swigregister
DatabaseCorruptError_swigregister(DatabaseCorruptError)
[docs]class DatabaseCreateError(DatabaseError):
"""
DatabaseCreateError indicates a failure to create a database.
"""
__swig_setmethods__ = {}
for _s in [DatabaseError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseCreateError, name, value)
__swig_getmethods__ = {}
for _s in [DatabaseError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, DatabaseCreateError, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct from message and errno value.
Xapian::DatabaseCreateError::DatabaseCreateError(const std::string
&msg_, int errno_)
Parameters:
-----------
msg_: Message giving details of the error, intended for human
consumption.
errno_: Optional errno value associated with this error.
"""
_xapian.DatabaseCreateError_swiginit(self, _xapian.new_DatabaseCreateError(*args))
__swig_destroy__ = _xapian.delete_DatabaseCreateError
DatabaseCreateError_swigregister = _xapian.DatabaseCreateError_swigregister
DatabaseCreateError_swigregister(DatabaseCreateError)
[docs]class DatabaseLockError(DatabaseError):
"""
DatabaseLockError indicates failure to lock a database.
"""
__swig_setmethods__ = {}
for _s in [DatabaseError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseLockError, name, value)
__swig_getmethods__ = {}
for _s in [DatabaseError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, DatabaseLockError, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct from message and errno value.
Xapian::DatabaseLockError::DatabaseLockError(const std::string &msg_,
int errno_)
Parameters:
-----------
msg_: Message giving details of the error, intended for human
consumption.
errno_: Optional errno value associated with this error.
"""
_xapian.DatabaseLockError_swiginit(self, _xapian.new_DatabaseLockError(*args))
__swig_destroy__ = _xapian.delete_DatabaseLockError
DatabaseLockError_swigregister = _xapian.DatabaseLockError_swigregister
DatabaseLockError_swigregister(DatabaseLockError)
[docs]class DatabaseModifiedError(DatabaseError):
"""
DatabaseModifiedError indicates a database was modified.
To recover after catching this error, you need to call
Xapian::Database::reopen() on the Database and repeat the operation
which failed.
"""
__swig_setmethods__ = {}
for _s in [DatabaseError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseModifiedError, name, value)
__swig_getmethods__ = {}
for _s in [DatabaseError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, DatabaseModifiedError, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct from message and errno value.
Xapian::DatabaseModifiedError::DatabaseModifiedError(const std::string
&msg_, int errno_)
Parameters:
-----------
msg_: Message giving details of the error, intended for human
consumption.
errno_: Optional errno value associated with this error.
"""
_xapian.DatabaseModifiedError_swiginit(self, _xapian.new_DatabaseModifiedError(*args))
__swig_destroy__ = _xapian.delete_DatabaseModifiedError
DatabaseModifiedError_swigregister = _xapian.DatabaseModifiedError_swigregister
DatabaseModifiedError_swigregister(DatabaseModifiedError)
[docs]class DatabaseOpeningError(DatabaseError):
"""
DatabaseOpeningError indicates failure to open a database.
"""
__swig_setmethods__ = {}
for _s in [DatabaseError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseOpeningError, name, value)
__swig_getmethods__ = {}
for _s in [DatabaseError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, DatabaseOpeningError, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct from message and errno value.
Xapian::DatabaseOpeningError::DatabaseOpeningError(const std::string
&msg_, int errno_)
Parameters:
-----------
msg_: Message giving details of the error, intended for human
consumption.
errno_: Optional errno value associated with this error.
"""
_xapian.DatabaseOpeningError_swiginit(self, _xapian.new_DatabaseOpeningError(*args))
__swig_destroy__ = _xapian.delete_DatabaseOpeningError
DatabaseOpeningError_swigregister = _xapian.DatabaseOpeningError_swigregister
DatabaseOpeningError_swigregister(DatabaseOpeningError)
[docs]class DatabaseVersionError(DatabaseOpeningError):
"""
DatabaseVersionError indicates that a database is in an unsupported
format.
From time to time, new versions of Xapian will require the database
format to be changed, to allow new information to be stored or new
optimisations to be performed. Backwards compatibility will sometimes
be maintained, so that new versions of Xapian can open old databases,
but in some cases Xapian will be unable to open a database because it
is in too old (or new) a format. This can be resolved either be
upgrading or downgrading the version of Xapian in use, or by
rebuilding the database from scratch with the current version of
Xapian.
"""
__swig_setmethods__ = {}
for _s in [DatabaseOpeningError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseVersionError, name, value)
__swig_getmethods__ = {}
for _s in [DatabaseOpeningError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, DatabaseVersionError, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct from message and errno value.
Xapian::DatabaseVersionError::DatabaseVersionError(const std::string
&msg_, int errno_)
Parameters:
-----------
msg_: Message giving details of the error, intended for human
consumption.
errno_: Optional errno value associated with this error.
"""
_xapian.DatabaseVersionError_swiginit(self, _xapian.new_DatabaseVersionError(*args))
__swig_destroy__ = _xapian.delete_DatabaseVersionError
DatabaseVersionError_swigregister = _xapian.DatabaseVersionError_swigregister
DatabaseVersionError_swigregister(DatabaseVersionError)
[docs]class DocNotFoundError(RuntimeError):
"""
Indicates an attempt to access a document not present in the database.
"""
__swig_setmethods__ = {}
for _s in [RuntimeError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, DocNotFoundError, name, value)
__swig_getmethods__ = {}
for _s in [RuntimeError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, DocNotFoundError, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct from message and errno value.
Xapian::DocNotFoundError::DocNotFoundError(const std::string &msg_,
int errno_)
Parameters:
-----------
msg_: Message giving details of the error, intended for human
consumption.
errno_: Optional errno value associated with this error.
"""
_xapian.DocNotFoundError_swiginit(self, _xapian.new_DocNotFoundError(*args))
__swig_destroy__ = _xapian.delete_DocNotFoundError
DocNotFoundError_swigregister = _xapian.DocNotFoundError_swigregister
DocNotFoundError_swigregister(DocNotFoundError)
[docs]class FeatureUnavailableError(RuntimeError):
"""
Indicates an attempt to use a feature which is unavailable.
Typically a feature is unavailable because it wasn't compiled in, or
because it requires other software or facilities which aren't
available.
"""
__swig_setmethods__ = {}
for _s in [RuntimeError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, FeatureUnavailableError, name, value)
__swig_getmethods__ = {}
for _s in [RuntimeError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, FeatureUnavailableError, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct from message and errno value.
Xapian::FeatureUnavailableError::FeatureUnavailableError(const
std::string &msg_, int errno_)
Parameters:
-----------
msg_: Message giving details of the error, intended for human
consumption.
errno_: Optional errno value associated with this error.
"""
_xapian.FeatureUnavailableError_swiginit(self, _xapian.new_FeatureUnavailableError(*args))
__swig_destroy__ = _xapian.delete_FeatureUnavailableError
FeatureUnavailableError_swigregister = _xapian.FeatureUnavailableError_swigregister
FeatureUnavailableError_swigregister(FeatureUnavailableError)
[docs]class InternalError(RuntimeError):
"""
InternalError indicates a runtime problem of some sort.
"""
__swig_setmethods__ = {}
for _s in [RuntimeError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, InternalError, name, value)
__swig_getmethods__ = {}
for _s in [RuntimeError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, InternalError, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct from message and errno value.
Xapian::InternalError::InternalError(const std::string &msg_, int
errno_)
Parameters:
-----------
msg_: Message giving details of the error, intended for human
consumption.
errno_: Optional errno value associated with this error.
"""
_xapian.InternalError_swiginit(self, _xapian.new_InternalError(*args))
__swig_destroy__ = _xapian.delete_InternalError
InternalError_swigregister = _xapian.InternalError_swigregister
InternalError_swigregister(InternalError)
[docs]class NetworkError(RuntimeError):
"""
Indicates a problem communicating with a remote database.
"""
__swig_setmethods__ = {}
for _s in [RuntimeError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, NetworkError, name, value)
__swig_getmethods__ = {}
for _s in [RuntimeError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, NetworkError, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct from message and errno value.
Xapian::NetworkError::NetworkError(const std::string &msg_, int
errno_)
Parameters:
-----------
msg_: Message giving details of the error, intended for human
consumption.
errno_: Optional errno value associated with this error.
"""
_xapian.NetworkError_swiginit(self, _xapian.new_NetworkError(*args))
__swig_destroy__ = _xapian.delete_NetworkError
NetworkError_swigregister = _xapian.NetworkError_swigregister
NetworkError_swigregister(NetworkError)
[docs]class NetworkTimeoutError(NetworkError):
"""
Indicates a timeout expired while communicating with a remote
database.
"""
__swig_setmethods__ = {}
for _s in [NetworkError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, NetworkTimeoutError, name, value)
__swig_getmethods__ = {}
for _s in [NetworkError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, NetworkTimeoutError, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct from message and errno value.
Xapian::NetworkTimeoutError::NetworkTimeoutError(const std::string
&msg_, int errno_)
Parameters:
-----------
msg_: Message giving details of the error, intended for human
consumption.
errno_: Optional errno value associated with this error.
"""
_xapian.NetworkTimeoutError_swiginit(self, _xapian.new_NetworkTimeoutError(*args))
__swig_destroy__ = _xapian.delete_NetworkTimeoutError
NetworkTimeoutError_swigregister = _xapian.NetworkTimeoutError_swigregister
NetworkTimeoutError_swigregister(NetworkTimeoutError)
[docs]class QueryParserError(RuntimeError):
"""
Indicates a query string can't be parsed.
"""
__swig_setmethods__ = {}
for _s in [RuntimeError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, QueryParserError, name, value)
__swig_getmethods__ = {}
for _s in [RuntimeError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, QueryParserError, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct from message and errno value.
Xapian::QueryParserError::QueryParserError(const std::string &msg_,
int errno_)
Parameters:
-----------
msg_: Message giving details of the error, intended for human
consumption.
errno_: Optional errno value associated with this error.
"""
_xapian.QueryParserError_swiginit(self, _xapian.new_QueryParserError(*args))
__swig_destroy__ = _xapian.delete_QueryParserError
QueryParserError_swigregister = _xapian.QueryParserError_swigregister
QueryParserError_swigregister(QueryParserError)
[docs]class SerialisationError(RuntimeError):
"""
Indicates an error in the std::string serialisation of an object.
"""
__swig_setmethods__ = {}
for _s in [RuntimeError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, SerialisationError, name, value)
__swig_getmethods__ = {}
for _s in [RuntimeError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, SerialisationError, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct from message and errno value.
Xapian::SerialisationError::SerialisationError(const std::string
&msg_, int errno_)
Parameters:
-----------
msg_: Message giving details of the error, intended for human
consumption.
errno_: Optional errno value associated with this error.
"""
_xapian.SerialisationError_swiginit(self, _xapian.new_SerialisationError(*args))
__swig_destroy__ = _xapian.delete_SerialisationError
SerialisationError_swigregister = _xapian.SerialisationError_swigregister
SerialisationError_swigregister(SerialisationError)
[docs]class RangeError(RuntimeError):
"""
RangeError indicates an attempt to access outside the bounds of a
container.
"""
__swig_setmethods__ = {}
for _s in [RuntimeError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, RangeError, name, value)
__swig_getmethods__ = {}
for _s in [RuntimeError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, RangeError, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct from message and errno value.
Xapian::RangeError::RangeError(const std::string &msg_, int errno_)
Parameters:
-----------
msg_: Message giving details of the error, intended for human
consumption.
errno_: Optional errno value associated with this error.
"""
_xapian.RangeError_swiginit(self, _xapian.new_RangeError(*args))
__swig_destroy__ = _xapian.delete_RangeError
RangeError_swigregister = _xapian.RangeError_swigregister
RangeError_swigregister(RangeError)
[docs]class WildcardError(RuntimeError):
"""
WildcardError indicates an error expanding a wildcarded query.
"""
__swig_setmethods__ = {}
for _s in [RuntimeError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, WildcardError, name, value)
__swig_getmethods__ = {}
for _s in [RuntimeError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, WildcardError, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct from message and errno value.
Xapian::WildcardError::WildcardError(const std::string &msg_, int
errno_)
Parameters:
-----------
msg_: Message giving details of the error, intended for human
consumption.
errno_: Optional errno value associated with this error.
"""
_xapian.WildcardError_swiginit(self, _xapian.new_WildcardError(*args))
__swig_destroy__ = _xapian.delete_WildcardError
WildcardError_swigregister = _xapian.WildcardError_swigregister
WildcardError_swigregister(WildcardError)
[docs]class DatabaseNotFoundError(DatabaseOpeningError):
"""
Indicates an attempt to access a database not present.
"""
__swig_setmethods__ = {}
for _s in [DatabaseOpeningError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseNotFoundError, name, value)
__swig_getmethods__ = {}
for _s in [DatabaseOpeningError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, DatabaseNotFoundError, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct from message and errno value.
Xapian::DatabaseNotFoundError::DatabaseNotFoundError(const std::string
&msg_, int errno_)
Parameters:
-----------
msg_: Message giving details of the error, intended for human
consumption.
errno_: Optional errno value associated with this error.
"""
_xapian.DatabaseNotFoundError_swiginit(self, _xapian.new_DatabaseNotFoundError(*args))
__swig_destroy__ = _xapian.delete_DatabaseNotFoundError
DatabaseNotFoundError_swigregister = _xapian.DatabaseNotFoundError_swigregister
DatabaseNotFoundError_swigregister(DatabaseNotFoundError)
[docs]class DatabaseClosedError(DatabaseError):
"""
Indicates an attempt to access a closed database.
"""
__swig_setmethods__ = {}
for _s in [DatabaseError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseClosedError, name, value)
__swig_getmethods__ = {}
for _s in [DatabaseError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, DatabaseClosedError, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct from message and errno value.
Xapian::DatabaseClosedError::DatabaseClosedError(const std::string
&msg_, int errno_)
Parameters:
-----------
msg_: Message giving details of the error, intended for human
consumption.
errno_: Optional errno value associated with this error.
"""
_xapian.DatabaseClosedError_swiginit(self, _xapian.new_DatabaseClosedError(*args))
__swig_destroy__ = _xapian.delete_DatabaseClosedError
DatabaseClosedError_swigregister = _xapian.DatabaseClosedError_swigregister
DatabaseClosedError_swigregister(DatabaseClosedError)
def version_string():
return _xapian.version_string()
version_string = _xapian.version_string
def major_version():
return _xapian.major_version()
major_version = _xapian.major_version
def minor_version():
return _xapian.minor_version()
minor_version = _xapian.minor_version
def revision():
return _xapian.revision()
revision = _xapian.revision
BAD_VALUENO = _xapian.BAD_VALUENO
DB_CREATE = _xapian.DB_CREATE
DB_CREATE_OR_OPEN = _xapian.DB_CREATE_OR_OPEN
DB_CREATE_OR_OVERWRITE = _xapian.DB_CREATE_OR_OVERWRITE
DB_OPEN = _xapian.DB_OPEN
DB_NO_SYNC = _xapian.DB_NO_SYNC
DB_FULL_SYNC = _xapian.DB_FULL_SYNC
DB_DANGEROUS = _xapian.DB_DANGEROUS
DB_NO_TERMLIST = _xapian.DB_NO_TERMLIST
DB_BACKEND_CHERT = _xapian.DB_BACKEND_CHERT
DB_BACKEND_GLASS = _xapian.DB_BACKEND_GLASS
DB_BACKEND_INMEMORY = _xapian.DB_BACKEND_INMEMORY
DB_BACKEND_STUB = _xapian.DB_BACKEND_STUB
DB_RETRY_LOCK = _xapian.DB_RETRY_LOCK
DBCHECK_SHORT_TREE = _xapian.DBCHECK_SHORT_TREE
DBCHECK_FULL_TREE = _xapian.DBCHECK_FULL_TREE
DBCHECK_SHOW_FREELIST = _xapian.DBCHECK_SHOW_FREELIST
DBCHECK_SHOW_STATS = _xapian.DBCHECK_SHOW_STATS
DBCHECK_FIX = _xapian.DBCHECK_FIX
DBCOMPACT_MULTIPASS = _xapian.DBCOMPACT_MULTIPASS
DBCOMPACT_NO_RENUMBER = _xapian.DBCOMPACT_NO_RENUMBER
DBCOMPACT_SINGLE_FILE = _xapian.DBCOMPACT_SINGLE_FILE
DOC_ASSUME_VALID = _xapian.DOC_ASSUME_VALID
class _PositionIterator(object):
"""
Class for iterating over term positions.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self):
"""
Default constructor.
Xapian::PositionIterator::PositionIterator()
Creates an uninitialised iterator, which can't be used before being
assigned to, but is sometimes syntactically convenient.
"""
_xapian._PositionIterator_swiginit(self, _xapian.new__PositionIterator())
__swig_destroy__ = _xapian.delete__PositionIterator
def skip_to(self, termpos):
"""
Advance the iterator to term position termpos.
void Xapian::PositionIterator::skip_to(Xapian::termpos termpos)
Parameters:
-----------
termpos: The position to advance to. If this position isn't in the
stream being iterated, then the iterator is moved to the next term
position after it which is.
"""
return _xapian._PositionIterator_skip_to(self, termpos)
def __str__(self):
"""
Return a string describing this object.
std::string Xapian::PositionIterator::get_description() const
"""
return _xapian._PositionIterator___str__(self)
_PositionIterator.skip_to = _xapian.SWIG_PyInstanceMethod_New(_xapian._PositionIterator_skip_to)
_PositionIterator.__str__ = _xapian.SWIG_PyInstanceMethod_New(_xapian._PositionIterator___str__)
_PositionIterator.__eq__ = _xapian.SWIG_PyInstanceMethod_New(_xapian._PositionIterator___eq__)
_PositionIterator.__ne__ = _xapian.SWIG_PyInstanceMethod_New(_xapian._PositionIterator___ne__)
_PositionIterator.equals = _xapian.SWIG_PyInstanceMethod_New(_xapian._PositionIterator_equals)
_PositionIterator.get_termpos = _xapian.SWIG_PyInstanceMethod_New(_xapian._PositionIterator_get_termpos)
_PositionIterator.__next__ = _xapian.SWIG_PyInstanceMethod_New(_xapian._PositionIterator___next__)
_PositionIterator_swigregister = _xapian._PositionIterator_swigregister
_PositionIterator_swigregister(_PositionIterator)
class _PostingIterator(object):
"""
Class for iterating over a list of terms.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self):
"""
Default constructor.
Xapian::PostingIterator::PostingIterator()
Creates an uninitialised iterator, which can't be used before being
assigned to, but is sometimes syntactically convenient.
"""
_xapian._PostingIterator_swiginit(self, _xapian.new__PostingIterator())
__swig_destroy__ = _xapian.delete__PostingIterator
def get_wdf(self):
"""
Return the wdf for the document at the current position.
Xapian::termcount Xapian::PostingIterator::get_wdf() const
"""
return _xapian._PostingIterator_get_wdf(self)
def get_doclength(self):
"""
Return the length of the document at the current position.
Xapian::termcount Xapian::PostingIterator::get_doclength() const
"""
return _xapian._PostingIterator_get_doclength(self)
def get_unique_terms(self):
"""
Return the number of unique terms in the current document.
Xapian::termcount Xapian::PostingIterator::get_unique_terms() const
"""
return _xapian._PostingIterator_get_unique_terms(self)
def _positionlist_begin(self):
"""
Return a PositionIterator for the current document.
PositionIterator Xapian::PostingIterator::positionlist_begin() const
"""
return _xapian._PostingIterator__positionlist_begin(self)
def _positionlist_end(self):
"""
Return an end PositionIterator for the current document.
PositionIterator Xapian::PostingIterator::positionlist_end() const
"""
return _xapian._PostingIterator__positionlist_end(self)
def skip_to(self, did):
"""
Advance the iterator to document did.
void Xapian::PostingIterator::skip_to(Xapian::docid did)
Parameters:
-----------
did: The document id to advance to. If this document id isn't in the
stream being iterated, then the iterator is moved to the next document
id after it which is.
"""
return _xapian._PostingIterator_skip_to(self, did)
def __str__(self):
"""
Return a string describing this object.
std::string Xapian::PostingIterator::get_description() const
"""
return _xapian._PostingIterator___str__(self)
_PostingIterator.get_wdf = _xapian.SWIG_PyInstanceMethod_New(_xapian._PostingIterator_get_wdf)
_PostingIterator.get_doclength = _xapian.SWIG_PyInstanceMethod_New(_xapian._PostingIterator_get_doclength)
_PostingIterator.get_unique_terms = _xapian.SWIG_PyInstanceMethod_New(_xapian._PostingIterator_get_unique_terms)
_PostingIterator._positionlist_begin = _xapian.SWIG_PyInstanceMethod_New(_xapian._PostingIterator__positionlist_begin)
_PostingIterator._positionlist_end = _xapian.SWIG_PyInstanceMethod_New(_xapian._PostingIterator__positionlist_end)
_PostingIterator.skip_to = _xapian.SWIG_PyInstanceMethod_New(_xapian._PostingIterator_skip_to)
_PostingIterator.__str__ = _xapian.SWIG_PyInstanceMethod_New(_xapian._PostingIterator___str__)
_PostingIterator.__eq__ = _xapian.SWIG_PyInstanceMethod_New(_xapian._PostingIterator___eq__)
_PostingIterator.__ne__ = _xapian.SWIG_PyInstanceMethod_New(_xapian._PostingIterator___ne__)
_PostingIterator.equals = _xapian.SWIG_PyInstanceMethod_New(_xapian._PostingIterator_equals)
_PostingIterator.get_docid = _xapian.SWIG_PyInstanceMethod_New(_xapian._PostingIterator_get_docid)
_PostingIterator.__next__ = _xapian.SWIG_PyInstanceMethod_New(_xapian._PostingIterator___next__)
_PostingIterator_swigregister = _xapian._PostingIterator_swigregister
_PostingIterator_swigregister(_PostingIterator)
class _TermIterator(object):
"""
Class for iterating over a list of terms.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self):
"""
Default constructor.
Xapian::TermIterator::TermIterator()
Creates an uninitialised iterator, which can't be used before being
assigned to, but is sometimes syntactically convenient.
"""
_xapian._TermIterator_swiginit(self, _xapian.new__TermIterator())
__swig_destroy__ = _xapian.delete__TermIterator
def get_wdf(self):
"""
Return the wdf for the term at the current position.
Xapian::termcount Xapian::TermIterator::get_wdf() const
"""
return _xapian._TermIterator_get_wdf(self)
def get_termfreq(self):
"""
Return the term frequency for the term at the current position.
Xapian::doccount Xapian::TermIterator::get_termfreq() const
"""
return _xapian._TermIterator_get_termfreq(self)
def positionlist_count(self):
"""
Return the length of the position list for the current position.
Xapian::termcount Xapian::TermIterator::positionlist_count() const
"""
return _xapian._TermIterator_positionlist_count(self)
def _positionlist_begin(self):
"""
Return a PositionIterator for the current term.
PositionIterator Xapian::TermIterator::positionlist_begin() const
"""
return _xapian._TermIterator__positionlist_begin(self)
def _positionlist_end(self):
"""
Return an end PositionIterator for the current term.
PositionIterator Xapian::TermIterator::positionlist_end() const
"""
return _xapian._TermIterator__positionlist_end(self)
def skip_to(self, term):
"""
Advance the iterator to term term.
void Xapian::TermIterator::skip_to(const std::string &term)
If the iteration is over an unsorted list of terms, then this method
will throw Xapian::InvalidOperationError.
Parameters:
-----------
term: The term to advance to. If this term isn't in the stream being
iterated, then the iterator is moved to the next term after it which
is.
"""
return _xapian._TermIterator_skip_to(self, term)
def __str__(self):
"""
Return a string describing this object.
std::string Xapian::TermIterator::get_description() const
"""
return _xapian._TermIterator___str__(self)
_TermIterator.get_wdf = _xapian.SWIG_PyInstanceMethod_New(_xapian._TermIterator_get_wdf)
_TermIterator.get_termfreq = _xapian.SWIG_PyInstanceMethod_New(_xapian._TermIterator_get_termfreq)
_TermIterator.positionlist_count = _xapian.SWIG_PyInstanceMethod_New(_xapian._TermIterator_positionlist_count)
_TermIterator._positionlist_begin = _xapian.SWIG_PyInstanceMethod_New(_xapian._TermIterator__positionlist_begin)
_TermIterator._positionlist_end = _xapian.SWIG_PyInstanceMethod_New(_xapian._TermIterator__positionlist_end)
_TermIterator.skip_to = _xapian.SWIG_PyInstanceMethod_New(_xapian._TermIterator_skip_to)
_TermIterator.__str__ = _xapian.SWIG_PyInstanceMethod_New(_xapian._TermIterator___str__)
_TermIterator.__eq__ = _xapian.SWIG_PyInstanceMethod_New(_xapian._TermIterator___eq__)
_TermIterator.__ne__ = _xapian.SWIG_PyInstanceMethod_New(_xapian._TermIterator___ne__)
_TermIterator.equals = _xapian.SWIG_PyInstanceMethod_New(_xapian._TermIterator_equals)
_TermIterator.get_term = _xapian.SWIG_PyInstanceMethod_New(_xapian._TermIterator_get_term)
_TermIterator.__next__ = _xapian.SWIG_PyInstanceMethod_New(_xapian._TermIterator___next__)
_TermIterator_swigregister = _xapian._TermIterator_swigregister
_TermIterator_swigregister(_TermIterator)
class _ValueIterator(object):
"""
Class for iterating over document values.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self):
"""
Default constructor.
Xapian::ValueIterator::ValueIterator()
Creates an uninitialised iterator, which can't be used before being
assigned to, but is sometimes syntactically convenient.
"""
_xapian._ValueIterator_swiginit(self, _xapian.new__ValueIterator())
__swig_destroy__ = _xapian.delete__ValueIterator
def get_docid(self):
"""
Return the docid at the current position.
Xapian::docid Xapian::ValueIterator::get_docid() const
If we're iterating over values of a document, this method will throw
Xapian::InvalidOperationError.
"""
return _xapian._ValueIterator_get_docid(self)
def get_valueno(self):
"""
Return the value slot number for the current position.
Xapian::valueno Xapian::ValueIterator::get_valueno() const
If the iterator is over all values in a slot, this returns that slot's
number. If the iterator is over the values in a particular document,
it returns the number of each slot in turn.
"""
return _xapian._ValueIterator_get_valueno(self)
def skip_to(self, docid_or_slot):
"""
Advance the iterator to document id or value slot docid_or_slot.
void Xapian::ValueIterator::skip_to(Xapian::docid docid_or_slot)
If this iterator is over values in a document, then this method
advances the iterator to value slot docid_or_slot, or the first slot
after it if there is no value in slot slot.
If this iterator is over values in a particular slot, then this method
advances the iterator to document id docid_or_slot, or the first
document id after it if there is no value in the slot we're iterating
over for document docid_or_slot.
Note: The "two-faced" nature of this method is due to how C++
overloading works. Xapian::docid and Xapian::valueno are both typedefs
for the same unsigned integer type, so overloading can't distinguish
them.
Parameters:
-----------
docid_or_slot: The docid/slot to advance to.
"""
return _xapian._ValueIterator_skip_to(self, docid_or_slot)
def check(self, docid):
"""
Check if the specified docid occurs.
bool Xapian::ValueIterator::check(Xapian::docid docid)
The caller is required to ensure that the specified document id did
actually exists in the database.
This method acts like skip_to() if that can be done at little extra
cost, in which case it then returns true. This is how chert and glass
databases behave because they store values in streams which allow for
an efficient implementation of skip_to().
Otherwise it simply checks if a particular docid is present. If it is,
it returns true. If it isn't, it returns false, and leaves the
position unspecified (and hence the result of calling methods which
depend on the current position, such as get_docid(), are also
unspecified). In this state, next() will advance to the first matching
position after document did, and skip_to() will act as it would if the
position was the first matching position after document did.
Currently the inmemory and remote backends behave in the latter way
because they don't support streamed values and so skip_to() must check
each document it skips over which is significantly slower.
Parameters:
-----------
docid: The document id to check.
"""
return _xapian._ValueIterator_check(self, docid)
def __str__(self):
"""
Return a string describing this object.
std::string Xapian::ValueIterator::get_description() const
"""
return _xapian._ValueIterator___str__(self)
_ValueIterator.get_docid = _xapian.SWIG_PyInstanceMethod_New(_xapian._ValueIterator_get_docid)
_ValueIterator.get_valueno = _xapian.SWIG_PyInstanceMethod_New(_xapian._ValueIterator_get_valueno)
_ValueIterator.skip_to = _xapian.SWIG_PyInstanceMethod_New(_xapian._ValueIterator_skip_to)
_ValueIterator.check = _xapian.SWIG_PyInstanceMethod_New(_xapian._ValueIterator_check)
_ValueIterator.__str__ = _xapian.SWIG_PyInstanceMethod_New(_xapian._ValueIterator___str__)
_ValueIterator.__eq__ = _xapian.SWIG_PyInstanceMethod_New(_xapian._ValueIterator___eq__)
_ValueIterator.__ne__ = _xapian.SWIG_PyInstanceMethod_New(_xapian._ValueIterator___ne__)
_ValueIterator.equals = _xapian.SWIG_PyInstanceMethod_New(_xapian._ValueIterator_equals)
_ValueIterator.get_value = _xapian.SWIG_PyInstanceMethod_New(_xapian._ValueIterator_get_value)
_ValueIterator.__next__ = _xapian.SWIG_PyInstanceMethod_New(_xapian._ValueIterator___next__)
_ValueIterator_swigregister = _xapian._ValueIterator_swigregister
_ValueIterator_swigregister(_ValueIterator)
[docs]class Document(object):
"""
A handle representing a document in a Xapian database.
The Document class fetches information from the database lazily.
Usually this behaviour isn't visible to users (except for the speed
benefits), but if the document in the database is modified or deleted,
then preexisting Document objects may return the old or new versions
of data (or throw Xapian::DocNotFoundError in the case of deletion).
Since Database objects work on a snapshot of the database's state, the
situation above can only happen with a WritableDatabase object, or if
you call Database::reopen() on a Database object.
We recommend you avoid designs where this behaviour is an issue, but
if you need a way to make a non-lazy version of a Document object, you
can do this like so:doc =
Xapian::Document::unserialise(doc.serialise());
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self):
"""
Make a new empty Document.
Xapian::Document::Document()
"""
_xapian.Document_swiginit(self, _xapian.new_Document())
__swig_destroy__ = _xapian.delete_Document
def get_value(self, slot):
"""
Get value by number.
std::string Xapian::Document::get_value(Xapian::valueno slot) const
Returns an empty string if no value with the given number is present
in the document.
Parameters:
-----------
slot: The number of the value.
"""
return _xapian.Document_get_value(self, slot)
def add_value(self, slot, value):
"""
Add a new value.
void Xapian::Document::add_value(Xapian::valueno slot, const
std::string &value)
The new value will replace any existing value with the same number (or
if the new value is empty, it will remove any existing value with the
same number).
Parameters:
-----------
slot: The value slot to add the value in.
value: The value to set.
"""
return _xapian.Document_add_value(self, slot, value)
def remove_value(self, slot):
"""
Remove any value with the given number.
void Xapian::Document::remove_value(Xapian::valueno slot)
"""
return _xapian.Document_remove_value(self, slot)
def clear_values(self):
"""
Remove all values associated with the document.
void Xapian::Document::clear_values()
"""
return _xapian.Document_clear_values(self)
def get_data(self):
"""
Get data stored in the document.
std::string Xapian::Document::get_data() const
This is potentially a relatively expensive operation, and shouldn't
normally be used during the match (e.g. in a PostingSource or match
decider functor. Put data for use by match deciders in a value
instead.
"""
return _xapian.Document_get_data(self)
def set_data(self, data):
"""
Set data stored in the document.
void Xapian::Document::set_data(const std::string &data)
Xapian treats the data as an opaque blob. It may try to compress it,
but other than that it will just store it and return it when
requested.
Parameters:
-----------
data: The data to store.
"""
return _xapian.Document_set_data(self, data)
def add_posting(self, tname, tpos, wdfinc=1):
"""
Add an occurrence of a term at a particular position.
void Xapian::Document::add_posting(const std::string &tname,
Xapian::termpos tpos, Xapian::termcount wdfinc=1)
Multiple occurrences of the term at the same position are represented
only once in the positional information, but do increase the wdf.
If the term is not already in the document, it will be added to it.
Parameters:
-----------
tname: The name of the term.
tpos: The position of the term.
wdfinc: The increment that will be applied to the wdf for this term.
"""
return _xapian.Document_add_posting(self, tname, tpos, wdfinc)
def add_term(self, tname, wdfinc=1):
"""
Add a term to the document, without positional information.
void Xapian::Document::add_term(const std::string &tname,
Xapian::termcount wdfinc=1)
Any existing positional information for the term will be left
unmodified.
Parameters:
-----------
tname: The name of the term.
wdfinc: The increment that will be applied to the wdf for this term
(default: 1).
"""
return _xapian.Document_add_term(self, tname, wdfinc)
def add_boolean_term(self, term):
"""
Add a boolean filter term to the document.
void Xapian::Document::add_boolean_term(const std::string &term)
This method adds term to the document with wdf of 0 - this is
generally what you want for a term used for boolean filtering as the
wdf of such terms is ignored, and it doesn't make sense for them to
contribute to the document's length.
If the specified term already indexes this document, this method has
no effect.
It is exactly the same as add_term(term, 0).
This method was added in Xapian 1.0.18.
Parameters:
-----------
term: The term to add.
"""
return _xapian.Document_add_boolean_term(self, term)
def remove_posting(self, tname, tpos, wdfdec=1):
"""
Remove a posting of a term from the document.
void Xapian::Document::remove_posting(const std::string &tname,
Xapian::termpos tpos, Xapian::termcount wdfdec=1)
Note that the term will still index the document even if all
occurrences are removed. To remove a term from a document completely,
use remove_term().
Parameters:
-----------
tname: The name of the term.
tpos: The position of the term.
wdfdec: The decrement that will be applied to the wdf when removing
this posting. The wdf will not go below the value of 0.
Parameters:
-----------
Xapian::InvalidArgumentError: will be thrown if the term is not at
the position specified in the position list for this term in this
document.
Xapian::InvalidArgumentError: will be thrown if the term is not in
the document
"""
return _xapian.Document_remove_posting(self, tname, tpos, wdfdec)
def remove_postings(self, term, term_pos_first, term_pos_last, wdf_dec=1):
"""
Remove a range of postings for a term.
Xapian::termpos Xapian::Document::remove_postings(const std::string
&term, Xapian::termpos term_pos_first, Xapian::termpos term_pos_last,
Xapian::termcount wdf_dec=1)
Any instances of the term at positions >= term_pos_first and <=
term_pos_last will be removed, and the wdf reduced by wdf_dec for each
instance removed (the wdf will not ever go below zero though).
It's OK if the term doesn't occur in the range of positions specified
(unlike remove_posting()). And if term_pos_first > term_pos_last,
this method does nothing.
The number of postings removed.
Parameters:
-----------
Xapian::InvalidArgumentError: will be thrown if the term is not in
the document
"""
return _xapian.Document_remove_postings(self, term, term_pos_first, term_pos_last, wdf_dec)
def remove_term(self, tname):
"""
Remove a term and all postings associated with it.
void Xapian::Document::remove_term(const std::string &tname)
Parameters:
-----------
tname: The name of the term.
Parameters:
-----------
Xapian::InvalidArgumentError: will be thrown if the term is not in
the document
"""
return _xapian.Document_remove_term(self, tname)
def clear_terms(self):
"""
Remove all terms (and postings) from the document.
void Xapian::Document::clear_terms()
"""
return _xapian.Document_clear_terms(self)
def termlist_count(self):
"""
The length of the termlist - i.e.
Xapian::termcount Xapian::Document::termlist_count() const
the number of different terms which index this document.
"""
return _xapian.Document_termlist_count(self)
def _termlist_begin(self):
"""
Iterator for the terms in this document.
TermIterator Xapian::Document::termlist_begin() const
"""
return _xapian.Document__termlist_begin(self)
def _termlist_end(self):
"""
Equivalent end iterator for termlist_begin().
TermIterator Xapian::Document::termlist_end() const
"""
return _xapian.Document__termlist_end(self)
def values_count(self):
"""
Count the values in this document.
Xapian::termcount Xapian::Document::values_count() const
"""
return _xapian.Document_values_count(self)
def _values_begin(self):
"""
Iterator for the values in this document.
ValueIterator Xapian::Document::values_begin() const
"""
return _xapian.Document__values_begin(self)
def _values_end(self):
"""
Equivalent end iterator for values_begin().
ValueIterator Xapian::Document::values_end() const
"""
return _xapian.Document__values_end(self)
def get_docid(self):
"""
Get the document id which is associated with this document (if any).
docid Xapian::Document::get_docid() const
NB If multiple databases are being searched together, then this will
be the document id in the individual database, not the merged
database!
If this document came from a database, return the document id in that
database. Otherwise, return 0 (in Xapian 1.0.22/1.2.4 or later; prior
to this the returned value was uninitialised).
"""
return _xapian.Document_get_docid(self)
def serialise(self):
"""
Serialise document into a string.
std::string Xapian::Document::serialise() const
The document representation may change between Xapian releases: even
between minor versions. However, it is guaranteed not to change if the
remote database protocol has not changed between releases.
"""
return _xapian.Document_serialise(self)
unserialise = staticmethod(_xapian.Document_unserialise)
def __str__(self):
"""
Return a string describing this object.
std::string Xapian::Document::get_description() const
"""
return _xapian.Document___str__(self)
Document.get_value = _xapian.SWIG_PyInstanceMethod_New(_xapian.Document_get_value)
Document.add_value = _xapian.SWIG_PyInstanceMethod_New(_xapian.Document_add_value)
Document.remove_value = _xapian.SWIG_PyInstanceMethod_New(_xapian.Document_remove_value)
Document.clear_values = _xapian.SWIG_PyInstanceMethod_New(_xapian.Document_clear_values)
Document.get_data = _xapian.SWIG_PyInstanceMethod_New(_xapian.Document_get_data)
Document.set_data = _xapian.SWIG_PyInstanceMethod_New(_xapian.Document_set_data)
Document.add_posting = _xapian.SWIG_PyInstanceMethod_New(_xapian.Document_add_posting)
Document.add_term = _xapian.SWIG_PyInstanceMethod_New(_xapian.Document_add_term)
Document.add_boolean_term = _xapian.SWIG_PyInstanceMethod_New(_xapian.Document_add_boolean_term)
Document.remove_posting = _xapian.SWIG_PyInstanceMethod_New(_xapian.Document_remove_posting)
Document.remove_postings = _xapian.SWIG_PyInstanceMethod_New(_xapian.Document_remove_postings)
Document.remove_term = _xapian.SWIG_PyInstanceMethod_New(_xapian.Document_remove_term)
Document.clear_terms = _xapian.SWIG_PyInstanceMethod_New(_xapian.Document_clear_terms)
Document.termlist_count = _xapian.SWIG_PyInstanceMethod_New(_xapian.Document_termlist_count)
Document._termlist_begin = _xapian.SWIG_PyInstanceMethod_New(_xapian.Document__termlist_begin)
Document._termlist_end = _xapian.SWIG_PyInstanceMethod_New(_xapian.Document__termlist_end)
Document.values_count = _xapian.SWIG_PyInstanceMethod_New(_xapian.Document_values_count)
Document._values_begin = _xapian.SWIG_PyInstanceMethod_New(_xapian.Document__values_begin)
Document._values_end = _xapian.SWIG_PyInstanceMethod_New(_xapian.Document__values_end)
Document.get_docid = _xapian.SWIG_PyInstanceMethod_New(_xapian.Document_get_docid)
Document.serialise = _xapian.SWIG_PyInstanceMethod_New(_xapian.Document_serialise)
Document.__str__ = _xapian.SWIG_PyInstanceMethod_New(_xapian.Document___str__)
Document_swigregister = _xapian.Document_swigregister
Document_swigregister(Document)
def Document_unserialise(serialised):
return _xapian.Document_unserialise(serialised)
Document_unserialise = _xapian.Document_unserialise
[docs]class Registry(object):
"""
Registry for user subclasses.
This class provides a way for the remote server to look up user
subclasses when unserialising.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self):
"""
Default constructor.
Xapian::Registry::Registry()
The registry will contain all standard subclasses of user-subclassable
classes.
"""
_xapian.Registry_swiginit(self, _xapian.new_Registry())
__swig_destroy__ = _xapian.delete_Registry
def register_weighting_scheme(self, wt):
"""
Register a weighting scheme.
void Xapian::Registry::register_weighting_scheme(const Xapian::Weight
&wt)
Parameters:
-----------
wt: The weighting scheme to register.
"""
return _xapian.Registry_register_weighting_scheme(self, wt)
def get_weighting_scheme(self, name):
"""
Get the weighting scheme given a name.
const Xapian::Weight* Xapian::Registry::get_weighting_scheme(const
std::string &name) const
Parameters:
-----------
name: The name of the weighting scheme to find.
An object with the requested name, or NULL if the weighting scheme
could not be found. The returned object is owned by the registry and
so must not be deleted by the caller.
"""
return _xapian.Registry_get_weighting_scheme(self, name)
def register_posting_source(self, source):
"""
Register a user-defined posting source class.
void Xapian::Registry::register_posting_source(const
Xapian::PostingSource &source)
Parameters:
-----------
source: The posting source to register.
"""
return _xapian.Registry_register_posting_source(self, source)
def get_posting_source(self, name):
"""
Get a posting source given a name.
const Xapian::PostingSource*
Xapian::Registry::get_posting_source(const std::string &name) const
Parameters:
-----------
name: The name of the posting source to find.
An object with the requested name, or NULL if the posting source could
not be found. The returned object is owned by the registry and so must
not be deleted by the caller.
"""
return _xapian.Registry_get_posting_source(self, name)
def register_match_spy(self, spy):
"""
Register a user-defined match spy class.
void Xapian::Registry::register_match_spy(const Xapian::MatchSpy &spy)
Parameters:
-----------
spy: The match spy to register.
"""
return _xapian.Registry_register_match_spy(self, spy)
def get_match_spy(self, name):
"""
Get a match spy given a name.
const Xapian::MatchSpy* Xapian::Registry::get_match_spy(const
std::string &name) const
Parameters:
-----------
name: The name of the match spy to find.
An object with the requested name, or NULL if the match spy could not
be found. The returned object is owned by the registry and so must not
be deleted by the caller.
"""
return _xapian.Registry_get_match_spy(self, name)
def register_lat_long_metric(self, metric):
"""
Register a user-defined lat-long metric class.
void Xapian::Registry::register_lat_long_metric(const
Xapian::LatLongMetric &metric)
"""
return _xapian.Registry_register_lat_long_metric(self, metric)
def get_lat_long_metric(self, name):
"""
Get a lat-long metric given a name.
const Xapian::LatLongMetric*
Xapian::Registry::get_lat_long_metric(const std::string &name) const
The returned metric is owned by the registry object.
Returns NULL if the metric could not be found.
"""
return _xapian.Registry_get_lat_long_metric(self, name)
Registry.register_weighting_scheme = _xapian.SWIG_PyInstanceMethod_New(_xapian.Registry_register_weighting_scheme)
Registry.get_weighting_scheme = _xapian.SWIG_PyInstanceMethod_New(_xapian.Registry_get_weighting_scheme)
Registry.register_posting_source = _xapian.SWIG_PyInstanceMethod_New(_xapian.Registry_register_posting_source)
Registry.get_posting_source = _xapian.SWIG_PyInstanceMethod_New(_xapian.Registry_get_posting_source)
Registry.register_match_spy = _xapian.SWIG_PyInstanceMethod_New(_xapian.Registry_register_match_spy)
Registry.get_match_spy = _xapian.SWIG_PyInstanceMethod_New(_xapian.Registry_get_match_spy)
Registry.register_lat_long_metric = _xapian.SWIG_PyInstanceMethod_New(_xapian.Registry_register_lat_long_metric)
Registry.get_lat_long_metric = _xapian.SWIG_PyInstanceMethod_New(_xapian.Registry_get_lat_long_metric)
Registry_swigregister = _xapian.Registry_swigregister
Registry_swigregister(Registry)
[docs]class Query(object):
"""
Class representing a query.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
OP_AND = _xapian.Query_OP_AND
OP_OR = _xapian.Query_OP_OR
OP_AND_NOT = _xapian.Query_OP_AND_NOT
OP_XOR = _xapian.Query_OP_XOR
OP_AND_MAYBE = _xapian.Query_OP_AND_MAYBE
OP_FILTER = _xapian.Query_OP_FILTER
OP_NEAR = _xapian.Query_OP_NEAR
OP_PHRASE = _xapian.Query_OP_PHRASE
OP_VALUE_RANGE = _xapian.Query_OP_VALUE_RANGE
OP_SCALE_WEIGHT = _xapian.Query_OP_SCALE_WEIGHT
OP_ELITE_SET = _xapian.Query_OP_ELITE_SET
OP_VALUE_GE = _xapian.Query_OP_VALUE_GE
OP_VALUE_LE = _xapian.Query_OP_VALUE_LE
OP_SYNONYM = _xapian.Query_OP_SYNONYM
OP_MAX = _xapian.Query_OP_MAX
OP_WILDCARD = _xapian.Query_OP_WILDCARD
OP_INVALID = _xapian.Query_OP_INVALID
WILDCARD_LIMIT_ERROR = _xapian.Query_WILDCARD_LIMIT_ERROR
WILDCARD_LIMIT_FIRST = _xapian.Query_WILDCARD_LIMIT_FIRST
WILDCARD_LIMIT_MOST_FREQUENT = _xapian.Query_WILDCARD_LIMIT_MOST_FREQUENT
__swig_destroy__ = _xapian.delete_Query
def _get_terms_begin(self):
"""
Begin iterator for terms in the query object.
const TermIterator Xapian::Query::get_terms_begin() const
The iterator returns terms in ascending query position order, and will
return the same term in each unique position it occurs in. If you want
the terms in sorted order and without duplicates, see
get_unique_terms_begin().
"""
return _xapian.Query__get_terms_begin(self)
def _get_terms_end(self):
"""
End iterator for terms in the query object.
const TermIterator Xapian::Query::get_terms_end() const
"""
return _xapian.Query__get_terms_end(self)
def get_unique_terms_begin(self):
"""
Begin iterator for unique terms in the query object.
const TermIterator Xapian::Query::get_unique_terms_begin() const
Terms are sorted and terms with the same name removed from the list.
If you want the terms in ascending query position order, see
get_terms_begin().
"""
return _xapian.Query_get_unique_terms_begin(self)
def get_length(self):
"""
Return the length of this query object.
Xapian::termcount Xapian::Query::get_length() const
"""
return _xapian.Query_get_length(self)
def empty(self):
"""
Check if this query is Xapian::Query::MatchNothing.
bool Xapian::Query::empty() const
"""
return _xapian.Query_empty(self)
def serialise(self):
"""
Serialise this object into a string.
std::string Xapian::Query::serialise() const
"""
return _xapian.Query_serialise(self)
unserialise = staticmethod(_xapian.Query_unserialise)
def get_type(self):
"""
Get the type of the top level of the query.
op Xapian::Query::get_type() const
"""
return _xapian.Query_get_type(self)
def get_num_subqueries(self):
"""
Get the number of subqueries of the top level query.
size_t Xapian::Query::get_num_subqueries() const
"""
return _xapian.Query_get_num_subqueries(self)
def get_subquery(self, n):
"""
Read a top level subquery.
const Query Xapian::Query::get_subquery(size_t n) const
Parameters:
-----------
n: Return the n-th subquery (starting from 0) - only valid when 0 <=
n < get_num_subqueries().
"""
return _xapian.Query_get_subquery(self, n)
def __str__(self):
"""
Return a string describing this object.
std::string Xapian::Query::get_description() const
"""
return _xapian.Query___str__(self)
def __init__(self, *args):
"""
Construct with just an operator.
Xapian::Query::Query(Query::op op_)
Parameters:
-----------
op_: The operator to use - currently only OP_INVALID is useful.
"""
_xapian.Query_swiginit(self, _xapian.new_Query(*args))
Query._get_terms_begin = _xapian.SWIG_PyInstanceMethod_New(_xapian.Query__get_terms_begin)
Query._get_terms_end = _xapian.SWIG_PyInstanceMethod_New(_xapian.Query__get_terms_end)
Query.get_unique_terms_begin = _xapian.SWIG_PyInstanceMethod_New(_xapian.Query_get_unique_terms_begin)
Query.get_length = _xapian.SWIG_PyInstanceMethod_New(_xapian.Query_get_length)
Query.empty = _xapian.SWIG_PyInstanceMethod_New(_xapian.Query_empty)
Query.serialise = _xapian.SWIG_PyInstanceMethod_New(_xapian.Query_serialise)
Query.get_type = _xapian.SWIG_PyInstanceMethod_New(_xapian.Query_get_type)
Query.get_num_subqueries = _xapian.SWIG_PyInstanceMethod_New(_xapian.Query_get_num_subqueries)
Query.get_subquery = _xapian.SWIG_PyInstanceMethod_New(_xapian.Query_get_subquery)
Query.__str__ = _xapian.SWIG_PyInstanceMethod_New(_xapian.Query___str__)
Query_swigregister = _xapian.Query_swigregister
Query_swigregister(Query)
def Query_unserialise(*args):
return _xapian.Query_unserialise(*args)
Query_unserialise = _xapian.Query_unserialise
def __or__(a, b):
return _xapian.__or__(a, b)
__or__ = _xapian.__or__
def __xor__(a, b):
return _xapian.__xor__(a, b)
__xor__ = _xapian.__xor__
def __mul__(*args):
return _xapian.__mul__(*args)
__mul__ = _xapian.__mul__
def __truediv__(q, factor):
return _xapian.__truediv__(q, factor)
__truediv__ = _xapian.__truediv__
def __and__(*args):
return _xapian.__and__(*args)
__and__ = _xapian.__and__
[docs]class StemImplementation(object):
"""
Class representing a stemming algorithm implementation.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self):
"""
Default constructor.
Xapian::StemImplementation::StemImplementation()
"""
if self.__class__ == StemImplementation:
_self = None
else:
_self = self
_xapian.StemImplementation_swiginit(self, _xapian.new_StemImplementation(_self, ))
__swig_destroy__ = _xapian.delete_StemImplementation
def __str__(self):
"""
Return a string describing this object.
virtual std::string Xapian::StemImplementation::get_description()
const =0
"""
return _xapian.StemImplementation___str__(self)
def __disown__(self):
self.this.disown()
_xapian.disown_StemImplementation(self)
return weakref_proxy(self)
StemImplementation.__call__ = _xapian.SWIG_PyInstanceMethod_New(_xapian.StemImplementation___call__)
StemImplementation.__str__ = _xapian.SWIG_PyInstanceMethod_New(_xapian.StemImplementation___str__)
StemImplementation_swigregister = _xapian.StemImplementation_swigregister
StemImplementation_swigregister(StemImplementation)
[docs]class Stem(object):
"""
Class representing a stemming algorithm.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, *args):
"""
Construct a Xapian::Stem object with a user-provided stemming
algorithm.
Xapian::Stem::Stem(StemImplementation *p)
You can subclass Xapian::StemImplementation to implement your own
stemming algorithm (or to wrap a third-party algorithm) and then wrap
your implementation in a Xapian::Stem object to pass to the Xapian
API.
Parameters:
-----------
p: The user-subclassed StemImplementation object. This is reference
counted, and so will be automatically deleted by the Xapian::Stem
wrapper when no longer required.
"""
_xapian.Stem_swiginit(self, _xapian.new_Stem(*args))
__swig_destroy__ = _xapian.delete_Stem
def __str__(self):
"""
Return a string describing this object.
std::string Xapian::Stem::get_description() const
"""
return _xapian.Stem___str__(self)
get_available_languages = staticmethod(_xapian.Stem_get_available_languages)
Stem.__call__ = _xapian.SWIG_PyInstanceMethod_New(_xapian.Stem___call__)
Stem.__str__ = _xapian.SWIG_PyInstanceMethod_New(_xapian.Stem___str__)
Stem_swigregister = _xapian.Stem_swigregister
Stem_swigregister(Stem)
def Stem_get_available_languages():
return _xapian.Stem_get_available_languages()
Stem_get_available_languages = _xapian.Stem_get_available_languages
[docs]class TermGenerator(object):
"""
Parses a piece of text and generate terms.
This module takes a piece of text and parses it to produce words which
are then used to generate suitable terms for indexing. The terms
generated are suitable for use with Query objects produced by the
QueryParser class.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self):
"""
Default constructor.
Xapian::TermGenerator::TermGenerator()
"""
_xapian.TermGenerator_swiginit(self, _xapian.new_TermGenerator())
__swig_destroy__ = _xapian.delete_TermGenerator
def set_stemmer(self, stemmer):
"""
Set the Xapian::Stem object to be used for generating stemmed terms.
void Xapian::TermGenerator::set_stemmer(const Xapian::Stem &stemmer)
"""
return _xapian.TermGenerator_set_stemmer(self, stemmer)
[docs] def set_stopper(self, stop=None):
"""
Set the Xapian::Stopper object to be used for identifying stopwords.
void Xapian::TermGenerator::set_stopper(const Xapian::Stopper
*stop=NULL)
Stemmed forms of stopwords aren't indexed, but unstemmed forms still
are so that searches for phrases including stop words still work.
Parameters:
-----------
stop: The Stopper object to set (default NULL, which means no
stopwords).
"""
return _xapian.TermGenerator_set_stopper(self, stop)
def set_document(self, doc):
"""
Set the current document.
void Xapian::TermGenerator::set_document(const Xapian::Document &doc)
"""
return _xapian.TermGenerator_set_document(self, doc)
def get_document(self):
"""
Get the current document.
const Xapian::Document& Xapian::TermGenerator::get_document() const
"""
return _xapian.TermGenerator_get_document(self)
def set_database(self, db):
"""
Set the database to index spelling data to.
void Xapian::TermGenerator::set_database(const
Xapian::WritableDatabase &db)
"""
return _xapian.TermGenerator_set_database(self, db)
FLAG_SPELLING = _xapian.TermGenerator_FLAG_SPELLING
FLAG_CJK_NGRAM = _xapian.TermGenerator_FLAG_CJK_NGRAM
STEM_NONE = _xapian.TermGenerator_STEM_NONE
STEM_SOME = _xapian.TermGenerator_STEM_SOME
STEM_ALL = _xapian.TermGenerator_STEM_ALL
STEM_ALL_Z = _xapian.TermGenerator_STEM_ALL_Z
STEM_SOME_FULL_POS = _xapian.TermGenerator_STEM_SOME_FULL_POS
STOP_NONE = _xapian.TermGenerator_STOP_NONE
STOP_ALL = _xapian.TermGenerator_STOP_ALL
STOP_STEMMED = _xapian.TermGenerator_STOP_STEMMED
def set_flags(self, *args):
"""
Set flags.
flags Xapian::TermGenerator::set_flags(flags toggle, flags
mask=flags(0))
The new value of flags is: (flags & mask) ^ toggle
To just set the flags, pass the new flags in toggle and the default
value for mask.
Parameters:
-----------
toggle: Flags to XOR.
mask: Flags to AND with first.
The old flags setting.
"""
return _xapian.TermGenerator_set_flags(self, *args)
def set_stemming_strategy(self, strategy):
"""
Set the stemming strategy.
void Xapian::TermGenerator::set_stemming_strategy(stem_strategy
strategy)
This method controls how the stemming algorithm is applied. It was new
in Xapian 1.3.1.
Parameters:
-----------
strategy: The strategy to use - possible values are: STEM_NONE: Don't
perform any stemming - only unstemmed terms are generated.
STEM_SOME: Generate both stemmed (with a "Z" prefix) and unstemmed
terms. No positional information is stored for unstemmed terms. This
is the default strategy.
STEM_SOME_FULL_POS: Like STEM_SOME but positional information is
stored for both stemmed and unstemmed terms. Added in Xapian 1.4.8.
STEM_ALL: Generate only stemmed terms (but without a "Z" prefix).
STEM_ALL_Z: Generate only stemmed terms (with a "Z" prefix).
"""
return _xapian.TermGenerator_set_stemming_strategy(self, strategy)
def set_stopper_strategy(self, strategy):
"""
Set the stopper strategy.
void Xapian::TermGenerator::set_stopper_strategy(stop_strategy
strategy)
The method controls how the stopper is used. It was added in Xapian
1.4.1.
You need to also call set_stopper() for this to have any effect.
Parameters:
-----------
strategy: The strategy to use - possible values are: STOP_NONE: Don't
use the stopper.
STOP_ALL: If a word is identified as a stop word, skip it completely.
STOP_STEMMED: If a word is identified as a stop word, index its
unstemmed form but skip the stem. Unstemmed forms are indexed with
positional information by default, so this allows searches for phrases
containing stopwords to be supported. (This is the default mode).
"""
return _xapian.TermGenerator_set_stopper_strategy(self, strategy)
def set_max_word_length(self, max_word_length):
"""
Set the utsn> _xapd_length):8 À” ¨#÷ÿp á PhDŸ–•”“’‘ ÐÄ à üutsn> _xapd_length):8 À” ¨#÷ÿp á PhDŸ–•”“’‘ Ð - possible values are: STOPumberValueRangeProcessor(Xapian::NONE: Don't
use the stopper.
STOP_ALL: If a word is identified as a stop >):
"""
"""
"&an> _xapian.Query_emptys="sd"> containingdbYAn>, strate.$%an>self, strate.$%an>selfselfselfselfself