nostrdb: ndb: dump json in filters and fulltext queries
This is much more useful Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
Daniel D’Aquino
parent
92e1e4b08f
commit
319579f912
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
static void ndb_print_text_search_key(struct ndb_text_search_key *key)
|
static void ndb_print_text_search_key(struct ndb_text_search_key *key)
|
||||||
{
|
{
|
||||||
printf("K<'%.*s' %" PRIu64 " %" PRIu64 " note_id:%" PRIu64 ">", key->str_len, key->str,
|
fprintf(stderr,"K<'%.*s' %" PRIu64 " %" PRIu64 " note_id:%" PRIu64 ">", key->str_len, key->str,
|
||||||
key->word_index,
|
key->word_index,
|
||||||
key->timestamp,
|
key->timestamp,
|
||||||
key->note_id);
|
key->note_id);
|
||||||
@@ -14,23 +14,11 @@ static void print_hex(unsigned char* data, size_t size) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void print_hex_stream(FILE *stream, unsigned char* data, size_t size) {
|
||||||
static void ndb_print_text_search_result(struct ndb_txn *txn,
|
size_t i;
|
||||||
struct ndb_text_search_result *r)
|
for (i = 0; i < size; i++) {
|
||||||
{
|
fprintf(stream, "%02x", data[i]);
|
||||||
size_t len;
|
|
||||||
struct ndb_note *note;
|
|
||||||
|
|
||||||
ndb_print_text_search_key(&r->key);
|
|
||||||
|
|
||||||
if (!(note = ndb_get_note_by_key(txn, r->key.note_id, &len))) {
|
|
||||||
printf(": note not found");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printf(" ");
|
|
||||||
print_hex(ndb_note_id(note), 32);
|
|
||||||
|
|
||||||
printf("\n%s\n\n---\n", ndb_note_content(note));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user