π Help on package xapian β a Xapian search engine library binding.
π§ 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/>.
_xapianbuiltins.Exception
Error
LogicError
AssertionErrorInvalidArgumentErrorInvalidOperationErrorUnimplementedErrorRuntimeError
DatabaseError
DatabaseClosedErrorDatabaseCorruptErrorDatabaseCreateErrorDatabaseLockErrorDatabaseModifiedErrorDatabaseOpeningError
DatabaseNotFoundErrorDatabaseVersionErrorDocNotFoundErrorFeatureUnavailableErrorInternalErrorNetworkError
NetworkTimeoutErrorQueryParserErrorRangeErrorSerialisationErrorWildcardErrorbuiltins.object
CompactorDatabase
WritableDatabaseDocumentESetESetItemESetIterEnquireExpandDecider
ExpandDeciderAndExpandDeciderFilterPrefixFieldProcessorKeyMaker
LatLongDistanceKeyMakerMultiValueKeyMakerLatLongCoordLatLongCoordsLatLongCoordsIterLatLongMetric
GreatCircleMetricMSetMSetItemMSetIterMatchDecider
ValueSetMatchDeciderMatchSpy
ValueCountMatchSpyPositionIterPostingItemPostingIterPostingSource
FixedWeightPostingSourceValuePostingSource
LatLongDistancePostingSourceValueMapPostingSourceValueWeightPostingSource
DecreasingValueWeightPostingSourceQueryQueryParserRSetRangeProcessor
DateRangeProcessorNumberRangeProcessorRegistryStemStemImplementationStopper
SimpleStopperTermGeneratorTermIterTermListItemValueItemValueIterValueRangeProcessor
StringValueRangeProcessor
DateValueRangeProcessorNumberValueRangeProcessorValueStreamItemValueStreamIterWeight
BB2WeightBM25PlusWeightBM25WeightBoolWeightCoordWeightDLHWeightDPHWeightIfB2WeightInL2WeightIneB2WeightLMWeightPL2PlusWeightPL2WeightTfIdfWeightTradWeightError (base exception class)All Xapian exceptions inherit from Error. Provides context and error message retrieval.
__str__() β Return string representation.get_context() β Optional context information (e.g., remote server details).get_error_string() β System error string (from errno, h_errno, or GetLastError()).get_msg() β Human-readable error message.get_type() β Error type name (e.g., "DocNotFoundError").Inherited from builtins.Exception: __new__, args.
Inherited from builtins.BaseException: __delattr__, __getattribute__, __reduce__, __setstate__, with_traceback, __cause__, __context__, __dict__, __suppress_context__, __traceback__.
AssertionErrorThrown when a logical assertion inside Xapian fails (debug builds). Indicates a bug in Xapian.
__init__(self, *args) β Construct from message and optional errno.Inherits from LogicError β Error.
InvalidArgumentErrorThrown when an invalid argument is supplied.
__init__(self, *args) β Construct from message and optional errno.Inherits from LogicError β Error.
InvalidOperationErrorThrown when an operation is attempted in an invalid context.
__init__(self, *args) β Construct from message and optional errno.Inherits from LogicError β Error.
UnimplementedErrorThrown when a method is not implemented (e.g., on a remote backend).
__init__(self, *args) β Construct from message and optional errno.Inherits from LogicError β Error.
RuntimeErrorBase class for runtime errors. All subclasses below inherit from RuntimeError β Error.
__init__(self, *args) β Construct from message and optional errno.DatabaseErrorBase for database-related errors.
__init__(self, *args) β Construct from message and optional errno.Inherits from RuntimeError β Error.
DatabaseClosedErrorAttempt to access a closed database.
__init__(self, *args) β Construct from message and optional errno.Inherits from DatabaseError.
DatabaseCorruptErrorDatabase corruption detected.
__init__(self, *args) β Construct from message and optional errno.Inherits from DatabaseError.
DatabaseCreateErrorFailure to create a database.
__init__(self, *args) β Construct from message and optional errno.Inherits from DatabaseError.
DatabaseLockErrorFailure to lock a database.
__init__(self, *args) β Construct from message and optional errno.Inherits from DatabaseError.
DatabaseModifiedErrorDatabase was modified during a read operation. Call reopen() to recover.
__init__(self, *args) β Construct from message and optional errno.Inherits from DatabaseError.
DatabaseOpeningErrorFailure to open a database.
__init__(self, *args) β Construct from message and optional errno.Inherits from DatabaseError.
DatabaseNotFoundErrorDatabase not present at the specified path.
__init__(self, *args) β Construct from message and optional errno.Inherits from DatabaseOpeningError.
DatabaseVersionErrorDatabase in an unsupported format (too old or too new).
__init__(self, *args) β Construct from message and optional errno.Inherits from DatabaseOpeningError.
DocNotFoundErrorRequested document does not exist in the database.
__init__(self, *args) β Construct from message and optional errno.Inherits from RuntimeError.
FeatureUnavailableErrorFeature not available (e.g., during compaction).
__init__(self, *args) β Construct from message and optional errno.Inherits from RuntimeError.
InternalErrorInternal Xapian error (should not happen).
__init__(self, *args) β Construct from message and optional errno.Inherits from RuntimeError.
NetworkErrorBase for network-related errors.
__init__(self, *args) β Construct from message and optional errno.Inherits from RuntimeError.
NetworkTimeoutErrorNetwork timeout occurred.
__init__(self, *args) β Construct from message and optional errno.Inherits from NetworkError.
QueryParserErrorQuery parsing failed.
__init__(self, *args) β Construct from message and optional errno.Inherits from RuntimeError.
RangeErrorValue out of range.
__init__(self, *args) β Construct from message and optional errno.Inherits from RuntimeError.
SerialisationErrorError during serialisation/deserialisation.
__init__(self, *args) β Construct from message and optional errno.Inherits from RuntimeError.
WildcardErrorWildcard expansion error.
__init__(self, *args) β Construct from message and optional errno.Inherits from RuntimeError.
DatabaseProvides access to a database or group of databases. Used with Enquire for searching.
Constructor: Database(*args) β Copying (reference counted) or open from path. Throws InvalidArgumentError, DatabaseOpeningError, DatabaseVersionError.
__str__() β Description string.add_database(database) β Add another database to the group.close() β Close database and release file handles. Commits if WritableDatabase.compact(fd, flags, block_size, compactor) β Compact database to file descriptor or path.get_average_length() β Average document length (alias for get_avlength()).get_avlength() β Average document length.get_collection_freq(tname) β Total occurrences of term across all documents.get_doccount() β Number of documents.get_doclength(did) β Length of a specific document.get_doclength_lower_bound() β Lower bound on document length (excludes zero-length).get_doclength_upper_bound() β Upper bound on document length.get_document(did, flags=0) β Retrieve document by ID.get_lastdocid() β Highest document ID used.get_metadata(key) β User-specified metadata value.get_revision() β Database revision number (chert/glass only).get_spelling_suggestion(word, max_edit_distance=2) β Suggest a spelling correction.get_termfreq(tname) β Number of documents indexed by term.get_total_length() β Sum of all document lengths.get_unique_terms(did) β Number of unique terms in document.get_uuid() β Database UUID.get_value_freq(slot) β Number of documents with a non-empty value in slot.get_value_lower_bound(slot) β Lower bound of values in slot.get_value_upper_bound(slot) β Upper bound of values in slot.get_wdf_upper_bound(term) β Upper bound on wdf for term.has_positions() β Whether the database has positional information.keep_alive() β Send keep-alive to remote databases.locked() β Test if database is locked for writing.metadata_keys(prefix='') β Iterator over metadata keys.positionlist(docid, tname) β Iterator over term positions in document.postlist(tname) β Iterator over postings for a term.reopen() β Reopen to latest version.size() β Number of shards.spellings() β Iterator over spelling correction targets.synonym_keys(prefix='') β Iterator over terms with synonyms.synonyms(term) β Iterator over synonyms for a term.term_exists(tname) β Check if term exists.termlist(docid) β Iterator over terms indexing a document.valuestream(slot) β Iterator over values in a slot.static check() β Check database.WritableDatabase (extends Database)Adds write operations: indexing, updating, deleting documents.
add_document(document) β Add a document, return new docid.delete_document(did) β Delete by docid.delete_document(term) β Delete documents matching a unique term.replace_document(did, document) β Replace or add document.commit() β Commit changes.set_metadata(key, value) β Set user metadata.add_spelling(word, freqinc=1) β Add spelling correction.remove_spelling(word, freqdec=1) β Remove spelling correction.add_synonym(term, synonym) β Add synonym.remove_synonym(term, synonym) β Remove synonym.clear_synonyms(term) β Clear all synonyms for term.Database.CompactorUtility to compact or merge databases. Deprecated in favor of Database::compact().
add_source(srcdir) β Add source database path.compact() β Perform compaction.resolve_duplicate_metadata(key, num_tags, tags) β Merge duplicate metadata keys.set_block_size(block_size) β Set block size (2048β65536, power of 2).set_compaction_level(level) β STANDARD (0), FULL (1), FULLER (2).set_destdir(destdir) β Output directory.set_multipass(multipass) β Enable multipass merging.set_renumber(renumber) β Preserve docids if false.set_status(table, status) β Progress callback.Class constants: STANDARD=0, FULL=1, FULLER=2.
DocumentRepresents a document in the database.
get_data() β Document data.set_data(data) β Set document data.add_term(term, wdfinc=1) β Add a term.add_posting(term, position, wdfinc=1) β Add term at position.add_boolean_term(term) β Add boolean term.remove_term(term) β Remove term.remove_posting(term, position, wdfdec=1) β Remove posting.clear_terms() β Clear all terms.get_value(slot) β Get value.add_value(slot, value) β Set value.remove_value(slot) β Remove value.clear_values() β Clear all values.get_docid() β Return docid (only valid after being added to DB).termlist() β Iterator over terms.values() β Iterator over values.EnquirePerforms searches on a database.
set_query(query, qlen=0) β Set query.get_query() β Get current query.set_weighting_scheme(weight) β Set weighting scheme.set_collapse_key(slot, collapse_max=1) β Collapse results by value.set_docid_order(order) β Set docid ordering.set_cutoff(percent, weight) β Set cutoff.set_sort_by_relevance() β Sort by relevance only.set_sort_by_value(slot, reverse) β Sort by value.set_sort_by_relevance_then_value(slot, reverse) β Primary relevance, then value.set_sort_by_value_then_relevance(slot, reverse) β Primary value, then relevance.get_mset(first, maxitems, checkatleast, rset, mdecider) β Execute search and return MSet.get_eset(maxitems, rset, eflags, k, edecider) β Expand query from relevance set.get_matching_terms_begin(did) β Iterator for matching terms.get_matching_terms_end(did) β End iterator.MSetResult set from a search.
get_matches_lower_bound(), get_matches_estimated(), get_matches_upper_bound() β Result statistics.get_max_possible() β Maximum possible weight.get_firstitem() β First item index.get_docid(i) β Docid of item i.get_document(i) β Document object.get_weight(i) β Weight of item i.get_collapse_key(i) β Collapse key.get_collapse_count(i) β Number of collapsed entries.get_percent(i) β Relevance percentage.size() β Number of items.empty() β True if empty.back(), front() β First/last items.begin(), end() β Iterators over MSetItem.convert_to_percent(weight) β Convert weight to percentage.get_termfreq(tname) β Term frequency.get_termweight(tname) β Term weight.reorder(decider) β Reorder results.snippet(text, len, qp, flags) β Generate snippet.MSetItemRepresents a single result in an MSet.
docid β Document ID.weight β Weight.rank β Rank.collapse_key β Collapse key.collapse_count β Count of collapsed.get_document() β Retrieve Document.ESetResult set from query expansion.
get_ebound(), get_esize() β Size info.begin(), end() β Iterators over ESetItem.size(), empty().ESetItemterm β Term string.weight β Weight.RSetRelevance set for query expansion.
add_document(did), remove_document(did), contains(did), size(), empty().begin(), end() β Iterators over docids.QueryRepresents a query. Can be built from operators and subqueries.
get_length() β Number of subqueries.get_type() β Query type (e.g., OP_AND, OP_OR).get_terms() β Iterator over terms (if leaf).serialise() β Serialize to string.static unserialise(string, registry) β Deserialize.Query(term), Query(op, subqueries), Query(op, field, value), etc.QueryParserParses a human-readable query string into a Query object.
set_default_op(op) β Set default operator.set_database(db) β Set database for spelling/prefixes.set_stemmer(stemmer) β Set stemmer.set_stemming_strategy(strategy) β Set stemming strategy.set_stopper(stopper) β Set stopper.set_max_expansion(max_expansion, max_type, flags) β Set wildcard expansion.add_prefix(prefix, field) β Map field prefix.add_boolean_prefix(prefix, field) β Boolean prefix.add_rangeprocessor(rp) β Add range processor.add_valuerangeprocessor(vrp) β Add value range processor.parse_query(qs, flags) β Parse query string.parse_query_with_prefix(qs, flags, prefix) β Parse with prefix.get_corrected_query_string() β Spelling-corrected query.get_terms() β Terms from parsed query.get_description() β Description.StemStemming algorithm.
Stem(language) β Constructor (e.g., "english").stem_word(word) β Stem a word.get_description().static get_available_languages() β List of supported languages.static get_description().Stopper (abstract)Base class for stop word lists.
operator()(word) β Return true if word should be stopped.SimpleStopperSimple stop word list.
add(word) β Add a stop word.remove(word) β Remove a stop word.begin(), end() β Iterate over stop words.TermGeneratorConverts text into terms.
set_document(doc) β Set document to index.set_stemmer(stemmer).set_stopper(stopper).set_stemming_strategy(strategy).index_text(text, wdfinc, prefix) β Index text with positional information.index_text_without_positions(text, wdfinc, prefix) β Index without positions.increase_termpos(delta) β Adjust term position.get_termpos() β Current term position.set_termpos(pos).get_description().ValueRangeProcessor (abstract)Base for range processors.
__call__(begin, end) β Process range, return Query.release() β Hand ownership to Xapian.StringValueRangeProcessorRange processor for string values.
StringValueRangeProcessor(slot, str, prefix=True) β Constructor.__call__(begin, end) β Process range.DateValueRangeProcessor (deprecated, use DateRangeProcessor)DateValueRangeProcessor(slot, str, prefix=True, prefer_mdy=False, epoch_year=1970).NumberValueRangeProcessor (deprecated, use NumberRangeProcessor)NumberValueRangeProcessor(slot, str, prefix=True).RangeProcessor (abstract)Base for range processors (new API).
__call__(begin, end) β Process range.check_range(begin, end) β Check prefix/suffix.release().DateRangeProcessorDateRangeProcessor(slot, str, flags=0, epoch_year=1970).__call__(begin, end).NumberRangeProcessorNumberRangeProcessor(slot, str, flags=0).__call__(begin, end).ExpandDecider (abstract)Base for expansion deciders.
operator()(term) β Return true if term should be used for expansion.ExpandDeciderAndLogical AND of two deciders.
ExpandDeciderAnd(first, second).ExpandDeciderFilterPrefixFilter by prefix.
ExpandDeciderFilterPrefix(prefix).KeyMaker (abstract)Base for key makers (sort keys).
__call__(doc) β Return sort key string.MultiValueKeyMakerKey from multiple value slots.
MultiValueKeyMaker().add_value(slot, reverse, deflt) β Add slot.LatLongDistanceKeyMakerKey from distance to a center point.
LatLongDistanceKeyMaker(slot, centre, metric).LatLongCoordLatitude/longitude coordinate.
LatLongCoord(lat, lon).latitude, longitude.LatLongCoordsSequence of coordinates.
append(coord).begin(), end().LatLongMetric (abstract)Base for distance metrics.
pointwise_distance(a, b) β Distance between two points.GreatCircleMetricGreat-circle distance.
GreatCircleMetric().PostingSource (abstract)Custom source of postings.
init(db) β Initialize for a database.next(min_wt) β Advance to next doc.skip_to(docid, min_wt) β Skip to docid.check(docid, min_wt) β Check if docid occurs.at_end() β True if past last.get_docid() β Current docid.get_weight() β Weight contribution.get_maxweight() β Upper bound on weight.clone() β Clone for multi-database.name(), serialise(), unserialise() β For remote.get_description().FixedWeightPostingSourcePosting source with constant weight for all documents.
FixedWeightPostingSource(weight).ValuePostingSource (abstract)Base for value-based posting sources.
PostingSource.ValueWeightPostingSourceWeight from values in a slot (serialised with sortable_serialise()).
ValueWeightPostingSource(slot).get_weight() β Returns value as double.name() β Returns "Xapian::ValueWeightPostingSource".ValuePostingSource.DecreasingValueWeightPostingSourceLike ValueWeightPostingSource but for values known to decrease with docid.
DecreasingValueWeightPostingSource(slot, range_start=0, range_end=0).ValueWeightPostingSource.ValueMapPostingSourceMap values to weights via a mapping function.
ValueMapPostingSource(slot).add_mapping(value, weight) β Add mapping.set_default_weight(weight).ValuePostingSource.LatLongDistancePostingSourceWeight from distance to a center point.
LatLongDistancePostingSource(slot, centre, metric).ValuePostingSource.MatchDecider (abstract)Base for match deciders (filter results).
operator()(doc) β Return true to include document.ValueSetMatchDeciderFilter documents where value is in a set.
ValueSetMatchDecider(slot, include).add_value(value) β Add value to set.remove_value(value).MatchSpy (abstract)Base for match spies (collect statistics during search).
operator()(doc, weight).clone().name().merge(results).ValueCountMatchSpyCount occurrences of values in slots.
ValueCountMatchSpy(slot).get_values() β Map of value to frequency.top_values(maxitems) β Top values.values_begin(), values_end().RegistryRegistry for weighting schemes, posting sources, etc.
add_weighting_scheme(weight).add_posting_source(source).add_match_spy(spy).add_lat_long_metric(metric).FieldProcessor (abstract)Base for field processors (e.g., for query parser).
operator()(field, value) β Return Query.Weight (abstract)Base class for weighting schemes.
name() β Return class name.get_sumpart(wdf, doclen, uniqterms) β Term-dependent weight.get_maxpart() β Upper bound on get_sumpart().get_sumextra(doclen, uniqterms) β Term-independent weight.get_maxextra() β Upper bound on get_sumextra().ABSOLUTE_DISCOUNT_SMOOTHING=3, DIRICHLET_PLUS_SMOOTHING=5, DIRICHLET_SMOOTHING=2, JELINEK_MERCER_SMOOTHING=4, TWO_STAGE_SMOOTHING=1.BB2Weight, BM25PlusWeight, BM25Weight, BoolWeight, CoordWeight, DLHWeight, DPHWeight, IfB2Weight, InL2Weight, IneB2Weight, LMWeight, PL2PlusWeight, PL2Weight, TfIdfWeight, TradWeight.Weight and may override init(), get_sumpart(), etc.BB2WeightImplements the BB2 weighting scheme (Divergence from Randomness framework).
BB2Weight() β Constructor.Weight.BM25PlusWeightBM25+ (BM25 with a lower bound).
BM25PlusWeight() β Constructor.Weight.BM25WeightStandard BM25 weighting.
BM25Weight(k1, k2, k3, b, min_normlen) β Constructor with parameters.Weight.BoolWeightBoolean weighting (all documents weight zero).
BoolWeight() β Constructor.init().Weight.CoordWeightCoordinate Matching: each matching term scores one point.
CoordWeight() β Constructor.init().Weight.DLHWeightDLH weighting scheme (parameter-free DFR).
DLHWeight() β Constructor.Weight.DPHWeightDPH weighting scheme (parameter-free DFR).
DPHWeight() β Constructor.Weight.IfB2WeightIfB2 weighting scheme.
IfB2Weight() β Constructor.Weight.InL2WeightInL2 weighting scheme.
InL2Weight() β Constructor.Weight.IneB2WeightIneB2 weighting scheme.
IneB2Weight() β Constructor.Weight.LMWeightLanguage Model weighting.
LMWeight() β Constructor.Weight.PL2PlusWeightPL2+ weighting scheme.
PL2PlusWeight() β Constructor.Weight.PL2WeightPL2 weighting scheme.
PL2Weight() β Constructor.Weight.TfIdfWeightTF-IDF weighting.
TfIdfWeight() β Constructor.Weight.TradWeightTraditional probabilistic weighting.
TradWeight() β Constructor.Weight.PostingIterIterator over postings.
get_docid(), get_wdf().next(), skip_to(docid), check(docid).at_end().get_description().PostingItemElement from a posting list.
docid, wdf.positionlist() β Iterator over positions.PositionIterIterator over positions.
get_position(), next(), at_end().TermIterIterator over terms.
get_term(), get_wdf(), get_termfreq().next(), skip_to(term), at_end().positionlist().TermListItemElement from a term list.
term, wdf, termfreq.ValueIterIterator over values.
get_value(), get_docid().next(), skip_to(docid), check(docid).at_end().ValueItemElement from a value stream.
docid, value.ValueStreamItemElement from a value stream (similar to ValueItem).
docid, value.ValueStreamIterIterator over value stream (ordered by docid).
next(), skip_to(docid), check(docid), at_end().get_docid(), get_value().ESetIterIterator over ESet.
get_term(), get_weight().next(), at_end().LatLongCoordsIterIterator over LatLongCoords.
get_coord() β Returns LatLongCoord.next(), at_end().MSetIterIterator over MSet.
get_docid(), get_weight(), get_percent(), get_document().next(), at_end().TermGenerator (already covered)See above.
Stem (already covered)See above.
StemImplementation (abstract)Interface for custom stemmers.
operator()(word) β Return stemmed form.get_description().FieldProcessor (abstract, already covered)See above.
KeyMaker (abstract, already covered)See above.
ValuePostingSource is a base class for posting sources which read values from a document.
This class provides a default implementation which can be used to make it easy to write a PostingSource which looks at values in a document. It provides an implementation of many of the PostingSource methods based on a value stream.
You only need to subclass this if you want to implement a PostingSource which returns a subset of the documents in the database - for example, to return documents within a certain geographical region.
Subclasses should implement the next(), skip_to() and check() methods, and
should also call the set_termfreq_*() methods to set the term frequency
bounds.
This class was added in Xapian 1.2.23 and 1.3.5.
__init__(self, slot_) β Construct a ValuePostingSource.void Xapian::ValuePostingSource::ValuePostingSource(Xapian::valueno slot_)
Parameters:
__repr__ = _swig_repr(self)at_end = ValuePostingSource_at_end(...) β Return true if the current position is past the last entry in this list.virtual bool Xapian::ValuePostingSource::at_end() const =0
At least one of next(), skip_to() or check() will be called before this method is first called.
check = ValuePostingSource_check(...) β Check if the specified docid occurs.virtual bool Xapian::ValuePostingSource::check(Xapian::docid did, double min_wt)
If it does, it must move to that document id, and return true. If it does not, it may either:
skip_to() would have moved to.next() or skip_to() will move to the next matching position after did.Generally, this method should act like skip_to() and return true if that can be done at little extra cost. Otherwise it should simply check if a particular docid is present, returning true if it is, and false if it isn't.
The default implementation calls skip_to() and always returns true.
Xapian will always call init() on a PostingSource before calling this for the first time.
Note: In the case of a multi-database search, the docid specified is the docid in the single subdatabase relevant to this posting source. See the init() method for details.
Parameters:
done = ValuePostingSource_done(...) β End the iteration.void Xapian::ValuePostingSource::done()
Calls to at_end() will return true after calling this method.
Added in 1.2.23 and 1.3.5.
get_database = ValuePostingSource_get_database(...) β The database we're reading values from.Xapian::Database Xapian::ValuePostingSource::get_database() const
Added in 1.2.23 and 1.3.5.
get_docid = ValuePostingSource_get_docid(...) β Return the current docid.Xapian::docid Xapian::ValuePostingSource::get_docid() const
This method may assume that it will only be called when there is a "current document". See get_weight() for details.
Note: In the case of a multi-database search, the returned docid should be in the single subdatabase relevant to this posting source. See the init() method for details.
get_slot = ValuePostingSource_get_slot(...) β The slot we're reading values from.Xapian::valueno Xapian::ValuePostingSource::get_slot() const
Added in 1.2.23 and 1.3.5.
get_started = ValuePostingSource_get_started(...) β Flag indicating if we've started (true if we have).bool Xapian::ValuePostingSource::get_started() const
Added in 1.2.23 and 1.3.5.
get_termfreq_est = ValuePostingSource_get_termfreq_est(...) β An estimate of the number of documents this object can return.Xapian::doccount Xapian::ValuePostingSource::get_termfreq_est() const
It must always be true that: get_termfreq_min() <= get_termfreq_est() <= get_termfreq_max()
Xapian will always call init() on a PostingSource before calling this for the first time.
get_termfreq_max = ValuePostingSource_get_termfreq_max(...) β An upper bound on the number of documents this object can return.Xapian::doccount Xapian::ValuePostingSource::get_termfreq_max() const
Xapian will always call init() on a PostingSource before calling this for the first time.
get_termfreq_min = ValuePostingSource_get_termfreq_min(...) β A lower bound on the number of documents this object can return.Xapian::doccount Xapian::ValuePostingSource::get_termfreq_min() const
Xapian will always call init() on a PostingSource before calling this for the first time.
get_value = ValuePostingSource_get_value(...) β Read current value.std::string Xapian::ValuePostingSource::get_value() const
Added in 1.2.23 and 1.3.5.
set_termfreq_est = ValuePostingSource_set_termfreq_est(...) β An estimate of the term frequency.void Xapian::ValuePostingSource::set_termfreq_est(Xapian::doccount termfreq_est_)
Subclasses should set this if they are overriding the next(), skip_to() or check() methods.
Added in 1.2.23 and 1.3.5.
set_termfreq_max = ValuePostingSource_set_termfreq_max(...) β An upper bound on the term frequency.void Xapian::ValuePostingSource::set_termfreq_max(Xapian::doccount termfreq_max_)
Subclasses should set this if they are overriding the next(), skip_to() or check() methods.
Added in 1.2.23 and 1.3.5.
set_termfreq_min = ValuePostingSource_set_termfreq_min(...) β Set a lower bound on the term frequency.void Xapian::ValuePostingSource::set_termfreq_min(Xapian::doccount termfreq_min_)
Subclasses should set this if they are overriding the next(), skip_to() or check() methods to return fewer documents.
Added in 1.2.23 and 1.3.5.
skip_to = ValuePostingSource_skip_to(...) β Advance to the specified docid.void Xapian::ValuePostingSource::skip_to(Xapian::docid min_docid, double min_wt)
If the specified docid isn't in the list, position ourselves on the first document after it (or at_end() if no greater docids are present).
If the current position is already the specified docid, this method will leave the position unmodified.
If the specified docid is earlier than the current position, the behaviour is unspecified. A sensible behaviour would be to leave the current position unmodified, but it is also reasonable to move to the specified docid.
The default implementation calls next() repeatedly, which works but skip_to() can often be implemented much more efficiently.
Xapian will always call init() on a PostingSource before calling this for the first time.
Note: In the case of a multi-database search, the docid specified is the docid in the single subdatabase relevant to this posting source. See the init() method for details.
Parameters:
get_maxweight = PostingSource_get_maxweight(...) β Return the currently set upper bound on what get_weight() can return.double Xapian::PostingSource::get_maxweight() const
release = PostingSource_release(...) β Start reference counting this object.const PostingSource* Xapian::PostingSource::release() const
You can hand ownership of a dynamically allocated PostingSource object to Xapian by calling release() and then passing the object to a Xapian method. Xapian will arrange to delete the object once it is no longer required.
set_maxweight = PostingSource_set_maxweight(...) β Specify an upper bound on what get_weight() will return from now on.void Xapian::PostingSource::set_maxweight(double max_weight)
This upper bound is used by the matcher to perform various optimisations, so if you can return a good bound, then matches will generally run faster.
This method should be called after calling init(), and may be called during iteration if the upper bound drops. It is probably only useful to call from subclasses (it was actually a "protected" method prior to Xapian 1.3.4, but that makes it tricky to wrap for other languages).
It is valid for the posting source to have returned a higher value from get_weight() earlier in the iteration, but the posting source must not return a higher value from get_weight() than the currently set upper bound, and the upper bound must not be increased (until init() has been called).
If you don't call this method, the upper bound will default to 0, for convenience when implementing "weight-less" PostingSource subclasses.
Parameters:
__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)Indicates an attempt to access a document not present in the database.
Method resolution order: DocNotFoundError β RuntimeError β Error β builtins.Exception β builtins.BaseException β builtins.object
__getattr__ lambda self, name__init__(self, *args) β Construct from message and errno value.Xapian::DocNotFoundError::DocNotFoundError(const std::string &msg_, int errno_)
Parameters:
__repr__ = _swig_repr(self)__setattr__ lambda self, name, value__swig_destroy__ = delete_DocNotFoundError(...)__swig_getmethods__ = {}__swig_setmethods__ = {}__str__ = Error___str__(...)get_context = Error_get_context(...) β 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.
get_error_string = Error_get_error_string(...) β 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.
get_msg = Error_get_msg(...) β Message giving details of the error, intended for human consumption.const std::string& Xapian::Error::get_msg() const
get_type = Error_get_type(...) β The type of this error (e.g. "DocNotFoundError".)const char* Xapian::Error::get_type() const
__weakref__ β list of weak references to the object (if defined)__new__(*args, **kwargs) from builtins.type β Create and return a new object. See help(type) for accurate signature.__delattr__(self, name, /) β Implement delattr(self, name).__getattribute__(self, name, /) β Return getattr(self, name).__reduce__(...) β Helper for pickle.__setstate__(...)with_traceback(...) β Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.__cause__ β exception cause__context__ β exception context__dict____suppress_context____traceback__argsA 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());
__init__(self) β Make a new empty Document.Xapian::Document::Document()
__iter__ = _document_gen_termlist_iter(self) β Get an iterator over all the terms in a document.The iterator will return TermListItem objects.
Access to term frequency and position information is only available until the iterator has moved on.
Note that term frequency information is only meaningful for a document retrieved from a database. If term frequency information is requested for a document which was freshly created, an InvalidOperationError will be raised.
__repr__ = _swig_repr(self)__str__ = Document___str__(...) β Return a string describing this object.std::string Xapian::Document::get_description() const
add_boolean_term = Document_add_boolean_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:
add_posting = Document_add_posting(...) β 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:
add_term = Document_add_term(...) β 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:
add_value = Document_add_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:
clear_terms = Document_clear_terms(...) β Remove all terms (and postings) from the document.void Xapian::Document::clear_terms()
clear_values = Document_clear_values(...) β Remove all values associated with the document.void Xapian::Document::clear_values()
get_data = Document_get_data(...) β 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.
get_docid = Document_get_docid(...) β 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).
get_value = Document_get_value(...) β 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:
remove_posting = Document_remove_posting(...) β 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:
Throws:
remove_postings = Document_remove_postings(...) β 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.
Throws:
Added in Xapian 1.4.8.
remove_term = Document_remove_term(...) β Remove a term and all postings associated with it.void Xapian::Document::remove_term(const std::string &tname)
Parameters:
Throws:
remove_value = Document_remove_value(...) β Remove any value with the given number.void Xapian::Document::remove_value(Xapian::valueno slot)
serialise = Document_serialise(...) β 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.
set_data = Document_set_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:
termlist = _document_gen_termlist_iter(self) β Get an iterator over all the terms in a document.The iterator will return TermListItem objects.
Access to term frequency and position information is only available until the iterator has moved on.
Note that term frequency information is only meaningful for a document retrieved from a database. If term frequency information is requested for a document which was freshly created, an InvalidOperationError will be raised.
termlist_count = Document_termlist_count(...) β The length of the termlist - i.e.Xapian::termcount Xapian::Document::termlist_count() const
the number of different terms which index this document.
values = _document_gen_values_iter(self) β Get an iterator over all the values stored in a document.The iterator will return ValueItem objects, in ascending order of value number.
values_count = Document_values_count(...) β Count the values in this document.Xapian::termcount Xapian::Document::values_count() const
__swig_destroy__ = delete_Document(...) β Destructor.Xapian::Document::~Document()
unserialise = Document_unserialise(...)__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)thisown β The membership flagClass representing a list of search results (expand set).
__init__(self) β Default constructor.Xapian::ESet::ESet()
Creates an empty ESet, mostly useful as a placeholder.
__iter__ = _eset_gen_iter(self) β Return an iterator over the ESet.The iterator will return ESetItem objects.
__len__ lambda self__repr__ = _swig_repr(self)__str__ = ESet___str__(...) β Return a string describing this object.std::string Xapian::ESet::get_description() const
back = ESet_back(...) β Return iterator pointing to the last object in this ESet.ESetIterator Xapian::ESet::back() const
empty = ESet_empty(...) β Return true if this ESet object is empty.bool Xapian::ESet::empty() const
get_ebound = ESet_get_ebound(...) β Return a bound on the full size of this ESet object.Xapian::termcount Xapian::ESet::get_ebound() const
This is a bound on size() if get_eset() had been called with maxitems set high enough that all results were returned.
size = ESet_size(...) β Return number of items in this ESet object.Xapian::doccount Xapian::ESet::size() const
__swig_destroy__ = delete_ESet(...) β Destructor.Xapian::ESet::~ESet()
__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)thisown β The membership flagAn item returned from iteration of the ESet.
The item supports access to the following attributes:
term: π€ The term corresponding to this ESet item.weight: βοΈ The weight corresponding to this ESet item.__init__(self, iter) β Initialize self. See help(type(self)) for accurate signature.termweightAn iterator over the items in an ESet.
The iterator will return ESetItem objects.
__init__(self, eset) β Initialize self. See help(type(self)) for accurate signature.__iter__(self)__next__(self)This class provides an interface to the information retrieval system for the purpose of searching.
Databases are usually opened lazily, so exceptions may not be thrown where you would expect them to be. You should catch Xapian::Error exceptions when calling any method in Xapian::Enquire.
Throws:
__init__(self, database) β Create a Xapian::Enquire object.Xapian::Enquire::Enquire(const Database &database, ErrorHandler *errorhandler_)
This specification cannot be changed once the Xapian::Enquire is opened: you must create a new Xapian::Enquire object to access a different database, or set of databases.
The database supplied must have been initialised (ie, must not be the result of calling the Database::Database() constructor). If you need to handle a situation where you have no databases gracefully, a database created with DB_BACKEND_INMEMORY can be passed here to provide a completely empty database.
Parameters:
Throws:
__repr__ = _swig_repr(self)__str__ = Enquire___str__(...) β Return a string describing this object.std::string Xapian::Enquire::get_description() const
add_matchspy = _enquire_match_spy_add(self, decider) β Add a matchspy.void Xapian::Enquire::add_matchspy(MatchSpy *spy)
This matchspy will be called with some of the documents which match the query, during the match process. Exactly which of the matching documents are passed to it depends on exactly when certain optimisations occur during the match process, but it can be controlled to some extent by setting the checkatleast parameter to get_mset().
In particular, if there are enough matching documents, at least the number specified by checkatleast will be passed to the matchspy. This means that you can force the matchspy to be shown all matching documents by setting checkatleast to the number of documents in the database.
Parameters:
clear_matchspies() is called.clear_matchspies = _enquire_match_spies_clear(self) β Remove all the matchspies.void Xapian::Enquire::clear_matchspies()
get_eset = Enquire_get_eset(...) β Get the expand set for the given rset.ESet Xapian::Enquire::get_eset(Xapian::termcount maxitems, const RSet &rset, int flags, double k, const Xapian::ExpandDecider *edecider=NULL, double min_wt=0.0) const
Parameters:
Xapian::Enquire::INCLUDE_QUERY_TERMS query terms may be returned from expand; Xapian::Enquire::USE_EXACT_TERMFREQ for multi dbs, calculate the exact termfreq; otherwise an approximation is used.Returns an ESet object containing the results of the expand.
Throws:
get_mset = Enquire_get_mset(...) β Get (a portion of) the match set for the current query.MSet Xapian::Enquire::get_mset(Xapian::doccount first, Xapian::doccount maxitems, const RSet *omrset, const MatchDecider *mdecider=0) const
Parameters:
get_doccount() on the Database object. You can pass 0 for maxitems which will give you an empty MSet with valid statistics calculated quickly.Returns a Xapian::MSet object containing the results of the query.
Throws:
get_query = _enquire_get_query(self) β Get the current query.const Xapian::Query& Xapian::Enquire::get_query() const
If called before set_query(), this will return a default initialised Query object.
matching_terms = _enquire_gen_iter(self, which) β Get an iterator over the terms which match a given match set item.The match set item to consider is specified by the which parameter, which may be a document ID, or an MSetItem object.
The iterator will return string objects.
set_collapse_key = Enquire_set_collapse_key(...) β Set the collapse key to use for queries.void Xapian::Enquire::set_collapse_key(Xapian::valueno collapse_key, Xapian::doccount collapse_max=1)
Parameters:
The MSet returned by get_mset() will have only the "best" (at most) collapse_max entries with each particular value of collapse_key ("best" being highest ranked - i.e. highest weight or highest sorting key).
An example use might be to create a value for each document containing an MD5 hash of the document contents. Then duplicate documents from different sources can be eliminated at search time by collapsing with collapse_max = 1.
Another use is to group matches in a particular category (e.g. you might collapse a mailing list search on the Subject: so that there's only one result per discussion thread).
set_cutoff = Enquire_set_cutoff(...) β Set the percentage and/or weight cutoffs.void Xapian::Enquire::set_cutoff(int percent_cutoff, double weight_cutoff=0)
Parameters:
set_docid_order = Enquire_set_docid_order(...) β Set sort order for document IDs.void Xapian::Enquire::set_docid_order(docid_order order)
This order only has an effect on documents which would otherwise have equal rank. When ordering by relevance without a sort key, this means documents with equal weight. For a boolean match with no sort key, this means all documents.
Parameters:
Xapian::Enquire::ASCENDING docids sort in ascending order (default); Xapian::Enquire::DESCENDING docids sort in descending order; Xapian::Enquire::DONT_CARE docids sort in whatever order is most efficient for the backend.set_expansion_scheme = Enquire_set_expansion_scheme(...) β Set the weighting scheme to use for expansion.void Xapian::Enquire::set_expansion_scheme(const std::string &eweightname_, double expand_k_=1.0) const
If you don't call this method, the default is as if you'd used: get_expansion_scheme("trad");
Parameters:
set_query = _enquire_set_query(self, query, qlen=0) β Set the query to run.void Xapian::Enquire::set_query(const Xapian::Query &query, Xapian::termcount qlen=0)
Parameters:
set_sort_by_key = _enquire_set_sort_by_key(self, sorter, reverse) β Set the sorting to be by key generated from values only.void Xapian::Enquire::set_sort_by_key(Xapian::KeyMaker *sorter, bool reverse)
Parameters:
set_sort_by_key_then_relevance = _enquire_set_sort_by_key_then_relevance(self, sorter, reverse) β Set the sorting to be by keys generated from values, then by relevance for documents with identical keys.void Xapian::Enquire::set_sort_by_key_then_relevance(Xapian::KeyMaker *sorter, bool reverse)
Parameters:
set_sort_by_relevance = Enquire_set_sort_by_relevance(...) β Set the sorting to be by relevance only.void Xapian::Enquire::set_sort_by_relevance()
This is the default.
set_sort_by_relevance_then_key = _enquire_set_sort_by_relevance_then_key(self, sorter, reverse) β Set the sorting to be by relevance, then by keys generated from values.void Xapian::Enquire::set_sort_by_relevance_then_key(Xapian::KeyMaker *sorter, bool reverse)
Parameters:
set_sort_by_relevance_then_value = Enquire_set_sort_by_relevance_then_value(...) β Set the sorting to be by relevance then value.void Xapian::Enquire::set_sort_by_relevance_then_value(Xapian::valueno sort_key, bool reverse)
Parameters:
set_sort_by_value = Enquire_set_sort_by_value(...) β Set the sorting to be by value only.void Xapian::Enquire::set_sort_by_value(Xapian::valueno sort_key, bool reverse)
Parameters:
set_sort_by_value_then_relevance = Enquire_set_sort_by_value_then_relevance(...) β Set the sorting to be by value, then by relevance for documents with the same value.void Xapian::Enquire::set_sort_by_value_then_relevance(Xapian::valueno sort_key, bool reverse)
Parameters:
set_time_limit = Enquire_set_time_limit(...) β Set a time limit for the match.void Xapian::Enquire::set_time_limit(double time_limit)
Matches with check_at_least set high can take a long time in some cases. You can set a time limit on this, after which check_at_least will be turned off.
Parameters:
Limitations: This feature is currently supported on platforms which support POSIX interval timers. Interaction with the remote backend when using multiple databases may have bugs.
set_weighting_scheme = Enquire_set_weighting_scheme(...) β Set the weighting scheme to use for queries.void Xapian::Enquire::set_weighting_scheme(const Weight &weight_)
Parameters:
__swig_destroy__ = delete_Enquire(...) β Close the Xapian::Enquire object.Xapian::Enquire::~Enquire()
__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)thisown β The membership flagASCENDING = 1DESCENDING = 0DONT_CARE = 2INCLUDE_QUERY_TERMS = 1USE_EXACT_TERMFREQ = 2All exceptions thrown by Xapian are subclasses of Xapian::Error.
This class can not be instantiated directly - instead a subclass should be used.
Method resolution order: Error β builtins.Exception β builtins.BaseException β builtins.object
__getattr__ lambda self, name__init__(self, *args, **kwargs) β Initialize self. See help(type(self)) for accurate signature.__repr__ = _swig_repr(self)__setattr__ lambda self, name, value__str__ = Error___str__(...)get_context = Error_get_context(...) β 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).
get_error_string = Error_get_error_string(...) β 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.
get_msg = Error_get_msg(...) β Message giving details of the error, intended for human consumption.const std::string& Xapian::Error::get_msg() const
get_type = Error_get_type(...) β The type of this error (e.g. "DocNotFoundError".)const char* Xapian::Error::get_type() const
__swig_destroy__ = delete_Error(...)__weakref__ β list of weak references to the object (if defined)__swig_getmethods__ = {}__swig_setmethods__ = {}__new__(*args, **kwargs) from builtins.type β Create and return a new object.__delattr__(self, name, /) β Implement delattr(self, name).__getattribute__(self, name, /) β Return getattr(self, name).__reduce__(...) β Helper for pickle.__setstate__(...)with_traceback(...) β Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.__cause__ β exception cause__context__ β exception context__dict____suppress_context____traceback__argsVirtual base class for expand decider functor.
__call__ = ExpandDecider___call__(...)__disown__(self)__init__(self) β Default constructor.Xapian::ExpandDecider::ExpandDecider()
__repr__ = _swig_repr(self)release = ExpandDecider_release(...) β Start reference counting this object.const ExpandDecider* Xapian::ExpandDecider::release() const
You can hand ownership of a dynamically allocated ExpandDecider object to Xapian by calling release() and then passing the object to a Xapian method. Xapian will arrange to delete the object once it is no longer required.
__swig_destroy__ = delete_ExpandDecider(...) β Virtual destructor, because we have virtual methods.virtual Xapian::ExpandDecider::~ExpandDecider()
__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)thisown β The membership flagExpandDecider subclass which rejects terms using two ExpandDeciders.
Terms are only accepted if they are accepted by both of the specified ExpandDecider objects.
Method resolution order: ExpandDeciderAnd β ExpandDecider β builtins.object
__init__(self, first_, second_) β Compatibility method.Xapian::ExpandDeciderAnd::ExpandDeciderAnd(const ExpandDecider *first_, const ExpandDecider *second_)
Parameters:
__repr__ = _swig_repr(self)__swig_destroy__ = delete_ExpandDeciderAnd(...)thisown β The membership flag__call__ = ExpandDecider___call__(...)__disown__(self)release = ExpandDecider_release(...) β Start reference counting this object.__dict____weakref__ExpandDecider subclass which restricts terms to a particular prefix.
ExpandDeciderFilterPrefix provides an easy way to choose terms with a particular prefix when generating an ESet.
Method resolution order: ExpandDeciderFilterPrefix β ExpandDecider β builtins.object
__init__(self, prefix_) β The parameter specifies the prefix of terms to be retained.Xapian::ExpandDeciderFilterPrefix::ExpandDeciderFilterPrefix(const std::string &prefix_)
Parameters:
__repr__ = _swig_repr(self)__swig_destroy__ = delete_ExpandDeciderFilterPrefix(...)thisown β The membership flag__call____disown__release__dict____weakref__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.
Method resolution order: FeatureUnavailableError β RuntimeError β Error β builtins.Exception β builtins.BaseException β builtins.object
__getattr__ lambda self, name__init__(self, *args) β Construct from message and errno value.Xapian::FeatureUnavailableError::FeatureUnavailableError(const std::string &msg_, int errno_)
Parameters:
__repr__ = _swig_repr(self)__setattr__ lambda self, name, value__swig_destroy__ = delete_FeatureUnavailableError(...)__swig_getmethods__ = {}__swig_setmethods__ = {}__str__get_contextget_error_stringget_msgget_type__weakref____new____delattr____getattribute____reduce____setstate__with_traceback__cause____context____dict____suppress_context____traceback__argsBase class for field processors.
__call__ = FieldProcessor___call__(...)__disown__(self)__init__(self) β Default constructor.Xapian::FieldProcessor::FieldProcessor()
__repr__ = _swig_repr(self)release = FieldProcessor_release(...) β Start reference counting this object.const FieldProcessor* Xapian::FieldProcessor::release() const
You can hand ownership of a dynamically allocated FieldProcessor object to Xapian by calling release() and then passing the object to a Xapian method. Xapian will arrange to delete the object once it is no longer required.
__swig_destroy__ = delete_FieldProcessor(...) β Destructor.virtual Xapian::FieldProcessor::~FieldProcessor()
__dict____weakref__thisownA posting source which returns a fixed weight for all documents.
This returns entries for all documents in the given database, with a fixed weight (specified by a parameter to the constructor).
Method resolution order: FixedWeightPostingSource β PostingSource β builtins.object
__init__(self, wt) β Construct a FixedWeightPostingSource.Xapian::FixedWeightPostingSource::FixedWeightPostingSource(double wt)
Parameters:
__repr__ = _swig_repr(self)__swig_destroy__ = delete_FixedWeightPostingSource(...)thisown__disown__(self)__next__ = PostingSource___next__(...) β Advance the current position to the next matching document.virtual void Xapian::PostingSource::next(double min_wt)=0
__str__at_endcheckget_docidget_maxweightget_termfreq_estget_termfreq_maxget_termfreq_minget_weightinitnamereleaseset_maxweightskip_to__dict____weakref__Calculate the great-circle distance between two coordinates on a sphere.
Experimental - see https://xapian.org/docs/deprecation#experimental features
This uses the haversine formula to calculate the distance. Note that this formula is subject to inaccuracy due to numerical errors for coordinates on the opposite side of the sphere.
See https://en.wikipedia.org/wiki/Haversine_formula
Method resolution order: GreatCircleMetric β LatLongMetric β builtins.object
__init__(self, *args) β Construct a GreatCircleMetric using a specified radius.Xapian::GreatCircleMetric::GreatCircleMetric(double radius_)
This is useful for data sets in which the points are not on Earth (eg, a database of features on Mars).
Parameters:
__repr__ = _swig_repr(self)__swig_destroy__ = delete_GreatCircleMetric(...)thisown__call____disown__namepointwise_distance__dict____weakref__This class implements the IfB2 weighting scheme.
IfB2 is a representative scheme of the Divergence from Randomness Framework by Gianni Amati.
It uses the Inverse term frequency model (If), the Bernoulli method to find the aftereffect of sampling (B) and the second wdf normalization proposed by Amati to normalize the wdf in the document to the length of the document (H2).
For more information about the DFR Framework and the IfB2 scheme, please refer to: Gianni Amati and Cornelis Joost Van Rijsbergen, Probabilistic models of information retrieval based on measuring the divergence from randomness, ACM Transactions on Information Systems (TOIS) 20, (4), 2002, pp. 357-389.
Method resolution order: IfB2Weight β Weight β builtins.object
__init__(self, *args) β Xapian::IfB2Weight::IfB2Weight()__repr__ = _swig_repr(self)__swig_destroy__ = delete_IfB2Weight(...)thisownget_maxextra β Return an upper bound on what get_sumextra() can return for any document.get_maxpart β Return an upper bound on what get_sumpart() can return for any document.get_sumextra β Calculate the term-independent weight component for a document.get_sumpart β Calculate the weight contribution for this object's term to a document.name β Return the name of this weighting scheme.__dict____weakref__ABSOLUTE_DISCOUNT_SMOOTHING = 3DIRICHLET_PLUS_SMOOTHING = 5DIRICHLET_SMOOTHING = 2JELINEK_MERCER_SMOOTHING = 4TWO_STAGE_SMOOTHING = 1This class implements the InL2 weighting scheme.
InL2 is a representative scheme of the Divergence from Randomness Framework by Gianni Amati. This weighting scheme is useful for tasks that require early precision.
It uses the Inverse document frequency model (In), the Laplace method to find the aftereffect of sampling (L) and the second wdf normalization proposed by Amati (H2).
For more information about the DFR Framework and the InL2 scheme, please refer to: Gianni Amati and Cornelis Joost Van Rijsbergen, ibid.
Method resolution order: InL2Weight β Weight β builtins.object
__init__(self, *args) β Xapian::InL2Weight::InL2Weight()__repr__ = _swig_repr(self)__swig_destroy__ = delete_InL2Weight(...)thisownget_maxextraget_maxpartget_sumextraget_sumpartname__dict____weakref__ABSOLUTE_DISCOUNT_SMOOTHING = 3DIRICHLET_PLUS_SMOOTHING = 5DIRICHLET_SMOOTHING = 2JELINEK_MERCER_SMOOTHING = 4TWO_STAGE_SMOOTHING = 1This class implements the IneB2 weighting scheme.
IneB2 is a representative scheme of the Divergence from Randomness Framework by Gianni Amati.
It uses the Inverse expected document frequency model (Ine), the Bernoulli method to find the aftereffect of sampling (B) and the second wdf normalization proposed by Amati (H2).
For more information about the DFR Framework and the IneB2 scheme, please refer to: Gianni Amati and Cornelis Joost Van Rijsbergen, ibid.
Method resolution order: IneB2Weight β Weight β builtins.object
__init__(self, *args) β Xapian::IneB2Weight::IneB2Weight()__repr__ = _swig_repr(self)__swig_destroy__ = delete_IneB2Weight(...)thisownget_maxextraget_maxpartget_sumextraget_sumpartname__dict____weakref__ABSOLUTE_DISCOUNT_SMOOTHING = 3DIRICHLET_PLUS_SMOOTHING = 5DIRICHLET_SMOOTHING = 2JELINEK_MERCER_SMOOTHING = 4TWO_STAGE_SMOOTHING = 1InternalError indicates a runtime problem of some sort.
Method resolution order: InternalError β RuntimeError β Error β builtins.Exception β builtins.BaseException β builtins.object
__getattr__ lambda self, name__init__(self, *args) β Construct from message and errno value.Xapian::InternalError::InternalError(const std::string &msg_, int errno_)
Parameters:
__repr__ = _swig_repr(self)__setattr__ lambda self, name, value__swig_destroy__ = delete_InternalError(...)__swig_getmethods__ = {}__swig_setmethods__ = {}__str__get_contextget_error_stringget_msgget_type__weakref____new____delattr____getattribute____reduce____setstate__with_traceback__cause____context____dict____suppress_context____traceback__argsInvalidArgumentError indicates an invalid parameter value was passed to the API.
Method resolution order: InvalidArgumentError β LogicError β Error β builtins.Exception β builtins.BaseException β builtins.object
__getattr__ lambda self, name__init__(self, *args) β Construct from message and errno value.Xapian::InvalidArgumentError::InvalidArgumentError(const std::string &msg_, int errno_)
Parameters:
__repr__ = _swig_repr(self)__setattr__ lambda self, name, value__swig_destroy__ = delete_InvalidArgumentError(...)__swig_getmethods__ = {}__swig_setmethods__ = {}__str__get_contextget_error_stringget_msgget_type__weakref____new____delattr____getattribute____reduce____setstate__with_traceback__cause____context____dict____suppress_context____traceback__argsInvalidOperationError indicates the API was used in an invalid way.
Method resolution order: InvalidOperationError β LogicError β Error β builtins.Exception β builtins.BaseException β builtins.object
__getattr__ lambda self, name__init__(self, *args) β Construct from message and errno value.Xapian::InvalidOperationError::InvalidOperationError(const std::string &msg_, int errno_)
Parameters:
__repr__ = _swig_repr(self)__setattr__ lambda self, name, value__swig_destroy__ = delete_InvalidOperationError(...)__swig_getmethods__ = {}__swig_setmethods__ = {}__str__get_contextget_error_stringget_msgget_type__weakref____new____delattr____getattribute____reduce____setstate__with_traceback__cause____context____dict____suppress_context____traceback__argsVirtual base class for key making functors.
__call__ = KeyMaker___call__(...)__disown__(self)__init__(self) β Default constructor.Xapian::KeyMaker::KeyMaker()
__repr__ = _swig_repr(self)release = KeyMaker_release(...) β Start reference counting this object.const KeyMaker* Xapian::KeyMaker::release() const
You can hand ownership of a dynamically allocated KeyMaker object to Xapian by calling release() and then passing the object to a Xapian method. Xapian will arrange to delete the object once it is no longer required.
__swig_destroy__ = delete_KeyMaker(...) β Virtual destructor, because we have virtual methods.virtual Xapian::KeyMaker::~KeyMaker()
__dict____weakref__thisownXapian::Weight subclass implementing the Language Model formula.
This class implements the "Language Model" Weighting scheme, as described by the early papers on LM by Bruce Croft. LM works by comparing the query to a Language Model of the document. The language model itself is parameter-free, though LMWeight takes parameters which specify the smoothing used.
Method resolution order: LMWeight β Weight β builtins.object
__init__(self, *args) β Construct a LMWeight.Xapian::LMWeight::LMWeight(double param_log_=0.0, type_smoothing select_smoothing_=TWO_STAGE_SMOOTHING, double param_smoothing1_=-1.0, double param_smoothing2_=-1.0)
Parameters:
type_smoothing. Controls which smoothing type to use. (default: TWO_STAGE_SMOOTHING).select_smoothing_. (default depends on smoothing type).__repr__ = _swig_repr(self)__swig_destroy__ = delete_LMWeight(...)thisownget_maxextraget_maxpartget_sumextraget_sumpartname__dict____weakref__ABSOLUTE_DISCOUNT_SMOOTHING = 3DIRICHLET_PLUS_SMOOTHING = 5DIRICHLET_SMOOTHING = 2JELINEK_MERCER_SMOOTHING = 4TWO_STAGE_SMOOTHING = 1A latitude-longitude coordinate.
Experimental - see https://xapian.org/docs/deprecation#experimental features
Note that latitude-longitude coordinates are only precisely meaningful if the datum used to define them is specified. This class ignores this issue - it is up to the caller to ensure consistency.
__init__(self, *args) β Construct a coordinate.Xapian::LatLongCoord::LatLongCoord(double latitude_, double longitude_)
If the supplied longitude is out of the standard range, it will be normalised to the range 0 <= longitude < 360.
If you want to avoid the checks (for example, you know that your values are already in range), you can use the alternate constructor to construct an uninitialised coordinate, and then set the latitude and longitude directly.
Throws: InvalidArgumentError if the supplied latitude is out of range.
__repr__ = _swig_repr(self)__str__ = LatLongCoord___str__(...) β Return a string describing this object.std::string Xapian::LatLongCoord::get_description() const
serialise = LatLongCoord_serialise(...) β Return a serialised representation of the coordinate.std::string Xapian::LatLongCoord::serialise() const
unserialise = LatLongCoord_unserialise(...) β Unserialise a buffer and set this object to its coordinate.void Xapian::LatLongCoord::unserialise(const char **ptr, const char *end)
The buffer may contain further data after that for the coordinate.
Parameters:
Throws: Xapian::SerialisationError if the string does not start with a valid serialised latitude-longitude pair.
__swig_destroy__ = delete_LatLongCoord(...)__dict____weakref__latitudelongitudethisownA sequence of latitude-longitude coordinates.
Experimental - see https://xapian.org/docs/deprecation#experimental features
__init__(self, *args) β Construct a container holding one coordinate.Xapian::LatLongCoords::LatLongCoords(const LatLongCoord &coord)
__iter__ = _latlongcoords_iter(self) β Get an iterator over all the coordinates in a LatLongCoords.The iterator will return xapian.LatLongCoord objects.
__repr__ = _swig_repr(self)__str__ = LatLongCoords___str__(...) β Return a string describing this object.std::string Xapian::LatLongCoords::get_description() const
append = LatLongCoords_append(...) β Append a coordinate to the end of the sequence.void Xapian::LatLongCoords::append(const LatLongCoord &coord)
begin = LatLongCoords_begin(...) β Get a begin iterator for the coordinates.LatLongCoordsIterator Xapian::LatLongCoords::begin() const
empty = LatLongCoords_empty(...) β Return true if and only if there are no coordinates in the container.bool Xapian::LatLongCoords::empty() const
end = LatLongCoords_end(...) β Get an end iterator for the coordinates.LatLongCoordsIterator Xapian::LatLongCoords::end() const
serialise = LatLongCoords_serialise(...) β Return a serialised form of the coordinate list.std::string Xapian::LatLongCoords::serialise() const
size = LatLongCoords_size(...) β Get the number of coordinates in the container.size_t Xapian::LatLongCoords::size() const
unserialise = LatLongCoords_unserialise(...) β Unserialise a string and set this object to the coordinates in it.void Xapian::LatLongCoords::unserialise(const std::string &serialised)
Parameters:
Throws: Xapian::SerialisationError if the string does not contain a valid serialised latitude-longitude pair, or contains junk at the end.
__swig_destroy__ = delete_LatLongCoords(...)__dict____weakref__thisownAn iterator over all the coordinates in a LatLongCoords object.
The iterator returns LatLongCoord objects.
__eq__(self, other) β Return self==value.__init__(self, start, end) β Initialize self. See help(type(self)) for accurate signature.This enhanced CLASSES section provides a visual overview of Xapian's core classes with emoji indicators for quick scanning.
See help(type(self)) for accurate signature.
__iter__(self)__ne__(self, other) β Return self!=value.__next__(self)__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)__hash__ = NoneLatLongDistanceKeyMaker(*args)
KeyMaker subclass which sorts by distance from a latitude/longitude.
Experimental - seehttps://xapian.org/docs/deprecation#experimental- features
Results are ordered by the distance from a fixed point, or list of points, calculated according to the metric supplied. If multiple points are supplied (either in the constructor, or in the coordinates stored in a document), the closest pointwise distance is used.
If a document contains no coordinate stored in the specified slot, a special value for the distance will be used. This defaults to a large number, so that such results get a low rank, but may be specified by a constructor parameter.
π Method resolution order:
__init__(self, *args) β Construct a LatLongDistanceKeyMaker.slot_: Value slot to use.centre_: Point to calculate distance from.__repr__ = _swig_repr(self)__swig_destroy__ = delete_LatLongDistanceKeyMaker(...) β Xapian::LatLongDistanceKeyMaker::~LatLongDistanceKeyMaker()thisown β The membership flag__call__ = KeyMaker___call__(...)__disown__(self)release = KeyMaker_release(...) β Start reference counting this object.__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)LatLongDistancePostingSource(*args)
Posting source which returns a weight based on geospatial distance.
Experimental - seehttps://xapian.org/docs/deprecation#experimental- features
Results are weighted by the distance from a fixed point, or list of points, calculated according to the metric supplied. If multiple points are supplied (either in the constructor, or in the coordinates stored in a document), the closest pointwise distance is used.
Documents further away than a specified maximum range (or with no location stored in the specified slot) will not be returned.
The weight returned is computed from the distance using the formula: k1 * pow(distance + k1, -k2) (Where k1 and k2 are (strictly) positive, floating point constants, which default to 1000 and 1, respectively. Distance is measured in metres, so this means that something at the centre gets a weight of 1.0, something 1km away gets a weight of 0.5, and something 3km away gets a weight of 0.25, etc)
π Method resolution order:
__init__(self, *args) β Construct a new posting source which returns only documents within range of one of the central coordinates.slot_: The value slot to read values from.centre_: The centre point to use for distance calculations.max_range_: The maximum distance for documents which are returned.k1_: The k1 constant to use in the weighting function.k2_: The k2 constant to use in the weighting function.__repr__ = _swig_repr(self)__swig_destroy__ = delete_LatLongDistancePostingSource(...) β Xapian::LatLongDistancePostingSource::~LatLongDistancePostingSource()thisown β The membership flag__disown__(self)__next__ = ValuePostingSource___next__(...) β Advance the current position to the next matching document.min_wt: The minimum weight contribution that is needed (this is just a hint which subclasses may ignore).at_end = ValuePostingSource_at_end(...) β Return true if the current position is past the last entry in this list.check = ValuePostingSource_check(...) β Check if the specified docid occurs.did: The document id to check.min_wt: The minimum weight contribution that is needed (this is just a hint which subclasses may ignore).done = ValuePostingSource_done(...) β End the iteration.get_database = ValuePostingSource_get_database(...) β The database we're reading values from.get_docid = ValuePostingSource_get_docid(...) β Return the current docid.get_slot = ValuePostingSource_get_slot(...) β The slot we're reading values from.get_started = ValuePostingSource_get_started(...) β Flag indicating if we've started (true if we have).get_termfreq_est = ValuePostingSource_get_termfreq_est(...) β An estimate of the number of documents this object can return.get_termfreq_max = ValuePostingSource_get_termfreq_max(...) β An upper bound on the number of documents this object can return.get_termfreq_min = ValuePostingSource_get_termfreq_min(...) β A lower bound on the number of documents this object can return.get_value = ValuePostingSource_get_value(...) β Read current value.init = ValuePostingSource_init(...) β Set this PostingSource to the start of the list of postings.db: The database which the PostingSource should iterate through.set_termfreq_est = ValuePostingSource_set_termfreq_est(...) β An estimate of the term frequency.set_termfreq_max = ValuePostingSource_set_termfreq_max(...) β An upper bound on the term frequency.set_termfreq_min = ValuePostingSource_set_termfreq_min(...) β Set a lower bound on the term frequency.skip_to = ValuePostingSource_skip_to(...) β Advance to the specified docid.did: The document id to advance to.min_wt: The minimum weight contribution that is needed (this is just a hint which subclasses may ignore).__str__ = PostingSource___str__(...) β Return a string describing this object.get_maxweight = PostingSource_get_maxweight(...) β Return the currently set upper bound on what get_weight() can return.get_weight = PostingSource_get_weight(...) β Return the weight contribution for the current document.name = PostingSource_name(...) β Name of the posting source class.release = PostingSource_release(...) β Start reference counting this object.set_maxweight = PostingSource_set_maxweight(...) β Specify an upper bound on what get_weight() will return from now on.max_weight: The upper bound to set.__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)Base class for calculating distances between two lat/long coordinates.
Experimental - seehttps://xapian.org/docs/deprecation#experimental- features
__call__ = LatLongMetric___call__(...)__disown__(self)__init__(self) β Initialize self. See help(type(self)) for accurate signature.__repr__ = _swig_repr(self)name = LatLongMetric_name(...) β Return the full name of the metric.pointwise_distance = LatLongMetric_pointwise_distance(...) β Return the distance between two coordinates, in metres.__swig_destroy__ = delete_LatLongMetric(...) β Destructor.__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)thisown β The membership flagLogicError(*args, **kwargs)
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.
π Method resolution order:
__getattr__ lambda self, name__init__(self, *args, **kwargs) β Initialize self. See help(type(self)) for accurate signature.__repr__ = _swig_repr(self)__setattr__ lambda self, name, value__swig_destroy__ = delete_LogicError(...)__swig_getmethods__ = {}__swig_setmethods__ = {}__str__ = Error___str__(...)get_context = Error_get_context(...) β Optional context information.get_error_string = Error_get_error_string(...) β Returns any system error string associated with this exception.get_msg = Error_get_msg(...) β Message giving details of the error, intended for human consumption.get_type = Error_get_type(...) β The type of this error (e.g. "DocNotFoundError".)__weakref__ β list of weak references to the object (if defined)__new__(*args, **kwargs) from builtins.type β Create and return a new object. See help(type) for accurate signature.__delattr__(self, name, /) β Implement delattr(self, name).__getattribute__(self, name, /) β Return getattr(self, name).__reduce__(...) β Helper for pickle.__setstate__(...)with_traceback(...) β Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.__cause__ β exception cause__context__ β exception context__dict____suppress_context____traceback__argsClass representing a list of search results.
__getitem__ = _mset_getitem(self, index) β Get an item from the MSet. The supplied index is relative to the start of the MSet, not the absolute rank of the item. Returns an MSetItem.__init__(self) β Default constructor.__iter__ = _mset_gen_iter(self) β Return an iterator over the MSet. The iterator will return MSetItem objects, which will be evaluated lazily where appropriate.__len__ lambda self__repr__ = _swig_repr(self)__str__ = MSet___str__(...) β Return a string describing this object.back = MSet_back(...) β Return iterator pointing to the last object in this MSet.convert_to_percent = MSet_convert_to_percent(...) β Convert the weight of the current iterator position to a percentage.empty = MSet_empty(...) β Return true if this MSet object is empty.fetch = MSet_fetch(...) β Prefetch hint the whole MSet.get_docid = MSet_get_docid(...)get_document = MSet_get_document(...)get_document_percentage = MSet_get_document_percentage(...)get_firstitem = MSet_get_firstitem(...) β Rank of first item in this MSet.get_hit = _mset_getitem(self, index) β Get an item from the MSet. The supplied index is relative to the start of the MSet, not the absolute rank of the item. Returns an MSetItem.get_matches_estimated = MSet_get_matches_estimated(...) β Estimate of the total number of matching documents.get_matches_lower_bound = MSet_get_matches_lower_bound(...) β Lower bound on the total number of matching documents.get_matches_upper_bound = MSet_get_matches_upper_bound(...) β Upper bound on the total number of matching documents.get_max_attained = MSet_get_max_attained(...) β The maximum weight attained by any document.get_max_possible = MSet_get_max_possible(...) β The maximum possible weight any document could achieve.get_termfreq = MSet_get_termfreq(...) β Get the termfreq of a term.get_termweight = MSet_get_termweight(...) β Get the term weight of a term.get_uncollapsed_matches_estimated = MSet_get_uncollapsed_matches_estimated(...) β Estimate of the total number of matching documents before collapsing.get_uncollapsed_matches_lower_bound = MSet_get_uncollapsed_matches_lower_bound(...) β Lower bound on the total number of matching documents before collapsing.get_uncollapsed_matches_upper_bound = MSet_get_uncollapsed_matches_upper_bound(...) β Upper bound on the total number of matching documents before collapsing.size = MSet_size(...) β Return number of items in this MSet object.snippet = MSet_snippet(...) β Generate a snippet.__swig_destroy__ = delete_MSet(...) β Destructor.__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)thisown β The membership flagSNIPPET_BACKGROUND_MODEL = 1SNIPPET_CJK_NGRAM = 2048SNIPPET_EMPTY_WITHOUT_MATCH = 4SNIPPET_EXHAUSTIVE = 2MSetItem(iter, mset)
An item returned from iteration of the MSet.
The item supports access to the following attributes and properties:
docid: The Xapian document ID corresponding to this MSet item.weight: The weight corresponding to this MSet item.rank: The rank of this MSet item. The rank is the position in the total set of matching documents of this item. The highest document is given a rank of 0. If the MSet did not start at the highest matching document, because a non-zero 'start' parameter was supplied to get_mset(), the first document in the MSet will have a rank greater than 0 (in fact, it will be equal to the value of 'start' supplied to get_mset()).percent: The percentage score assigned to this MSet item.document: The document for this MSet item. This can be used to access the document data, or any other information stored in the document (such as term lists). It is lazily evaluated.collapse_key: The value of the key which was used for collapsing.collapse_count: An estimate of the number of documents that have been collapsed into this one.The collapse count estimate will always be less than or equal to the actual number of other documents satisfying the match criteria with the same collapse key as this document. If may be 0 even though there are other documents with the same collapse key which satisfying the match criteria. However if this method returns non-zero, there definitely are other such documents. So this method may be used to inform the user that there are "at least N other matches in this group", or to control whether to offer a "show other documents in this group" feature (but note that it may not offer it in every case where it would show other documents).
__init__(self, iter, mset) β Initialize self. See help(type(self)) for accurate signature.document β The document object corresponding to this MSet item.collapse_countcollapse_keydocidpercentrankweightMSetIter(mset)
An iterator over the items in an MSet. The iterator will return MSetItem objects, which will be evaluated lazily where appropriate.
__init__(self, mset) β Initialize self. See help(type(self)) for accurate signature.__iter__(self)__next__(self)Base class for matcher decision functor.
__call__ = MatchDecider___call__(...)__disown__(self)__init__(self) β Default constructor.__repr__ = _swig_repr(self)__swig_destroy__ = delete_MatchDecider(...) β Destructor.__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)thisown β The membership flagAbstract base class for match spies.
The subclasses will generally accumulate information seen during the match, to calculate aggregate functions, or other profiles of the matching documents.
__call__ = MatchSpy___call__(...)__disown__(self)__init__(self) β Default constructor, needed by subclass constructors.__repr__ = _swig_repr(self)__str__ = MatchSpy___str__(...) β Return a string describing this object.merge_results = MatchSpy_merge_results(...) β Unserialise some results, and merge them into this matchspy.serialised: A string containing the serialised results.name = MatchSpy_name(...) β Return the name of this match spy.release = MatchSpy_release(...) β Start reference counting this object.__swig_destroy__ = delete_MatchSpy(...) β Virtual destructor, because we have virtual methods.__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)thisown β The membership flagKeyMaker subclass which combines several values.
When the result is used for sorting, results are ordered by the first value. In the event of a tie, the second is used. If this is the same for both, the third is used, and so on. If reverse is true for a value, then the sort order for that value is reversed.
When used for collapsing, the documents will only be considered equal if all the values specified match. If none of the specified values are set then the generated key will be empty, so such documents won't be collapsed (which is consistent with the behaviour in the "collapse on a value" case). If you'd prefer that documents with none of the keys set are collapsed together, then you can set reverse for at least one of the values. Other than this, it isn't useful to set reverse for collapsing.
π Method resolution order:
__init__(self) β Construct a MultiValueKeyMaker from a pair of iterators.__repr__ = _swig_repr(self)add_value = MultiValueKeyMaker_add_value(...) β Add a value slot to the list to build a key from.slot: The value slot to addreverse: Adjust values from this slot to reverse their sort order (default: false)defvalue: Value to use for documents which don't have a value set in this slot (default: empty). This can be used to make such documents sort after all others by passing get_value_upper_bound(slot) + "x" this is guaranteed to be greater than any value in this slot.__swig_destroy__ = delete_MultiValueKeyMaker(...)thisown β The membership flag__call__ = KeyMaker___call__(...)__disown__(self)release = KeyMaker_release(...) β Start reference counting this object.__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)NetworkError(*args)
Indicates a problem communicating with a remote database.
π Method resolution order:
__getattr__ lambda self, name__init__(self, *args) β Construct from message and errno value.msg_: Message giving details of the error, intended for human consumption.errno_: Optional errno value associated with this error.__repr__ = _swig_repr(self)__setattr__ lambda self, name, value__swig_destroy__ = delete_NetworkError(...)__swig_getmethods__ = {}__swig_setmethods__ = {}__str__ = Error___str__(...)get_context = Error_get_context(...) β Optional context information.get_error_string = Error_get_error_string(...) β Returns any system error string associated with this exception.get_msg = Error_get_msg(...) β Message giving details of the error, intended for human consumption.get_type = Error_get_type(...) β The type of this error (e.g. "DocNotFoundError".)__weakref__ β list of weak references to the object (if defined)__new__(*args, **kwargs) from builtins.type β Create and return a new object. See help(type) for accurate signature.__delattr__(self, name, /) β Implement delattr(self, name).__getattribute__(self, name, /) β Return getattr(self, name).__reduce__(...) β Helper for pickle.__setstate__(...)with_traceback(...) β Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.__cause__ β exception cause__context__ β exception context__dict____suppress_context____traceback__argsNetworkTimeoutError(*args)
Indicates a timeout expired while communicating with a remote database.
π Method resolution order:
__getattr__ lambda self, name__init__(self, *args) β Construct from message and errno value.msg_: Message giving details of the error, intended for human consumption.errno_: Optional errno value associated with this error.__repr__ = _swig_repr(self)__setattr__ lambda self, name, value__swig_destroy__ = delete_NetworkTimeoutError(...)__swig_getmethods__ = {}__swig_setmethods__ = {}__str__ = Error___str__(...)get_context = Error_get_context(...) β Optional context information.get_error_string = Error_get_error_string(...) β Returns any system error string associated with this exception.get_msg = Error_get_msg(...) β Message giving details of the error, intended for human consumption.get_type = Error_get_type(...) β The type of this error (e.g. "DocNotFoundError".)__weakref__ β list of weak references to the object (if defined)__new__(*args, **kwargs) from builtins.type β Create and return a new object. See help(type) for accurate signature.__delattr__(self, name, /) β Implement delattr(self, name).__getattribute__(self, name, /) β Return getattr(self, name).__reduce__(...) β Helper for pickle.__setstate__(...)with_traceback(...) β Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.__cause__ β exception cause__context__ β exception context__dict____suppress_context____traceback__argsNumberRangeProcessor(*args)
Handle a number range.
This class must be used on values which have been encoded using Xapian::sortable_serialise() which turns numbers into strings which will sort in the same order as the numbers (the same values can be used to implement a numeric sort).
π Method resolution order:
__init__(self, *args) β Constructor.slot_: The value slot number to query.str_: A string to look for to recognise values as belonging to this numeric range.flags_: Zero or more of the following flags, combined with bitwise-or: Xapian::RP_SUFFIX - require str_ as a suffix instead of a prefix. Xapian::RP_REPEATED - optionally allow str_ on both ends of the range - e.g. $1..$10 or 5m..50m. By default a prefix is only checked for on the start (e.g. date:1/1/1980..31/12/1989), and a suffix only on the end (e.g. 2..12kg). The string supplied in str_ is used by operator() to decide whether the pair of strings supplied to it constitute a valid range. If prefix_ is true, the first value in a range must begin with str_ (and the second value may optionally begin with str_); if prefix_ is false, the second value in a range must end with str_ (and the first value may optionally end with str_). If str_ is empty, the setting of prefix_ is irrelevant, and no special strings are required at the start or end of the strings defining the range. The remainder of both strings defining the endpoints must be valid floating point numbers. (FIXME: define format recognised). For example, if str_ is "$" and prefix_ is true, and the range processor has been added to the queryparser, the queryparser will accept "$10..50" or "$10..$50", but not "10..50" or "10..$50" as valid ranges. If str_ is "kg" and prefix_ is false, the queryparser will accept "10..50kg" or "10kg..50kg", but not "10..50" or "10kg..50" as valid ranges.__repr__ = _swig_repr(self)__swig_destroy__ = delete_NumberRangeProcessor(...)thisown β The membership flag__call__ = RangeProcessor___call__(...)__disown__(self)check_range = RangeProcessor_check_range(...) β Check prefix/suffix on range.release = RangeProcessor_release(...) β Start reference counting this object.__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)NumberValueRangeProcessor(*args)
Handle a number range.
This class must be used on values which have been encoded using Xapian::sortable_serialise() which turns numbers into strings which will sort in the same order as the numbers (the same values can be used to implement a numeric sort).
Deprecated Use Xapian::NumberRangeProcessor instead (added in 1.3.6).
π Method resolution order:
__init__(self, *args) β Constructor.slot_: The value number to return from operator().str_: A string to look for to recognise values as belonging to this numeric range.prefix_: Whether to look for the string at the start or end of the values. If true, the string is a prefix; if false, the string is a suffix (default: true). The string supplied in str_ is used by operator() to decide whether the pair of strings supplied to it constitute a valid range. If prefix_ is true, the first value in a range must begin with str_ (and the second value may optionally begin with str_); if prefix_ is false, the second value in a range must end with str_ (and the first value may optionally end with str_). If str_ is empty, the setting of prefix_ is irrelevant, and no special strings are required at the start or end of the strings defining the range. The remainder of both strings defining the endpoints must be valid floating point numbers. (FIXME: define format recognised). For example, if str_ is "$" and prefix_ is true, and the range processor has been added to the queryparser, the queryparser will accept "$10..50" or "$10..$50", but not "10..50" or "10..$50" as valid ranges. If str_ is "kg" and prefix_ is false, the queryparser will accept "10..50kg" or "10kg..50kg", but not "10..50" or "10kg..50" as valid ranges.__repr__ = _swig_repr(self)__swig_destroy__ = delete_NumberValueRangeProcessor(...)thisown β The membership flag__call__ = ValueRangeProcessor___call__(...)__disown__(self)release = ValueRangeProcessor_release(...) β Start reference counting this object.__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)PL2PlusWeight(*args)
Xapian::Weight subclass implementing the PL2+ probabilistic formula.
π Method resolution order:
__init__(self, *args) β Xapian::PL2PlusWeight::PL2PlusWeight()__repr__ = _swig_repr(self)__swig_destroy__ = delete_PL2PlusWeight(...)thisown β The membership flagget_maxextra = Weight_get_maxextra(...) β Return an upper bound on what get_sumextra() can return for any document.get_maxpart = Weight_get_maxpart(...) β Return an upper bound on what get_sumpart() can return for any document.get_sumextra = Weight_get_sumextra(...) β Calculate the term-independent weight component for a document.doclen: The document's length (unnormalised).uniqterms: The number of unique terms in the document.get_sumpart = Weight_get_sumpart(...) β Calculate the weight contribution for this object's term to a document.wdf: The within document frequency of the term in the document.doclen: The document's length (unnormalised).uniqterms: Number of unique terms in the document (used for absolute smoothing).name = Weight_name(...) β Return the name of this weighting scheme.__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)ABSOLUTE_DISCOUNT_SMOOTHING = 3DIRICHLET_PLUS_SMOOTHING = 5DIRICHLET_SMOOTHING = 2JELINEK_MERCER_SMOOTHING = 4TWO_STAGE_SMOOTHING = 1PL2Weight(*args)
This class implements the PL2 weighting scheme.
PL2 is a representative scheme of the Divergence from Randomness Framework by Gianni Amati.
This weighting scheme is useful for tasks that require early precision.
It uses the Poisson approximation of the Binomial Probabilistic distribution (P) along with Stirling's approximation for the factorial value, the Laplace method to find the aftereffect of sampling (L) and the second wdf normalization proposed by Amati to normalize the wdf in the document to the length of the document (H2).
For more information about the DFR Framework and the PL2 scheme, please refer to : Gianni Amati and Cornelis Joost Van Rijsbergen Probabilistic models of information retrieval based on measuring the divergence from randomness ACM Transactions on Information Systems (TOIS) 20, (4), 2002, pp. 357-389.
π Method resolution order:
__init__(self, *args) β Xapian::PL2Weight::PL2Weight()__repr__ = _swig_repr(self)__swig_destroy__ = delete_PL2Weight(...)thisown β The membership flagget_maxextra = Weight_get_maxextra(...) β Return an upper bound on what get_sumextra() can return for any document.get_maxpart = Weight_get_maxpart(...) β Return an upper bound on what get_sumpart() can return for any document.get_sumextra = Weight_get_sumextra(...) β Calculate the term-independent weight component for a document.doclen: The document's length (unnormalised).uniqterms: The number of unique terms in the document.get_sumpart = Weight_get_sumpart(...) β Calculate the weight contribution for this object's term to a document.wdf: The within document frequency of the term in the document.doclen: The document's length (unnormalised).uniqterms: Number of unique terms in the document (used for absolute smoothing).name = Weight_name(...) β Return the name of this weighting scheme.__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)ABSOLUTE_DISCOUNT_SMOOTHING = 3DIRICHLET_PLUS_SMOOTHING = 5DIRICHLET_SMOOTHING = 2JELINEK_MERCER_SMOOTHING = 4TWO_STAGE_SMOOTHING = 1PositionIter(start=0, end=0)
An iterator over a position list. The iterator will return integers, in ascending order.
__init__(self, start=0, end=0) β Initialize self. See help(type(self)) for accurate signature.__iter__(self)__next__(self)__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)PostingItem(iter)
An item returned from iteration of a posting list.
The item supports access to the following attributes and properties:
docid: The document ID corresponding to this PostingItem.doclength: The length of the document corresponding to this PostingItem.wdf: The within document frequency of the term which the posting list is for in the document corresponding to this PostingItem.positer: An iterator over the positions which the term corresponing to this posting list occurs at in the document corresponding to this PostingItem. This is only available until the iterator which returned this item next moves.__init__(self, iter) β Initialize self. See help(type(self)) for accurate signature.positer β A position iterator for the current posting (if meaningful). The iterator will return integers representing the positions that the term occurs at. This will raise a InvalidOperationError exception if the iterator this item came from doesn't support position lists, or if the iterator has moved on since the item was returned from it.dociddoclengthwdfPostingIter(start, end, has_positions=False)
An iterator over a posting list. The iterator will return PostingItem objects, which will be evaluated lazily where appropriate.
__init__(self, start, end, has_positions=False) β Initialize self. See help(type(self)) for accurate signature.__iter__(self)__next__(self)skip_to(self, docid) β Skip the iterator forward. The iterator is advanced to the first document with a document ID which is greater than or equal to the supplied document ID. If there are no such items, this will raise StopIteration. This returns the item which the iterator is moved to. The subsequent item will be returned the next time that next() is called (unless skip_to() is called again first).Base class which provides an "external" source of postings.
__disown__(self)__init__(self) β Allow subclasses to be instantiated.__next__ = PostingSource___next__(...) β Advance the current position to the next matching document.min_wt: The minimum weight contribution that is needed (this is just a hint which subclasses may ignore).__repr__ = _swig_repr(self)__str__ = PostingSource___str__(...) β Return a string describing this object.at_end = PostingSource_at_end(...) β Return true if the current position is past the last entry in this list.check = PostingSource_check(...) β Check if the specified docid occurs.did: The document id to check.min_wt: The minimum weight contribution that is needed (this is just a hint which subclasses may ignore).get_docid = PostingSource_get_docid(...) β Return the current docid.get_maxweight = PostingSource_get_maxweight(...) β Return the currently set upper bound on what get_weight() can return.get_termfreq_est = PostingSource_get_termfreq_est(...) β An estimate of the number of documents this object can return.get_termfreq_max = PostingSource_get_termfreq_max(...) β An upper bound on the number of documents this object can return.get_termfreq_min = PostingSource_get_termfreq_min(...) β A lower bound on the number of documents this object can return.get_weight = PostingSource_get_weight(...) β Return the weight contribution for the current document.init = PostingSource_init(...) β Set this PostingSource to the start of the list of postings.db: The database which the PostingSource should iterate through.name = PostingSource_name(...) β Name of the posting source class.release = PostingSource_release(...) β Start reference counting this object.set_maxweight = PostingSource_set_maxweight(...) β Specify an upper bound on what get_weight() will return from now on.max_weight: The upper bound to set.skip_to = PostingSource_skip_to(...) β Advance to the specified docid.did: The document id to advance to.min_wt: The minimum weight contribution that is needed (this is just a hint which subclasses may ignore).__swig_destroy__ = delete_PostingSource(...) β virtual Xapian::PostingSource::~PostingSource()__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)thisown β The membership flagQuery(*args)
Class representing a query.
__init__ = _query_init(self, *args) β Make a new query object. Many possible arguments are possible - see the documentation for details.__iter__ = _query_gen_iter(self) β Get an iterator over the terms in a query. The iterator will return string objects.__repr__ = _swig_repr(self)__str__ = Query___str__(...) β Return a string describing this object.empty = Query_empty(...) β Check if this query is Xapian::Query::MatchNothing.get_length = Query_get_length(...) β Return the length of this query object.get_num_subqueries = Query_get_num_subqueries(...) β Get the number of subqueries of the top level query.get_subquery = Query_get_subquery(...) β Read a top level subquery.n: Return the n-th subquery (starting from 0) - only valid when 0 <= n < get_num_subqueries().get_type = Query_get_type(...) β Get the type of the top level of the query.get_unique_terms_begin = Query_get_unique_terms_begin(...) β Begin iterator for unique terms in the query object.get_unique_terms_end = Query_get_unique_terms_end(...) β End iterator for unique terms in the query object.serialise = Query_serialise(...) β Serialise this object into a string.__swig_destroy__ = delete_Query(...) β Destructor.unserialise = Query_unserialise(...)__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)thisown β The membership flagMatchAll = <xapian.Query; proxy of <Swig Object of type 'Xapian::Query...'>MatchNothing = <xapian.Query; proxy of <Swig Object of type 'Xapian::Q...'>OP_AND = 0OP_AND_MAYBE = 4OP_AND_NOT = 2OP_ELITE_SET = 10OP_FILTER = 5OP_INVALID = 99OP_MAX = 14OP_NEAR = 6OP_OR = 1OP_PHRASE = 7OP_SCALE_WEIGHT = 9OP_SYNONYM = 13OP_VALUE_GE = 11OP_VALUE_LE = 12OP_VALUE_RANGE = 8OP_WILDCARD = 15OP_XOR = 3WILDCARD_LIMIT_ERROR = 0WILDCARD_LIMIT_FIRST = 1WILDCARD_LIMIT_MOST_FREQUENT = 2Build a Xapian::Query object from a user query string.
__init__(self) β Default constructor.__repr__ = _swig_repr(self)__str__ = QueryParser___str__(...) β Return a string describing this object.add_boolean_prefix = _queryparser_add_boolean_prefix(self, s, proc, exclusive=True) β Register a FieldProcessor for a boolean prefix.add_prefix = _queryparser_add_prefix(self, s, proc) β Register a FieldProcessor.add_rangeprocessor = _queryparser_add_rangeprocessor(self, rproc) β Register a RangeProcessor.add_valuerangeprocessor = _queryparser_add_valuerangeprocessor(self, vrproc) β Register a ValueRangeProcessor.get_corrected_query_string = QueryParser_get_corrected_query_string(...) β Get the spelling-corrected query string.get_default_op = QueryParser_get_default_op(...) β Get the current default operator.parse_query = QueryParser_parse_query(...) β Parse a query.query_string: A free-text query as entered by a userflags: Zero or more QueryParser::feature_flag specifying what features the QueryParser should support. Combine multiple values with bitwise-or (|) (default FLAG_DEFAULT).default_prefix: The default term prefix to use (default none). For example, you can pass "A" when parsing an "Author" field.set_database = QueryParser_set_database(...) β Specify the database being searched.db: The database to use for spelling correction (FLAG_SPELLING_CORRECTION), and synonyms (FLAG_SYNONYM, FLAG_AUTO_SYNONYMS, and FLAG_AUTO_MULTIWORD_SYNONYMS).set_default_op = QueryParser_set_default_op(...) β Set the default operator.default_op: The operator to use to combine non-filter query items when no explicit operator is used. So for example, 'weather forecast' is parsed as if it were 'weather OR forecast' by default. The most useful values for this are OP_OR (the default) and OP_AND. OP_NEAR, OP_PHRASE, OP_ELITE_SET, OP_SYNONYM and OP_MAX are also permitted. Passing other values will result in InvalidArgumentError being thrown.set_max_expansion = QueryParser_set_max_expansion(...) β Specify the maximum expansion of a wildcard and/or partial term.max_expansion: The maximum number of terms each wildcard in the query can expand to, or 0 for no limit (which is the default).max_type: Xapian::Query::WILDCARD_LIMIT_ERROR, Xapian::Query::WILDCARD_LIMIT_FIRST or Xapian::Query::WILDCARD_LIMIT_MOST_FREQUENT (default: Xapian::Query::WILDCARD_LIMIT_ERROR).flags: What to set the limit for (default: FLAG_WILDCARD|FLAG_PARTIAL, setting the limit for both wildcards and partial terms).set_max_wildcard_expansion = QueryParser_set_max_wildcard_expansion(...) β Specify the maximum expansion of a wildcard.set_stemmer = QueryParser_set_stemmer(...) β Set the stemmer.stemmer: The Xapian::Stem object to set.set_stemming_strategy = QueryParser_set_stemming_strategy(...) β Set the stemming strategy.strategy: The strategy to use - possible values are: STEM_NONE: Don't perform any stemming. (default in Xapian <= 1.3.0) STEM_SOME: Stem all terms except for those which start with a capital letter, or are followed by certain characters (currently: (/@<>=*[{" ), or are used with operators which need positional information. Stemmed terms are prefixed with 'Z'. (default in Xapian >= 1.3.1) STEM_SOME_FULL_POS: Like STEM_SOME but also stems terms used with operators which need positional information. Added in Xapian 1.4.8. STEM_ALL: Stem all terms (note: no 'Z' prefix is added). STEM_ALL_Z: Stem all terms (note: 'Z' prefix is added). (new in Xapian 1.2.11 and 1.3.1)set_stopper = _queryparser_set_stopper(self, stopper) β Set the stopper.stop: The Stopper object to set (default NULL, which means no stopwords).stoplist = _queryparser_gen_stoplist_iter(self) β Get an iterator over all the stopped terms from the previous query. This returns an iterator over all the terms which were omitted from the previously parsed query due to being considered to be stopwords. Each instance of a word omitted from the query is represented in the returned list, in the order in which the The iterator will return string objects.unstemlist = _queryparser_gen_unstemlist_iter(self, tname) β Get an iterator over all the unstemmed forms of a stemmed term. This returns an iterator which returns all the unstemmed words which were stemmed to the stemmed form specified by `tname` when parsing the previous query. Each instance of a word which stems to `tname` is returned by the iterator in the order in which the words appeared in the query - an individual unstemmed word may thus occur multiple times. The iterator will return string objects.__swig_destroy__ = delete_QueryParser(...) β Destructor.__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)thisown β The membership flagFLAG_ACCUMULATE = 65536FLAG_AUTO_MULTIWORD_SYNONYMS = 1024FLAG_AUTO_SYNONYMS = 512FLAG_BOOLEAN = 1FLAG_BOOLEAN_ANY_CASE = 8FLAG_CJK_NGRAM = 2048FLAG_DEFAULT = 7FLAG_LOVEHATE = 4FLAG_PARTIAL = 64FLAG_PHRASE = 2FLAG_PURE_NOT = 32FLAG_SPELLING_CORRECTION = 128FLAG_SYNONYM = 256FLAG_WILDCARD = 16STEM_ALL = 2STEM_ALL_Z = 3STEM_NONE = 0STEM_SOME = 1STEM_SOME_FULL_POS = 4QueryParserError(*args)
Indicates a query string can't be parsed.
π Method resolution order:
__getattr__ lambda self, name__init__(self, *args) β Construct from message and errno value.msg_: Message giving details of the error, intended for human consumption.errno_: Optional errno value associated with this error.__repr__ = _swig_repr(self)__setattr__ lambda self, name, value__swig_destroy__ = delete_QueryParserError(...)__swig_getmethods__ = {}__swig_setmethods__ = {}__str__ = Error___str__(...)get_context = Error_get_context(...) β Optional context information.get_error_string = Error_get_error_string(...) β Returns any system error string associated with this exception.get_msg = Error_get_msg(...) β Message giving details of the error, intended for human consumption.get_type = Error_get_type(...) β The type of this error (e.g. "DocNotFoundError".)__weakref__ β list of weak references to the object (if defined)__new__(*args, **kwargs) from builtins.type β Create and return a new object. See help(type) for accurate signature.__delattr__(self, name, /) β Implement delattr(self, name).__getattribute__(self, name, /) β Return getattr(self, name).__reduce__(...) β Helper for pickle.__setstate__(...)with_traceback(...) β Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.__cause__ β exception cause__context__ β exception context__dict____suppress_context____traceback__argsA relevance set (R-Set). This is the set of documents which are marked as relevant, for use in modifying the term weights, and in performing query expansion.
__init__(self) β Default constructor.__repr__ = _swig_repr(self)__str__ = RSet___str__(...) β Return a string describing this object.add_document = RSet_add_document(...) β Add a document to the relevance set.contains = RSet_contains(...) β Test if a given document in the relevance set.empty = RSet_empty(...) β Test if this R-Set is empty.remove_document = RSet_remove_document(...) β Remove a document from the relevance set.size = RSet_size(...) β The number of documents in this R-Set.__swig_destroy__ = delete_RSet(...) β Destructor.__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)thisown β The membership flagRangeError(*args)
RangeError indicates an attempt to access outside the bounds of a container.
π Method resolution order:
__getattr__ lambda self, name__init__(self, *args) β Construct from message and errno value.msg_: Message giving details of the error, intended for human consumption.errno_: Optional errno value associated with this error.__repr__ = _swig_repr(self)__setattr__ lambda self, name, value__swig_destroy__ = delete_RangeError(...)__swig_getmethods__ = {}__swig_setmethods__ = {}__str__ = Error___str__(...)get_context = Error_get_context(...) β Optional context information.get_error_string = Error_get_error_string(...) β Returns any system error string associated with this exception.get_msg = Error_get_msg(...) β Message giving details of the error, intended for human consumption.get_type = Error_get_type(...) β The type of this error (e.g. "DocNotFoundError".)__weakref__ β list of weak references to the object (if defined)__new__(*args, **kwargs) from builtins.type β Create and return a new object. See help(type) for accurate signature.__delattr__(self, name, /) β Implement delattr(self, name).__getattribute__(self, name, /) β Return getattr(self, name).__reduce__(...) β Helper for pickle.__setstate__(...)with_traceback(...) β Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.__cause__ β exception cause__context__ β exception context__dict____suppress_context____traceback__argsRangeProcessor(*args)
Base class for range processors.
__call__ = RangeProcessor___call__(...)__disown__(self)__init__(self, *args) β Constructor.slot_: Which value slot to generate ranges over.str_: A string to look for to recognise values as belonging to this range (as a prefix by default, or as a suffix if flags Xapian::RP_SUFFIX is specified).flags_: Zero or more of the following flags, combined with bitwise-or (| in C++): Xapian::RP_SUFFIX - require str_ as a suffix instead of a prefix. Xapian::RP_REPEATED - optionally allow str_ on both ends of the range - e.g. $1..$10 or 5m..50m. By default a prefix is only checked for on the start (e.g. date:1/1/1980..31/12/1989), and a suffix only on the end (e.g. 2..12kg).__repr__ = _swig_repr(self)check_range = RangeProcessor_check_range(...) β Check prefix/suffix on range.release = RangeProcessor_release(...) β Start reference counting this object.__swig_destroy__ = delete_RangeProcessor(...) β Destructor.__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)thisown β The membership flagRegistry for user subclasses. This class provides a way for the remote server to look up user subclasses when unserialising.
__init__(self) β Default constructor.__repr__ = _swig_repr(self)get_lat_long_metric = Registry_get_lat_long_metric(...) β Get a lat-long metric given a name.get_match_spy = Registry_get_match_spy(...) β Get a match spy given a name.name: The name of the match spy to find.get_posting_source = Registry_get_posting_source(...) β Get a posting source given a name.name: The name of the posting source to find.get_weighting_scheme = Registry_get_weighting_scheme(...) β Get the weighting scheme given a name.name: The name of the weighting scheme to find.π The returned object is owned by the registry and must not be deleted by the caller.
register_lat_long_metric = Registry_register_lat_long_metric(...) β Register a user-defined lat-long metric class.void Xapian::Registry::register_lat_long_metric(const Xapian::LatLongMetric &metric)
register_match_spy = Registry_register_match_spy(...) β Register a user-defined match spy class.void Xapian::Registry::register_match_spy(const Xapian::MatchSpy &spy)
spy: The match spy to register.register_posting_source = Registry_register_posting_source(...) β Register a user-defined posting source class.void Xapian::Registry::register_posting_source(const Xapian::PostingSource &source)
source: The posting source to register.register_weighting_scheme = Registry_register_weighting_scheme(...) β Register a weighting scheme.void Xapian::Registry::register_weighting_scheme(const Xapian::Weight &wt)
wt: The weighting scheme to register.__swig_destroy__ = delete_Registry(...) β Xapian::Registry::~Registry()__dict__ β dictionary for instance variables (if defined)__weakref__ β list of weak references to the object (if defined)thisown β The membership flagβ‘ 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.
__getattr__ lambda self, name__init__(self, *args, **kwargs) β Initialize self. See help(type(self)) for accurate signature.__repr__ = _swig_repr(self)__setattr__ lambda self, name, value__swig_destroy__ = delete_RuntimeError(...)__swig_getmethods__ = {}__swig_setmethods__ = {}__str__ = Error___str__(...)get_context = Error_get_context(...) β 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.
get_error_string = Error_get_error_string(...) β 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.
get_msg = Error_get_msg(...) β Message giving details of the error, intended for human consumption.const std::string& Xapian::Error::get_msg() const
get_type = Error_get_type(...) β The type of this error (e.g. "DocNotFoundError".)const char* Xapian::Error::get_type() const
__weakref__ β list of weak references to the object (if defined)__new__(*args, **kwargs) from builtins.type β Create and return a new object. See help(type) for accurate signature.__delattr__(self, name, /) β Implement delattr(self, name).__getattribute__(self, name, /) β Return getattr(self, name).__reduce__(...) β Helper for pickle.__setstate__(...)with_traceback(...) β Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.__cause__ β exception cause__context__ β exception context__dict____suppress_context____traceback__argsβ οΈ Indicates an error in the std::string serialisation of an object.
__getattr__ lambda self, name__init__(self, *args) β Construct from message and errno value.Xapian::SerialisationError::SerialisationError(const std::string &msg_, int errno_)
msg_: Message giving details of the error, intended for human consumption.errno_: Optional errno value associated with this error.__repr__ = _swig_repr(self)__setattr__ lambda self, name, value__swig_destroy__ = delete_SerialisationError(...)__swig_getmethods__ = {}__swig_setmethods__ = {}__str__ = Error___str__(...)get_context = Error_get_context(...) β Optional context information.get_error_string = Error_get_error_string(...) β Returns any system error string associated with this exception.get_msg = Error_get_msg(...) β Message giving details of the error.get_type = Error_get_type(...) β The type of this error.__weakref____new__(*args, **kwargs) from builtins.type__delattr__, __getattribute__, __reduce__, __setstate__, with_traceback__cause__, __context__, __dict__, __suppress_context__, __traceback__, argsπ Simple implementation of Stopper class - this will suit most users.
__init__(self, *args) β Initialise from a pair of iterators.Xapian::SimpleStopper::SimpleStopper(Iterator begin, Iterator end)
Xapian includes stop list files for many languages. You can initialise from a file like that:
__repr__ = _swig_repr(self)add = SimpleStopper_add(...) β Add a single stop word.void Xapian::SimpleStopper::add(const std::string &word)
__swig_destroy__ = delete_SimpleStopper(...)thisown β The membership flag__call__ = Stopper___call__(...)__disown__(self)__str__ = Stopper___str__(...) β Return a string describing this object.release = Stopper_release(...) β Start reference counting this object.__dict____weakref__πΏ Class representing a stemming algorithm.
__call__ = Stem___call__(...)__init__ = _stem_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.
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.__repr__ = _swig_repr(self)__str__ = Stem___str__(...) β Return a string describing this object.is_none = Stem_is_none(...) β Return true if this is a no-op stemmer.bool Xapian::Stem::is_none() const
__swig_destroy__ = delete_Stem(...) β Destructor.get_available_languages = Stem_get_available_languages(...)__dict____weakref__thisownπ§ Class representing a stemming algorithm implementation.
__call__ = StemImplementation___call__(...)__disown__(self)__init__(self) β Default constructor.__repr__ = _swig_repr(self)__str__ = StemImplementation___str__(...) β Return a string describing this object.__swig_destroy__ = delete_StemImplementation(...) β Virtual destructor.__dict____weakref__thisownπ Base class for stop-word decision functor.
__call__ = Stopper___call__(...)__disown__(self)__init__(self) β Default constructor.__repr__ = _swig_repr(self)__str__ = Stopper___str__(...) β Return a string describing this object.release = Stopper_release(...) β Start reference counting this object.__swig_destroy__ = delete_Stopper(...) β Virtual destructor.__dict____weakref__thisownπ€ Handle a string range. The end points can be any strings. Deprecated: Use Xapian::RangeProcessor instead (added in 1.3.6).
__init__(self, *args) β Constructor.Xapian::StringValueRangeProcessor::StringValueRangeProcessor(Xapian::valueno slot_, const std::string &str_, bool prefix_=true)
slot_: The value number to return from operator().str_: A string to look for to recognise values as belonging to this range.prefix_: Flag specifying whether to check for str_ as a prefix or a suffix.__repr__ = _swig_repr(self)__swig_destroy__ = delete_StringValueRangeProcessor(...)thisown__call__ = ValueRangeProcessor___call__(...)__disown__(self)release = ValueRangeProcessor_release(...) β Start reference counting this object.__dict____weakref__π 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.
__init__(self) β Default constructor.__repr__ = _swig_repr(self)__str__ = TermGenerator___str__(...) β Return a string describing this object.get_document = TermGenerator_get_document(...) β Get the current document.get_termpos = TermGenerator_get_termpos(...) β Get the current term position.increase_termpos = TermGenerator_increase_termpos(...) β Increase the term position used by index_text.void Xapian::TermGenerator::increase_termpos(Xapian::termpos delta=100)
This can be used between indexing text from different fields or other places to prevent phrase searches from spanning between them.
delta: Amount to increase the term position by (default: 100).index_text = TermGenerator_index_text(...) β Index some text in a std::string.void Xapian::TermGenerator::index_text(const std::string &text, Xapian::termcount wdf_inc=1, const std::string &prefix=std::string())
text: The text to index.wdf_inc: The wdf increment (default 1).prefix: The term prefix to use (default is no prefix).index_text_without_positions = TermGenerator_index_text_without_positions(...) β Index some text without positional information.set_database = TermGenerator_set_database(...) β Set the database to index spelling data to.set_document = TermGenerator_set_document(...) β Set the current document.set_flags = TermGenerator_set_flags(...) β Set flags.set_max_word_length = TermGenerator_set_max_word_length(...) β Set the maximum length word to index.set_stemmer = TermGenerator_set_stemmer(...) β Set the Xapian::Stem object.set_stemming_strategy = TermGenerator_set_stemming_strategy(...) β Set the stemming strategy.set_stopper = _termgenerator_set_stopper(self, stopper) β Set the Xapian::Stopper object.set_stopper_strategy = TermGenerator_set_stopper_strategy(...) β Set the stopper strategy.set_termpos = TermGenerator_set_termpos(...) β Set the current term position.__swig_destroy__ = delete_TermGenerator(...) β Destructor.__dict____weakref__thisownFLAG_CJK_NGRAM = 2048FLAG_SPELLING = 128STEM_ALL = 2STEM_ALL_Z = 3STEM_NONE = 0STEM_SOME = 1STEM_SOME_FULL_POS = 4STOP_ALL = 1STOP_NONE = 0STOP_STEMMED = 2π An iterator over a term list. The iterator will return TermListItem objects, which will be evaluated lazily where appropriate.
__init__(self, start, end, has_termfreq=0, has_wdf=0, has_positions=0, return_strings=False)__iter__(self)__next__(self)skip_to(self, term) β Skip the iterator forward.EAGER = 2INVALID = 0LAZY = 1π An item returned from iteration of a term list. Supports access to term, wdf, termfreq, and positer.
__init__(self, iter, term)positer β A position iterator for the current term (if meaningful).termfreq β The term frequency of the current term (if meaningful).wdf β The within-document-frequency of the current term (if meaningful).termβοΈ Xapian::Weight subclass implementing the tf-idf weighting scheme.
__init__(self, *args) β Construct a TfIdfWeight using the default normalizations ("ntn").__repr__ = _swig_repr(self)__swig_destroy__ = delete_TfIdfWeight(...)thisownget_maxextra β Return an upper bound on what get_sumextra() can return.get_maxpart β Return an upper bound on what get_sumpart() can return.get_sumextra β Calculate the term-independent weight component for a document.get_sumpart β Calculate the weight contribution for this object's term to a document.name β Return the name of this weighting scheme.__dict____weakref__ABSOLUTE_DISCOUNT_SMOOTHING = 3DIRICHLET_PLUS_SMOOTHING = 5DIRICHLET_SMOOTHING = 2JELINEK_MERCER_SMOOTHING = 4TWO_STAGE_SMOOTHING = 1βοΈ Xapian::Weight subclass implementing the traditional probabilistic formula. BM25 generally gives better results.
__init__(self, k=1.0) β Construct a TradWeight.__repr__ = _swig_repr(self)__swig_destroy__ = delete_TradWeight(...)thisownget_maxextraget_maxpartget_sumextraget_sumpartname__dict____weakref__ABSOLUTE_DISCOUNT_SMOOTHING = 3DIRICHLET_PLUS_SMOOTHING = 5DIRICHLET_SMOOTHING = 2JELINEK_MERCER_SMOOTHING = 4TWO_STAGE_SMOOTHING = 1β οΈ UnimplementedError indicates an attempt to use an unimplemented feature.
__getattr__ lambda self, name__init__(self, *args) β Construct from message and errno value.__repr__ = _swig_repr(self)__setattr__ lambda self, name, value__swig_destroy__ = delete_UnimplementedError(...)__swig_getmethods__ = {}__swig_setmethods__ = {}__str__get_contextget_error_stringget_msgget_type__weakref____new____delattr__, __getattribute__, __reduce__, __setstate__, with_traceback__cause__, __context__, __dict__, __suppress_context__, __traceback__, argsπ Class for counting the frequencies of values in the matching documents.
__init__(self, *args) β Construct a MatchSpy which counts the values in a particular slot.__repr__ = _swig_repr(self)get_total = ValueCountMatchSpy_get_total(...) β Return the total number of documents tallied.top_values(self, maxvalues) β Get an iterator over the most frequent values for the slot.values(self) β Get an iterator over all the values in the slot.__swig_destroy__ = delete_ValueCountMatchSpy(...)thisown__call____disown____str__ β Return a string describing this object.merge_results β Unserialise some results, and merge them into this matchspy.name β Return the name of this match spy.release β Start reference counting this object.__dict____weakref__π An item returned from iteration of the values in a document. Supports num and value attributes.
__init__(self, num, value)numvalueπ An iterator over all the values stored in a document. Returns ValueItem objects in ascending order of value number.
__init__(self, start, end)__iter__(self)__next__(self)__dict____weakref__πΊοΈ A posting source which looks up weights in a map using values as the key.
__init__(self, slot_) β Construct a ValueMapPostingSource.__repr__ = _swig_repr(self)add_mapping = ValueMapPostingSource_add_mapping(...) β Add a mapping.clear_mappings = ValueMapPostingSource_clear_mappings(...) β Clear all mappings.set_default_weight = ValueMapPostingSource_set_default_weight(...) β Set a default weight for document values not in the map.__swig_destroy__ = delete_ValueMapPostingSource(...)thisown__disown____next__ β Advance to next matching document.at_end β Return true if past last entry.check β Check if specified docid occurs.done β End the iteration.get_database β The database we're reading values from.get_docid β Return current docid.get_slot β The slot we're reading values from.get_started β Flag indicating if we've started.get_termfreq_est β Estimate of number of documents.get_termfreq_max β Upper bound.get_termfreq_min β Lower bound.get_value β Read current value.init β Set to start of list.set_termfreq_est β Set estimate.set_termfreq_max β Set upper bound.set_termfreq_min β Set lower bound.skip_to β Advance to specified docid.__str__ β Description.get_maxweight β Upper bound on weight.get_weight β Weight contribution.name β Class name.release β Start reference counting.set_maxweight β Specify upper bound.__dict____weakref__π A posting source which generates weights from a value slot. Base class for ValueWeightPostingSource and ValueMapPostingSource.
__disown__(self)__init__(self, slot_) β Construct a ValuePostingSource.__next__ = ValuePostingSource___next__(...) β Advance to next matching document.__repr__ = _swig_repr(self)at_endcheckdoneget_databaseget_docidget_slotget_startedget_termfreq_estget_termfreq_maxget_termfreq_minget_valueinitset_termfreq_estset_termfreq_maxset_termfreq_minskip_to__swig_destroy__ = delete_ValuePostingSource(...)thisown__str__get_maxweightget_weightnamereleaseset_maxweight__dict____weakref__π§ Base class for value range processors.
__call__ = ValueRangeProcessor___call__(...)__disown__(self)__init__(self) β Default constructor.__repr__ = _swig_repr(self)release = ValueRangeProcessor_release(...) β Start reference counting.__swig_destroy__ = delete_ValueRangeProcessor(...) β Destructor.__dict____weakref__thisownπ MatchDecider filtering results based on whether document values are in a user-defined set.
__init__(self, slot, inclusive_) β Construct a ValueSetMatchDecider.__repr__ = _swig_repr(self)add_value = ValueSetMatchDecider_add_value(...) β Add a value to the test set.remove_value = ValueSetMatchDecider_remove_value(...) β Remove a value from the test set.__swig_destroy__ = delete_ValueSetMatchDecider(...)thisown__call____disown____dict____weakref__π An item returned from iteration of the values in a document. Supports docid and value attributes.
__init__(self, docid, value)docidvalueπ An iterator over all the values stored in a document. Returns ValueStreamItem objects in ascending order of value number.
__init__(self, start, end)__iter__(self)__next__(self)skip_to(self, docid) β Skip the iterator forward.__dict____weakref__βοΈ A posting source which reads weights from a value slot. Uses sortable_unserialise to convert values to weights.
__disown__(self)__init__(self, slot_) β Construct a ValueWeightPostingSource.__repr__ = _swig_repr(self)__str__ = ValueWeightPostingSource___str__(...) β Description.get_weight = ValueWeightPostingSource_get_weight(...) β Return weight contribution.init = ValueWeightPostingSource_init(...) β Set to start of list.name = ValueWeightPostingSource_name(...) β Class name.__swig_destroy__ = delete_ValueWeightPostingSource(...)thisown__next__, at_end, check, done, get_database, get_docid, get_slot, get_started, get_termfreq_est, get_termfreq_max, get_termfreq_min, get_value, set_termfreq_est, set_termfreq_max, set_termfreq_min, skip_toget_maxweightreleaseset_maxweight__dict____weakref__βοΈ Abstract base class for weighting schemes.
__init__(self, *args, **kwargs)__repr__ = _swig_repr(self)get_maxextra β Return an upper bound on what get_sumextra() can return for any document.get_maxpart β Return an upper bound on what get_sumpart() can return for any document.get_sumextra β Calculate the term-independent weight component for a document.get_sumpart β Calculate the weight contribution for this object's term to a document.name β Return the name of this weighting scheme.__swig_destroy__ = delete_Weight(...) β Virtual destructor.__dict____weakref__thisownABSOLUTE_DISCOUNT_SMOOTHING = 3DIRICHLET_PLUS_SMOOTHING = 5DIRICHLET_SMOOTHING = 2JELINEK_MERCER_SMOOTHING = 4TWO_STAGE_SMOOTHING = 1β οΈ WildcardError indicates an error expanding a wildcarded query.
__getattr__ lambda self, name__init__(self, *args) β Construct from message and errno value.__repr__ = _swig_repr(self)__setattr__ lambda self, name, value__swig_destroy__ = delete_WildcardError(...)__swig_getmethods__ = {}__swig_setmethods__ = {}__str__get_contextget_error_stringget_msgget_type__weakref____new____delattr__, __getattribute__, __reduce__, __setstate__, with_traceback__cause__, __context__, __dict__, __suppress_context__, __traceback__, argsπΎ This class provides read/write access to a database.
__init__(self, *args) β Copying is allowed. The internals are reference counted, so copying is cheap.__repr__ = _swig_repr(self)add_document = WritableDatabase_add_document(...) β Add a new document to the database. Returns a newly allocated document ID.add_spelling = WritableDatabase_add_spelling(...) β Add a word to the spelling dictionary.add_synonym = WritableDatabase_add_synonym(...) β Add a synonym for a term.begin_transaction = WritableDatabase_begin_transaction(...) β Begin a transaction.cancel_transaction = WritableDatabase_cancel_transaction(...) β Abort the transaction currently in progress.clear_synonyms = WritableDatabase_clear_synonyms(...) β Remove all synonyms for a term.commit = WritableDatabase_commit(...) β Commit any pending modifications made to the database.__swig_destroy__ = delete_WritableDatabase(...) β Destructor.__dict____weakref__thisown__str__, close, delete_document, get_avlength, get_doccount, get_doclength, get_document, get_lastdocid, get_metadata, get_revision, get_spelling_suggestion, get_termfreq, get_uuid, get_value_freq, get_value_lower_bound, get_value_upper_bound, has_positions, keep_alive, metadata_keys_begin, metadata_keys_end, positionlist_begin, postlist_begin, reopen, set_metadata, spellings_begin, synonyms_begin, synonym_keys_begin, termlist_begin, valuestream_begin__dict__, __weakref__void Xapian::WritableDatabase::commit()
To ensure this, Xapian batches up modifications.
This method may be called at any time to commit any pending modifications to the database.
If any of the modifications fail, an exception will be thrown and the database will be left in a state in which each separate addition, replacement or deletion operation has either been fully performed or not performed at all: it is then up to the application to work out which operations need to be repeated.
It's not valid to call commit() within a transaction.
Beware of calling commit() too frequently: this will make indexing take much longer.
Note that commit() need not be called explicitly: it will be called automatically when the database is closed, or when a sufficient number of modifications have been made. By default, this is every 10000 documents added, deleted, or modified. This value is rather conservative, and if you have a machine with plenty of memory, you can improve indexing throughput dramatically by setting XAPIAN_FLUSH_THRESHOLD in the environment to a larger value.
This method was new in Xapian 1.1.0 - in earlier versions it was called flush().
Xapian::DatabaseError: will be thrown if a problem occurs while modifying the database.Xapian::DatabaseCorruptError: will be thrown if the database is in a corrupt state.commit_transaction = WritableDatabase_commit_transaction(...)
void Xapian::WritableDatabase::commit_transaction()
Complete the transaction currently in progress.
If this method completes successfully and this is a flushed transaction, all the database modifications made during the transaction will have been committed to the database.
If an error occurs, an exception will be thrown, and none of the modifications made to the database during the transaction will have been applied to the database.
In all cases the transaction will no longer be in progress.
Xapian::DatabaseError: will be thrown if a problem occurs while modifying the database.Xapian::DatabaseCorruptError: will be thrown if the database is in a corrupt state.Xapian::InvalidOperationError: will be thrown if a transaction is not currently in progress.Xapian::UnimplementedError: will be thrown if transactions are not available for this database type.delete_document = WritableDatabase_delete_document(...)
void Xapian::WritableDatabase::delete_document(const std::string &unique_term)
Delete any documents indexed by a term from the database.
This method removes any documents indexed by the specified term from the database.
A major use is for convenience when UIDs from another system are mapped to terms in Xapian, although this method has other uses (for example, you could add a "deletion date" term to documents at index time and use this method to delete all documents due for deletion on a particular date).
Xapian::DatabaseError: will be thrown if a problem occurs while writing to the database.Xapian::DatabaseCorruptError: will be thrown if the database is in a corrupt state.flush = WritableDatabase_flush(...)
void Xapian::WritableDatabase::flush()
Pre-1.1.0 name for commit().
Use commit() instead.
remove_spelling = WritableDatabase_remove_spelling(...)
void Xapian::WritableDatabase::remove_spelling(const std::string &word, Xapian::termcount freqdec=1) const
Remove a word from the spelling dictionary.
The word's frequency is decreased, and if would become zero or less then the word is removed completely.
remove_synonym = WritableDatabase_remove_synonym(...)
void Xapian::WritableDatabase::remove_synonym(const std::string &term, const std::string &synonym) const
Remove a synonym for a term.
replace_document = WritableDatabase_replace_document(...)
Xapian::docid Xapian::WritableDatabase::replace_document(const std::string &unique_term, const Xapian::Document &document)
Replace any documents matching a term.
This method replaces any documents indexed by the specified term with the specified document. If any documents are indexed by the term, the lowest document ID will be used for the document, otherwise a new document ID will be generated as for add_document.
One common use is to allow UIDs from another system to easily be mapped to terms in Xapian. Note that this method doesn't automatically add unique_term as a term, so you'll need to call document.add_term(unique_term) first when using replace_document() in this way.
Note that changes to the database won't be immediately committed to disk; see commit() for more details.
As with all database modification operations, the effect is atomic: the document(s) will either be fully replaced, or the document(s) fail to be replaced and an exception is thrown (possibly at a later time when commit() is called or the database is closed).
The document ID that document was given.
Xapian::DatabaseError: will be thrown if a problem occurs while writing to the database.Xapian::DatabaseCorruptError: will be thrown if the database is in a corrupt state.set_metadata = WritableDatabase_set_metadata(...)
void Xapian::WritableDatabase::set_metadata(const std::string &key, const std::string &metadata)
Set the user-specified metadata associated with a given key.
This method sets the metadata value associated with a given key. If there is already a metadata value stored in the database with the same key, the old value is replaced. If you want to delete an existing item of metadata, just set its value to the empty string.
User-specified metadata allows you to store arbitrary information in the form of (key, value) pairs.
There's no hard limit on the number of metadata items, or the size of the metadata values. Metadata keys have a limited length, which depend on the backend. We recommend limiting them to 200 bytes. Empty keys are not valid, and specifying one will cause an exception.
Metadata modifications are committed to disk in the same way as modifications to the documents in the database are: i.e., modifications are atomic, and won't be committed to disk immediately (see commit() for more details). This allows metadata to be used to link databases with versioned external resources by storing the appropriate version number in a metadata item.
You can also use the metadata to store arbitrary extra information associated with terms, documents, or postings by encoding the termname and/or document id into the metadata key.
Xapian::DatabaseError: will be thrown if a problem occurs while writing to the database.Xapian::DatabaseCorruptError: will be thrown if the database is in a corrupt state.Xapian::InvalidArgumentError: will be thrown if the key supplied is empty.Xapian::UnimplementedError: will be thrown if the database backend in use doesn't support user-specified metadata.__swig_destroy__ = delete_WritableDatabase(...)
virtual Xapian::WritableDatabase::~WritableDatabase()
Destroy this handle on the database.
If no other handles to this database remain, the database will be closed.
If a transaction is active cancel_transaction() will be implicitly called; if no transaction is active commit() will be implicitly called, but any exception will be swallowed (because throwing exceptions in C++ destructors is problematic). If you aren't using transactions and want to know about any failure to commit changes, call commit() explicitly before the destructor gets called.
thisown: The membership flag__iter__ = _database_gen_allterms_iter(self, prefix=None): Get an iterator over all the terms in the database. The iterator will return TermListItem objects, but these will not support access to wdf, or position information. Access to term frequency information is only available until the iterator has moved on. If prefix is supplied, only terms which start with that prefix will be returned.__str__ = Database___str__(...): Return a string describing this object. virtual std::string Xapian::Database::get_description() constadd_database = Database_add_database(...): Add an existing database (or group of databases) to those accessed by this object. void Xapian::Database::add_database(const Database &database). Parameters: database: the database(s) to add.allterms = _database_gen_allterms_iter(self, prefix=None): Same as __iter__.close = Database_close(...): Close the database. virtual void Xapian::Database::close(). This closes the database and closes all its file handles. For a WritableDatabase, if a transaction is active it will be aborted, while if no transaction is active commit() will be implicitly called. Also the write lock is released. Closing a database cannot be undone - in particular, calling reopen() after close() will not reopen it, but will instead throw a Xapian::DatabaseError exception. Calling close() again on a database which has already been closed has no effect (and doesn't raise an exception). After close() has been called, calls to other methods of the database, and to methods of other objects associated with the database, will either behave exactly as they would have done if the database had not been closed (this can only happen if all the required data is cached) or raise a Xapian::DatabaseError exception indicating that the database is closed. This method was added in Xapian 1.1.0.compact = Database_compact(...): Produce a compact version of this database. void Xapian::Database::compact(int fd, unsigned flags, int block_size, Xapian::Compactor &compactor). New 1.3.4. Various methods of the Compactor class were deprecated in 1.3.4. The compactor functor allows handling progress output and specifying how user metadata is merged. This variant writes a single-file database to the specified file descriptor. Only the glass backend supports such databases, so this form is only supported for this backend. Parameters: fd: File descriptor to write the compact version to. The descriptor needs to be readable and writable (open with O_RDWR) and seekable. The current file offset is used, allowing compacting to a single file database embedded within another file. Xapian takes ownership of the file descriptor and will close it before returning. flags: Any of the following combined using bitwise-or (| in C++): Xapian::DBCOMPACT_NO_RENUMBER, Xapian::DBCOMPACT_MULTIPASS, Xapian::DBCOMPACT_SINGLE_FILE. block_size: This specifies the block size (in bytes) for to use for the output. For glass, the block size must be a power of 2 between 2048 and 65536 (inclusive), and the default (also used if an invalid value is passed) is 8192 bytes. compactor: Functor.get_average_length = Database_get_average_length(...): New name for get_avlength(). double Xapian::Database::get_average_length() const. Added for forward compatibility with the next release series. 1.4.17.get_avlength = Database_get_avlength(...): Get the average length of the documents in the database. Xapian::doclength Xapian::Database::get_avlength() const.get_collection_freq = Database_get_collection_freq(...): Return the total number of occurrences of the given term. Xapian::termcount Xapian::Database::get_collection_freq(const std::string &tname) const. This is the sum of the number of occurrences of the term in each document it indexes: i.e., the sum of the within document frequencies of the term. Parameters: tname: The term whose collection frequency is being requested.get_doccount = Database_get_doccount(...): Get the number of documents in the database. Xapian::doccount Xapian::Database::get_doccount() const.get_doclength = Database_get_doclength(...): Get the length of a document. Xapian::termcount Xapian::Database::get_doclength(Xapian::docid did) const.get_doclength_lower_bound = Database_get_doclength_lower_bound(...): Get a lower bound on the length of a document in this DB. Xapian::termcount Xapian::Database::get_doclength_lower_bound() const. This bound does not include any zero-length documents.get_doclength_upper_bound = Database_get_doclength_upper_bound(...): Get an upper bound on the length of a document in this DB. Xapian::termcount Xapian::Database::get_doclength_upper_bound() const.get_document = Database_get_document(...): Get a document from the database, given its document id. Xapian::Document Xapian::Database::get_document(Xapian::docid did, unsigned flags) const. This method returns a Xapian::Document object which provides the information about a document. Parameters: did: The document id of the document to retrieve. flags: Zero or more flags bitwise-or-ed together (currently only Xapian::DOC_ASSUME_VALID is supported). Returns a Xapian::Document object containing the document data. Exceptions: Xapian::DocNotFoundError, Xapian::InvalidArgumentError.get_lastdocid = Database_get_lastdocid(...): Get the highest document id which has been used in the database. Xapian::docid Xapian::Database::get_lastdocid() const.get_metadata = Database_get_metadata(...): Get the user-specified metadata associated with a given key. std::string Xapian::Database::get_metadata(const std::string &key) const. User-specified metadata allows you to store arbitrary information in the form of (key, value) pairs. See WritableDatabase::set_metadata() for more information. When invoked on a Xapian::Database object representing multiple databases, currently only the metadata for the first is considered but this behaviour may change in the future. If there is no piece of metadata associated with the specified key, an empty string is returned (this applies even for backends which don't support metadata). Empty keys are not valid, and specifying one will cause an exception. Parameters: key: The key of the metadata item to access. Returns the retrieved metadata item's value. Exceptions: Xapian::InvalidArgumentError.get_revision = Database_get_revision(...): Get the revision of the database. Xapian::rev Xapian::Database::get_revision() const. The revision is an unsigned integer which increases with each commit. The database must have exactly one sub-database, which must be of type chert or glass. Otherwise an exception will be thrown. Experimental - see deprecation docs.get_spelling_suggestion = Database_get_spelling_suggestion(...): Suggest a spelling correction. std::string Xapian::Database::get_spelling_suggestion(const std::string &word, unsigned max_edit_distance=2) const. Parameters: word: The potentially misspelled word. max_edit_distance: Only consider words which are at most max_edit_distance edits from word. An edit is a character insertion, deletion, or the transposition of two adjacent characters (default is 2).get_termfreq = Database_get_termfreq(...): Get the number of documents in the database indexed by a given term. Xapian::doccount Xapian::Database::get_termfreq(const std::string &tname) const.get_total_length = Database_get_total_length(...): Get the total length of all the documents in the database. Xapian::totallength Xapian::Database::get_total_length() const. Added in Xapian 1.4.5.get_unique_terms = Database_get_unique_terms(...): Get the number of unique terms in document. Xapian::termcount Xapian::Database::get_unique_terms(Xapian::docid did) const.get_uuid = Database_get_uuid(...): Get a UUID for the database. std::string Xapian::Database::get_uuid() const. The UUID will persist for the lifetime of the database. Replicas (eg, made with the replication protocol, or by copying all the database files) will have the same UUID. However, copies (made with copydatabase, or xapian-compact) will have different UUIDs. If the backend does not support UUIDs or this database has no subdatabases, the UUID will be empty. If this database has multiple sub-databases, the UUID string will contain the UUIDs of all the sub-databases.get_value_freq = Database_get_value_freq(...): Return the frequency of a given value slot. Xapian::doccount Xapian::Database::get_value_freq(Xapian::valueno slot) const. This is the number of documents which have a (non-empty) value stored in the slot. Parameters: slot: The value slot to examine.get_value_lower_bound = Database_get_value_lower_bound(...): Get a lower bound on the values stored in the given value slot. std::string Xapian::Database::get_value_lower_bound(Xapian::valueno slot) const. If there are no values stored in the given value slot, this will return an empty string. Parameters: slot: The value slot to examine.get_value_upper_bound = Database_get_value_upper_bound(...): Get an upper bound on the values stored in the given value slot. std::string Xapian::Database::get_value_upper_bound(Xapian::valueno slot) const. If there are no values stored in the given value slot, this will return an empty string. Parameters: slot: The value slot to examine.get_wdf_upper_bound = Database_get_wdf_upper_bound(...): Get an upper bound on the wdf of term term. Xapian::termcount Xapian::Database::get_wdf_upper_bound(const std::string &term) const.has_positions = Database_has_positions(...): Does this database have any positional information? bool Xapian::Database::has_positions() const.keep_alive = Database_keep_alive(...): Send a "keep-alive" to remote databases to stop them timing out. void Xapian::Database::keep_alive(). Has no effect on non-remote databases.locked = Database_locked(...): Test if this database is currently locked for writing. bool Xapian::Database::locked() const. If the underlying object is actually a WritableDatabase, always returns true. Otherwise tests if there's a writer holding the lock (or if we can't test for a lock without taking it on the current platform, throw Xapian::UnimplementedError). If there's an error while trying to test the lock, throws Xapian::DatabaseLockError. For multi-databases, this tests each sub-database and returns true if any of them are locked.metadata_keys = _database_gen_metadata_keys_iter(self, prefix=''): Get an iterator which returns all the metadata keys. The iterator will return string objects. If `prefix` is non-empty, only metadata keys with this prefix are returned.positionlist = _database_gen_positionlist_iter(self, docid, tname): Get an iterator over all the positions in a given document of a term. The iterator will return integers, in ascending order.postlist = _database_gen_postlist_iter(self, tname): Get an iterator over the postings which are indexed by a given term. If `tname` is empty, an iterator over all the documents will be returned (this will contain one entry for each document, will always return a wdf of 1, and will not allow access to a position iterator).reopen = Database_reopen(...): Re-open the database. bool Xapian::Database::reopen(). This re-opens the database(s) to the latest available version(s). It can be used either to make sure the latest results are returned, or to recover from a Xapian::DatabaseModifiedError. Calling reopen() on a database which has been closed (with close()) will always raise a Xapian::DatabaseError. Returns true if the database might have been reopened (if false is returned, the database definitely hasn't been reopened, which applications may find useful when caching results, etc). In Xapian < 1.3.0, this method did not return a value.size = Database_size(...): Return number of shards in this Database object. size_t Xapian::Database::size() const.spellings = _database_gen_spellings_iter(self): Get an iterator which returns all the spelling correction targets. The iterator will return TermListItem objects. Only the term frequency is available; wdf and positions are not meaningful.synonym_keys = _database_gen_synonym_keys_iter(self, prefix=''): Get an iterator which returns all the terms which have synonyms. The iterator will return string objects. If `prefix` is non-empty, only terms with this prefix are returned.synonyms = _database_gen_synonyms_iter(self, term): Get an iterator which returns all the synonyms for a given term. The term to return synonyms for is specified by the `term` parameter. The iterator will return string objects.term_exists = Database_term_exists(...): Check if a given term exists in the database. bool Xapian::Database::term_exists(const std::string &tname) const. Parameters: tname: The term to test the existence of. Returns true if and only if the term exists in the database. This is the same as (get_termfreq(tname) != 0), but will often be more efficient.termlist = _database_gen_termlist_iter(self, docid): Get an iterator over all the terms which index a given document ID. The iterator will return TermListItem objects. Access to term frequency and position information is only available until the iterator has moved on.valuestream(self, slot): Get an iterator over all the values stored in a slot in the database. The iterator will return ValueStreamItem objects, in ascending order of document id.check = Database_check(...)__dict__: dictionary for instance variables (if defined)__weakref__: list of weak references to the object (if defined)Database_check(...)__add__(...)__eq__(...) β Return self==value.__ge__(...) β Return self >= value.__gt__(...) β Return self > value.__le__(...) β Return self
| π Constant | π’ Value |
|---|---|
π BAD_VALUENO |
4294967295 |
π DBCHECK_FIX |
16 |
π DBCHECK_FULL_TREE |
2 |
π DBCHECK_SHORT_TREE |
1 |
π DBCHECK_SHOW_FREELIST |
4 |
π DBCHECK_SHOW_STATS |
8 |
ποΈ DBCOMPACT_MULTIPASS |
8 |
ποΈ DBCOMPACT_NO_RENUMBER |
4 |
ποΈ DBCOMPACT_SINGLE_FILE |
16 |
ποΈ DB_BACKEND_CHERT |
512 |
ποΈ DB_BACKEND_GLASS |
256 |
ποΈ DB_BACKEND_INMEMORY |
1024 |
ποΈ DB_BACKEND_STUB |
768 |
π DB_CREATE |
2 |
π DB_CREATE_OR_OPEN |
0 |
π DB_CREATE_OR_OVERWRITE |
1 |
π DB_DANGEROUS |
16 |
π DB_FULL_SYNC |
8 |
π DB_NO_SYNC |
4 |
π DB_NO_TERMLIST |
32 |
π DB_OPEN |
3 |
π DB_RETRY_LOCK |
64 |
β
DOC_ASSUME_VALID |
1 |
π
RP_DATE_PREFER_MDY |
4 |
π
RP_REPEATED |
2 |
π
RP_SUFFIX |
1 |
π __all__ |
('AssertionError', 'BAD_VALUENO', 'BB2Weight', 'BM25PlusWeig... |
π __docformat__ |
'restructuredtext en' |
1.4.18
/usr/lib/python3/dist-packages/xapian/__init__.py
Generated by phpman v4.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-01 16:58 @216.73.216.239
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)