nostrdb

an unfairly fast embedded nostr database backed by lmdb
git clone git://jb55.com/nostrdb
Log | Files | Refs | Submodules | README | LICENSE

commit 39806dc1f8d7d78ceb44213a19ccb6d01604a91a
parent 380c013efcb2a3f9a6f236e01889f80fd41573da
Author: William Casarin <jb55@jb55.com>
Date:   Mon, 13 Jan 2025 18:08:47 -0800

filter: add ndb_filter_find_search helper

This can be used to quicky pull the search string
from a filter

Diffstat:
Msrc/nostrdb.c | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/nostrdb.c b/src/nostrdb.c @@ -2906,6 +2906,16 @@ ndb_filter_find_elements(struct ndb_filter *filter, enum ndb_filter_fieldtype ty return NULL; } +static const char *ndb_filter_find_search(struct ndb_filter *filter) +{ + struct ndb_filter_elements *els; + + if (!(els = ndb_filter_find_elements(filter, NDB_FILTER_SEARCH))) + return NULL; + + return ndb_filter_get_string_element(filter, els, 0); +} + int ndb_filter_is_subset_of(const struct ndb_filter *a, const struct ndb_filter *b) { int i;