1LIBDOODLE(3) Library Functions Manual LIBDOODLE(3)
2
3
4
6 libdoodle - multi-suffix tree based file search library 0.5.5
7
8
10 #include <doodle.h>
11
12
13 typedef void (*DOODLE_Logger)(void * context, unsigned int level,
14 const char * message, ...);
15
16 typedef struct {
17 char * filename;
18 unsigned int mod_time;
19 } DOODLE_FileInfo;
20
21 typedef void (*DOODLE_TreeCallback)(const DOODLE_FileInfo * fileinfo,
22 void * arg);
23
24 unsigned int DOODLE_getFileCount(const struct DOODLE_SuffixTree *
25 tree);
26
27 const DOODLE_File * DOODLE_getFileAt(const struct DOODLE_SuffixTree *
28 tree, unsigned int index);
29
30 struct DOODLE_SuffixTree * DOODLE_tree_create(DOODLE_Logger log, void
31 * context, const char * database);
32
33 void DOODLE_tree_set_memory_limit(struct DOODLE_SuffixTree *tree,
34 size_t limit);
35
36 void DOODLE_tree_destroy(struct DOODLE_SuffixTree * tree);
37
38 int DOODLE_tree_expand(struct DOODLE_SuffixTree * tree, const unsigned
39 char * searchString, const char * fileName);
40
41 int DOODLE_tree_truncate(struct DOODLE_SuffixTree * tree, const char *
42 fileName);
43
44 int DOODLE_tree_dump(FILE * stream, struct DOODLE_SuffixTree * tree);
45
46 int DOODLE_tree_search_approx(struct DOODLE_SuffixTree * tree, const
47 unsigned int approx, const int ignore_case, const unsigned char * ss,
48 DOODLE_ResultCallback * callback, void * arg);
49
50 int DOODLE_tree_search(struct DOODLE_SuffixTree * tree, const unsigned
51 char * substring, DOODLE_ResultCallback * callback, void * arg);
52
53
55 libdoodle is a library that provides a multi-suffix tree to lookup
56 files. The basic use is to create a suffix tree, add some keywords
57 (associated with a file), search the tree and finally free the tree.
58 libdoodle features code to quickly serialize the tree into a compact
59 format.
60
61 In order to use libdoodle, client code first creates a tree (passing a
62 callback function that will log all error messages associated with this
63 tree and the name of the database) using DOODLE_tree_create. The tree
64 can then be searched using DOODLE_tree_search or DOO‐
65 DLE_tree_search_approx (which requires additional processing with DOO‐
66 DLE_tree_iterate to walk over the individual results). The tree can be
67 expanded with new search strings (DOODLE_tree_expand) and existing
68 matches can be removed with DOODLE_tree_truncate. It is only possible
69 to remove all keywords for a given file. With DOODLE_getFileAt and
70 DOODLE_getFileCount it is possible to inspect the files that are cur‐
71 rently in the tree (and to check if their respective modification time‐
72 stamps, useful for keeping track of when an entry maybe outdated).
73 Finally the tree must be released using DOODLE_tree_destroy. This
74 writes the changes to the disk and frees all associated resources.
75
76 Example code for using the complete libdoodle API can be found in doo‐
77 dle.c. If jni.h was found when libdoodle was compiled, libdoodle will
78 contain methods that allow Java code to directly use libdoodle. See
79 org.gnunet.doodle.Doodle for Java code providing an interface to lib‐
80 doodle and for a sample main method that demonstrates searching the
81 doodle database from Java.
82
83
84
86 doodle(1), extract(1), libextractor(3)
87
88
90 libdoodle and doodle are released under the GPL.
91
92
94 There is at least one known bug, but nobody was able to reproduce it
95 yet. But in general things work fine. :-)
96
97
99 Report bugs to mantis <http://gnunet.org/mantis/> or by sending elec‐
100 tronic mail to <christian@grothoff.org>
101
102
104 doodle was originally written by Christian Grothoff <chris‐
105 tian@grothoff.org>.
106
107
109 You can obtain the original author's latest version from
110 http://gnunet.org/doodle/.
111
112
113
114libdoodle May 2 2006 LIBDOODLE(3)