Dee.Index¶
- Subclasses:
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
Analyzing terms extracted by the reader |
||
r/w/co |
The model being indexed |
||
w/co |
The reader extracting terms for each row |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
||
priv |
r |
Class Details¶
- class Dee.Index(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
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 orNone
to iterate over all termsfunc (
Dee.IndexIterFunc
) – Called for each term in the indexuserdata (
object
orNone
) – 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:
Get the analyzer being used to analyze terms extracted with the
Dee.ModelReader
used by this index.
- get_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:
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:
Get the number of rows that matches a given term
- get_n_terms()¶
- Returns:
The number of unique terms in the index
- Return type:
Get the number of terms in the index
- get_reader()¶
- Returns:
The
Dee.ModelReader
used to extract terms with- Return type:
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:
Get the
Dee.TermMatchFlag
supported by thisDee.Index
instance
- lookup(term, flags)¶
- Parameters:
term (
str
) – The term to look up onflags (
Dee.TermMatchFlag
) – A bitmask ofDee.TermMatchFlag
to control how matching is done
- Returns:
A
Dee.ResultSet
. Free withGObject.Object.unref
().- Return type:
- lookup_one(term)¶
- Parameters:
term (
str
) – The exact term to match- Returns:
A
Dee.ModelIter
pointing to the matching row orNone
in case no rows matches term- Return type:
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 andNone
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 orNone
to iterate over all termsfunc (
Dee.IndexIterFunc
) – Called for each term in the indexuserdata (
object
orNone
) – 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:
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:
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:
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:
Get the
Dee.TermMatchFlag
supported by thisDee.Index
instance
- do_lookup(term, flags) virtual¶
- Parameters:
term (
str
) – The term to look up onflags (
Dee.TermMatchFlag
) – A bitmask ofDee.TermMatchFlag
to control how matching is done
- Returns:
A
Dee.ResultSet
. Free withGObject.Object.unref
().- Return type:
Property Details¶
- Dee.Index.props.analyzer¶
- Name:
analyzer
- Type:
- Default Value:
- Flags:
The
Dee.Analyzer
used to analyze terms extracted by the model reader
- Dee.Index.props.reader¶
- Name:
reader
- Type:
- Default Value:
- Flags:
The
Dee.ModelReader
used to extract terms from rows in the model