nostrdb

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

commit 8644b88408a203770693066a27cb1acc251dd5d6
parent 35a6d1e9461ae6f8e33bdb2010450698ab0e2322
Author: William Casarin <jb55@jb55.com>
Date:   Sat,  2 Dec 2023 15:02:46 -0800

search: fix another newest-first bug

Diffstat:
Mnostrdb.c | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/nostrdb.c b/nostrdb.c @@ -2578,12 +2578,17 @@ retry: } if (!ndb_prefix_matches(result, search_word)) { + /* + printf("result prefix '%.*s' didn't match search word '%.*s'\n", + result->key.str_len, result->key.str, + search_word->word_len, search_word->word); + */ // we should only do this if we're going in reverse if (retries == 0 && op == MDB_SET_RANGE && order_op == MDB_PREV) { // if set range worked and our key exists, it should be // the one right before this one - if (mdb_cursor_get(cursor, k, &v, MDB_PREV)) - goto retry; + mdb_cursor_get(cursor, k, &v, MDB_PREV); + goto retry; } else { return 0; }