Skip to content

Update to latest nostrdb #2121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 205 commits into
base: master
Choose a base branch
from
Open

Update to latest nostrdb #2121

wants to merge 205 commits into from

Conversation

jb55
Copy link
Collaborator

@jb55 jb55 commented Apr 4, 2024

This branch updates nostrdb to the latest version

Things done and left to do:

  • Update nostrdb
  • Switch to nostrdb for note block rendering
    - [ ] Switch to local relay for querying and subscriptions saving this for later

What's new in this version:

  • full query support (swift interface for this is WIP)
  • nip50 search support: full text queries on filters (profile search, etc)

@jb55 jb55 linked an issue Apr 4, 2024 that may be closed by this pull request
@jb55 jb55 force-pushed the nostrdb-update branch from a3d9cb3 to 3a6dcdc Compare April 4, 2024 22:34
@jb55
Copy link
Collaborator Author

jb55 commented Apr 5, 2024

This broke a bunch of tests which I'm fixing now

@jb55
Copy link
Collaborator Author

jb55 commented Apr 5, 2024

One thing I did here is add nostrdb's patch history to our local copy of nostrdb. This ensure we don't lose bisectability when updating nostrdb. I've also removed a lot of overlap between damus' C code and nostrdb, so most of the C code should be in nostrdb now.

@jb55 jb55 linked an issue Apr 8, 2024 that may be closed by this pull request
@jb55 jb55 force-pushed the nostrdb-update branch 3 times, most recently from 10bc4f4 to c476272 Compare April 25, 2024 22:50
This was linked to issues May 6, 2024
@jb55 jb55 force-pushed the nostrdb-update branch 3 times, most recently from 1f3d846 to f8931a6 Compare September 1, 2024 12:00
@danieldaquino danieldaquino mentioned this pull request Sep 26, 2024
12 tasks
@jb55 jb55 mentioned this pull request Oct 14, 2024
jb55 and others added 12 commits February 13, 2025 13:08
When trying to build from rust

Signed-off-by: William Casarin <[email protected]>
Closes: damus-io/nostrdb#21
Signed-off-by: William Casarin <[email protected]>
Right now it's accidently hardcoded.

Fixes: 8376e5bca05c ("add "import -"")
Signed-off-by: William Casarin <[email protected]>
everything will be in here soon
rust doesn't like packed structures, so hide this from bindgen

This also buttons up the API so less things are exposed which is good.

Signed-off-by: William Casarin <[email protected]>
This is the start of our rust library for nostrdb. Implement idiomatic
interfaces for Ndb and NdbConfig.

Changelog-Added: Add initial rust library
Signed-off-by: William Casarin <[email protected]>
otherwise build fails

Signed-off-by: William Casarin <[email protected]>
since it was overwritten when we synced with damus

Signed-off-by: William Casarin <[email protected]>
we will be applying a patch here as well
A lot of this was pulled from core-lightning. Not sure what is actually
needed or not.

Signed-off-by: William Casarin <[email protected]>
jb55 and others added 18 commits February 13, 2025 14:43
This fixes an allocation issue with ndb_filter_init_with for small
page sizes. instead of allocating the buffer around pages, we allocate
based on total buffer size.

Fixes: f7aac3215575 ("filter: introduce ndb_filter_init_with")
Signed-off-by: William Casarin <[email protected]>
We will be using this for our nip50 search support

Signed-off-by: William Casarin <[email protected]>
This can be used to quicky pull the search string
from a filter

Signed-off-by: William Casarin <[email protected]>
No functional changes, just formatting cleanups

Signed-off-by: William Casarin <[email protected]>
Add a helper for sorting search words from largest to smallest. This
should help search performance. For example, let's say our search index
is like so:

"the pokemon is cool"

the
the
the
...
* 1000

Our root word search would have to start 1000 new recursive queries. By
sorting by the largest word:

pokemon
pokemon
pokemon
...
* 10

We only have to do 10 recursive searches, assuming larger words are less
common, which will likely be the case most of the time

Signed-off-by: William Casarin <[email protected]>
Update fulltext search queries to include an optional filter. This can
be used to narrow down the fulltext search. This is another step towards
nip50 support in nostrdb.

I noticed the code was exiting dubiously in certain situations... so we
fix that as well. It's possible we were missing search results because
of this.

Signed-off-by: William Casarin <[email protected]>
This adds support for nip50 fulltext searches. This allows you to use
the nostrdb query interface for executing fulltext searches instead of
the typical `ndb_text_search` api. The benefits of this include a
standardized query interface that also further filters on other fields
in the filter.

Changelog-Added: Add nip50 search filters and queries
Signed-off-by: William Casarin <[email protected]>
Add support for type KIND for bech32-encoded entities naddr and nevent
as specified in NIP-19.

Co-authored-by: kernelkind <[email protected]>
Signed-off-by: William Casarin <[email protected]>
some binding dir stoppers, and configurator
doesn't need to create a copy of the id

Signed-off-by: William Casarin <[email protected]>
This is still kind of broken until queries are switched over to nostrdb.
Will do this next

Signed-off-by: William Casarin <[email protected]>
Signed-off-by: William Casarin <[email protected]>
Signed-off-by: William Casarin <[email protected]>
Signed-off-by: William Casarin <[email protected]>
jb55 added 2 commits February 13, 2025 16:13
Signed-off-by: William Casarin <[email protected]>
Signed-off-by: William Casarin <[email protected]>
@jb55 jb55 marked this pull request as ready for review February 14, 2025 00:30
@jb55
Copy link
Collaborator Author

jb55 commented Feb 14, 2025

@danieldaquino this is ready for testing!

@jb55 jb55 changed the title Update nostrdb, switch to local relay model Update to latest nostrdb Feb 14, 2025
@jb55
Copy link
Collaborator Author

jb55 commented Feb 14, 2025

looks like there are a fix issues with block parsing...

@jb55
Copy link
Collaborator Author

jb55 commented Feb 17, 2025

Fixed an iOS crash in the latest version of nostrdb. is a bus error (unaligned memory access) when trying to parse an empty json string when processing inner kind6 reposts (this is a new feature in this version of nostrdb)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
8 participants