libwebsockets
Lightweight C library for HTML5 websockets
|
Data Structures | |
struct | lws_fts_result_filepath |
struct | lws_fts_result_autocomplete |
struct | lws_fts_result |
struct | lws_fts_search_params |
Macros | |
#define | LWSFTS_F_QUERY_AUTOCOMPLETE (1 << 0) |
#define | LWSFTS_F_QUERY_FILES (1 << 1) |
#define | LWSFTS_F_QUERY_FILE_LINES (1 << 2) |
#define | LWSFTS_F_QUERY_QUOTE_LINE (1 << 3) |
Functions | |
LWS_VISIBLE LWS_EXTERN struct lws_fts * | lws_fts_create (int fd) |
LWS_VISIBLE LWS_EXTERN void | lws_fts_destroy (struct lws_fts **trie) |
LWS_VISIBLE LWS_EXTERN int | lws_fts_file_index (struct lws_fts *t, const char *filepath, int filepath_len, int priority) |
LWS_VISIBLE LWS_EXTERN int | lws_fts_fill (struct lws_fts *t, uint32_t file_index, const char *buf, size_t len) |
LWS_VISIBLE LWS_EXTERN int | lws_fts_serialize (struct lws_fts *t) |
LWS_VISIBLE LWS_EXTERN struct lws_fts_file * | lws_fts_open (const char *filepath) |
LWS_VISIBLE LWS_EXTERN struct lws_fts_result * | lws_fts_search (struct lws_fts_file *jtf, struct lws_fts_search_params *ftsp) |
LWS_VISIBLE LWS_EXTERN void | lws_fts_close (struct lws_fts_file *jtf) |
Lws provides superfast indexing and fulltext searching from index files on storage.
struct lws_fts_result_filepath |
Data Fields | ||
---|---|---|
struct lws_fts_result_filepath * | next | |
int | matches | |
int | matches_length | |
int | lines_in_file | |
int | filepath_length |
struct lws_fts_result_autocomplete |
Data Fields | ||
---|---|---|
struct lws_fts_result_autocomplete * | next | |
int | instances | |
int | agg_instances | |
int | ac_length | |
char | elided | |
char | has_children |
struct lws_fts_result |
Data Fields | ||
---|---|---|
struct lws_fts_result_filepath * | filepath_head | |
struct lws_fts_result_autocomplete * | autocomplete_head | |
int | duration_ms | |
int | effective_flags |
struct lws_fts_search_params |
#define LWSFTS_F_QUERY_AUTOCOMPLETE (1 << 0) |
#include <include/libwebsockets/lws-fts.h>
#define LWSFTS_F_QUERY_FILES (1 << 1) |
#include <include/libwebsockets/lws-fts.h>
#define LWSFTS_F_QUERY_FILE_LINES (1 << 2) |
#include <include/libwebsockets/lws-fts.h>
#define LWSFTS_F_QUERY_QUOTE_LINE (1 << 3) |
#include <include/libwebsockets/lws-fts.h>
LWS_VISIBLE LWS_EXTERN struct lws_fts* lws_fts_create | ( | int | fd | ) |
#include <include/libwebsockets/lws-fts.h>
lws_fts_create() - Create a new index file
fd | The fd opened for write |
Inits a new index file, returning a struct lws_fts to represent it
LWS_VISIBLE LWS_EXTERN void lws_fts_destroy | ( | struct lws_fts ** | trie | ) |
#include <include/libwebsockets/lws-fts.h>
lws_fts_destroy() - Finalize a new index file / destroy the trie lwsac
trie | The previously opened index being finalized |
Finalizes an index file that was being created, and frees the memory involved *trie is set to NULL afterwards.
LWS_VISIBLE LWS_EXTERN int lws_fts_file_index | ( | struct lws_fts * | t, |
const char * | filepath, | ||
int | filepath_len, | ||
int | priority | ||
) |
#include <include/libwebsockets/lws-fts.h>
lws_fts_file_index() - Create a new entry in the trie file for an input path
t | The previously opened index being written |
filepath | The filepath (which may be virtual) associated with this file |
filepath_len | The number of chars in the filepath |
priority | not used yet |
Returns an ordinal that represents this new filepath in the index file.
LWS_VISIBLE LWS_EXTERN int lws_fts_fill | ( | struct lws_fts * | t, |
uint32_t | file_index, | ||
const char * | buf, | ||
size_t | len | ||
) |
#include <include/libwebsockets/lws-fts.h>
lws_fts_fill() - Process all or a bufferload of input file
t | The previously opened index being written |
file_index | The ordinal representing this input filepath |
buf | A bufferload of data from the input file |
len | The number of bytes in buf |
Indexes a buffer of data from the input file.
LWS_VISIBLE LWS_EXTERN int lws_fts_serialize | ( | struct lws_fts * | t | ) |
#include <include/libwebsockets/lws-fts.h>
lws_fts_serialize() - Store the in-memory trie into the index file
t | The previously opened index being written |
The trie is held in memory where it can be added to... after all the input filepaths and data have been processed, this is called to serialize / write the trie data into the index file.
LWS_VISIBLE LWS_EXTERN struct lws_fts_file* lws_fts_open | ( | const char * | filepath | ) |
#include <include/libwebsockets/lws-fts.h>
lws_fts_open() - Open an existing index file to search it
filepath | The filepath to the index file to open |
Opening the index file returns an opaque struct lws_fts_file * that is used to perform other operations on it, or NULL if it can't be opened.
LWS_VISIBLE LWS_EXTERN struct lws_fts_result* lws_fts_search | ( | struct lws_fts_file * | jtf, |
struct lws_fts_search_params * | ftsp | ||
) |
#include <include/libwebsockets/lws-fts.h>
lws_fts_search() - Perform a search operation on an index
jtf | The index file struct returned by lws_fts_open |
ftsp | The struct lws_fts_search_params filled in by the caller |
The caller should memset the ftsp struct to 0 to ensure members that may be introduced in later versions contain known values, then set the related members to describe the kind of search action required.
ftsp->results_head is the results lwsac, or NULL. It should be freed with lwsac_free() when the results are finished with.
Returns a pointer into the results lwsac that is a struct lws_fts_result containing the head pointers into linked-lists of results for autocomplete and filepath data, along with some sundry information. This does not need to be freed since freeing the lwsac will also remove this and everything it points to.
LWS_VISIBLE LWS_EXTERN void lws_fts_close | ( | struct lws_fts_file * | jtf | ) |
#include <include/libwebsockets/lws-fts.h>
lws_fts_close() - Close a previously-opened index file
jtf | The pointer returned from the open |
Closes the file handle on the index and frees any allocations