| Top |
DzlFuzzyMutableIndex MatchingDzlFuzzyMutableIndex Matching — DzlFuzzyMutableIndex matching for GLib based programs. |
| DzlFuzzyMutableIndex * | dzl_fuzzy_mutable_index_new () |
| DzlFuzzyMutableIndex * | dzl_fuzzy_mutable_index_new_with_free_func () |
| void | dzl_fuzzy_mutable_index_set_free_func () |
| void | dzl_fuzzy_mutable_index_begin_bulk_insert () |
| void | dzl_fuzzy_mutable_index_end_bulk_insert () |
| gboolean | dzl_fuzzy_mutable_index_contains () |
| void | dzl_fuzzy_mutable_index_insert () |
| GArray * | dzl_fuzzy_mutable_index_match () |
| void | dzl_fuzzy_mutable_index_remove () |
| DzlFuzzyMutableIndex * | dzl_fuzzy_mutable_index_ref () |
| void | dzl_fuzzy_mutable_index_unref () |
| gchar * | dzl_fuzzy_highlight () |
DzlFuzzyMutableIndex provides a fulltext index that focuses around fuzzy matching words. This version of the datastructure is focused around in-memory storage. This makes mutability performance of adding or removing items from the corpus simpler.
If you need mostly read-only indexes, you might consider using
DzlFuzzyIndex and DzlFuzzyIndexBuilder which can create a disk-based file
and mmap() a read-only version of the data set.
It is a programming error to modify Fuzzy while holding onto an array of FuzzyMatch elements. The position of strings within the DzlFuzzyMutableIndexMatch may no longer be valid.
DzlFuzzyMutableIndex *
dzl_fuzzy_mutable_index_new (gboolean case_sensitive);
Create a new Fuzzy for fuzzy matching strings.
DzlFuzzyMutableIndex * dzl_fuzzy_mutable_index_new_with_free_func (gboolean case_sensitive,GDestroyNotify free_func);
void dzl_fuzzy_mutable_index_set_free_func (DzlFuzzyMutableIndex *fuzzy,GDestroyNotify free_func);
void
dzl_fuzzy_mutable_index_begin_bulk_insert
(DzlFuzzyMutableIndex *fuzzy);
Start a bulk insertion. fuzzy
is not ready for searching until
dzl_fuzzy_mutable_index_end_bulk_insert() has been called.
This allows for inserting large numbers of strings and deferring
the final sort until dzl_fuzzy_mutable_index_end_bulk_insert().
void
dzl_fuzzy_mutable_index_end_bulk_insert
(DzlFuzzyMutableIndex *fuzzy);
Complete a bulk insert and resort the index.
gboolean dzl_fuzzy_mutable_index_contains (DzlFuzzyMutableIndex *fuzzy,const gchar *key);
void dzl_fuzzy_mutable_index_insert (DzlFuzzyMutableIndex *fuzzy,const gchar *key,gpointer value);
Inserts a string into the fuzzy matcher.
GArray * dzl_fuzzy_mutable_index_match (DzlFuzzyMutableIndex *fuzzy,const gchar *needle,gsize max_matches);
DzlFuzzyMutableIndex searches within fuzzy
for strings that fuzzy match needle
.
Only up to max_matches
will be returned.
TODO: max_matches is not yet respected.
void dzl_fuzzy_mutable_index_remove (DzlFuzzyMutableIndex *fuzzy,const gchar *key);
DzlFuzzyMutableIndex *
dzl_fuzzy_mutable_index_ref (DzlFuzzyMutableIndex *fuzzy);
void
dzl_fuzzy_mutable_index_unref (DzlFuzzyMutableIndex *fuzzy);
Decrements the reference count of fuzzy by one. When the reference count reaches zero, the structure will be freed.