Dee.Index

g Dee.Index Dee.Index GObject.Object GObject.Object GObject.Object->Dee.Index

Subclasses:

Dee.HashIndex, Dee.TreeIndex

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

foreach (start_term, func, *userdata)

get_analyzer ()

get_model ()

get_n_rows ()

get_n_rows_for_term (term)

get_n_terms ()

get_reader ()

get_supported_term_match_flags ()

lookup (term, flags)

lookup_one (term)

Virtual Methods

Inherited:

GObject.Object (7)

do_foreach (start_term, func, userdata)

do_get_n_rows ()

do_get_n_rows_for_term (term)

do_get_n_terms ()

do_get_supported_term_match_flags ()

do_lookup (term, flags)

Properties

Name

Type

Flags

Short Description

analyzer

Dee.Analyzer

r/w/co

Analyzing terms extracted by the reader

model

Dee.Model

r/w/co

The model being indexed

reader

int

w/co

The reader extracting terms for each row

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

priv

Dee.IndexPrivate

r

Class Details

class Dee.Index(**kwargs)
Bases:

GObject.Object

Abstract:

Yes

Structure:

Dee.IndexClass

All fields in the Dee.Index structure are private and should never be accessed directly

foreach(start_term, func, *userdata)
Parameters:
  • start_term (str) – The term to start from or None to iterate over all terms

  • func (Dee.IndexIterFunc) – Called for each term in the index

  • userdata (object or None) – Arbitrary data to pass back to func

Iterate over an index optionally starting from some given term. Note that unordered indexes (like Dee.HashIndex) has undefined behaviour with this method.

get_analyzer()
Returns:

The Dee.Analyzer used to analyze terms with

Return type:

Dee.Analyzer

Get the analyzer being used to analyze terms extracted with the Dee.ModelReader used by this index.

get_model()
Returns:

The Dee.Model being indexed by this index

Return type:

Dee.Model

Get the model being indexed by this index

get_n_rows()
Returns:

The number of rows in the index. Note that this may less than or equal to Dee.Model.get_n_rows().

Return type:

int

Get the number of indexed rows. A row is only indexed if it has at least one term associated with it. If the analyzer has returned 0 terms then the row is omitted from the index.

get_n_rows_for_term(term)
Parameters:

term (str) – The term to look for

Returns:

The number of rows in the index registered for the given term

Return type:

int

Get the number of rows that matches a given term

get_n_terms()
Returns:

The number of unique terms in the index

Return type:

int

Get the number of terms in the index

get_reader()
Returns:

The Dee.ModelReader used to extract terms with

Return type:

Dee.ModelReader

Get the reader being used to extract terms from rows in the model

get_supported_term_match_flags()
Returns:

A bit mask of the acceptedd Dee.TermMatchFlag s

Return type:

int

Get the Dee.TermMatchFlag supported by this Dee.Index instance

lookup(term, flags)
Parameters:
Returns:

A Dee.ResultSet. Free with GObject.Object.unref().

Return type:

Dee.ResultSet

lookup_one(term)
Parameters:

term (str) – The exact term to match

Returns:

A Dee.ModelIter pointing to the matching row or None in case no rows matches term

Return type:

Dee.ModelIter

Convenience function in for cases where you have a priori guarantee that a Dee.Index.lookup() call will return exactly 0 or 1 row. If the lookup returns more than 1 row a warning will be printed on standard error and None will be returned.

The typical use case for this function is if you need something akin to a primary key in a relational database.

do_foreach(start_term, func, userdata) virtual
Parameters:
  • start_term (str) – The term to start from or None to iterate over all terms

  • func (Dee.IndexIterFunc) – Called for each term in the index

  • userdata (object or None) – Arbitrary data to pass back to func

Iterate over an index optionally starting from some given term. Note that unordered indexes (like Dee.HashIndex) has undefined behaviour with this method.

do_get_n_rows() virtual
Returns:

The number of rows in the index. Note that this may less than or equal to Dee.Model.get_n_rows().

Return type:

int

Get the number of indexed rows. A row is only indexed if it has at least one term associated with it. If the analyzer has returned 0 terms then the row is omitted from the index.

do_get_n_rows_for_term(term) virtual
Parameters:

term (str) – The term to look for

Returns:

The number of rows in the index registered for the given term

Return type:

int

Get the number of rows that matches a given term

do_get_n_terms() virtual
Returns:

The number of unique terms in the index

Return type:

int

Get the number of terms in the index

do_get_supported_term_match_flags() virtual
Returns:

A bit mask of the acceptedd Dee.TermMatchFlag s

Return type:

int

Get the Dee.TermMatchFlag supported by this Dee.Index instance

do_lookup(term, flags) virtual
Parameters:
Returns:

A Dee.ResultSet. Free with GObject.Object.unref().

Return type:

Dee.ResultSet

Property Details

Dee.Index.props.analyzer
Name:

analyzer

Type:

Dee.Analyzer

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The Dee.Analyzer used to analyze terms extracted by the model reader

Dee.Index.props.model
Name:

model

Type:

Dee.Model

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The Dee.Model being indexed

Dee.Index.props.reader
Name:

reader

Type:

int

Default Value:

None

Flags:

WRITABLE, CONSTRUCT_ONLY

The Dee.ModelReader used to extract terms from rows in the model