nostr-rs-relay icon indicating copy to clipboard operation
nostr-rs-relay copied to clipboard

feat: tag '&' query

Open v0l opened this issue 1 year ago • 7 comments

Support draft <insert_nip> for querying tags with AND instead of OR operation.

This branch also greatly improves the query performace of tags by using JOIN on top level query, see query plan: NEW Screenshot 2023-11-28 at 12 53 21 OLD Screenshot 2023-11-28 at 12 54 59

AND query plan: Screenshot 2023-11-28 at 13 36 34

v0l avatar Nov 28 '23 14:11 v0l

I drafted nip for this a while back, but wasn't in the mood for nips so never published it. Someone please do this.

dskvr avatar Mar 28 '24 02:03 dskvr

I drafted nip for this a while back, but wasn't in the mood for nips so never published it. Someone please do this.

Yep thats basically what i have here instead of # to prefix the tag key you use &

["REQ", "a", { "kinds": [2003], "&t": ["movie","4k"] }]

Which is to say that you would like kind: 2003 events having both movie and 4k tags

v0l avatar Mar 28 '24 10:03 v0l

I'll publish the PR for the NIP this week, is this ready for review?

dskvr avatar Jun 24 '24 09:06 dskvr

I'll publish the PR for the NIP this week, is this ready for review?

it supports only sqlite, and posgres is mocked out on the branch. Needs some more refactoring in the experimental postgres code to make postgres also work. Except from the postgres support, it's ready.

lez avatar Jun 24 '24 11:06 lez

Is there a blocker for postgres support or was it just not started/completed?

dskvr avatar Jun 24 '24 13:06 dskvr

It was only implemented in postgres, it also needs to be added to sqlite code, nothing blocking adding it for sqlite

v0l avatar Jun 25 '24 13:06 v0l

It was only implemented in postgres, it also needs to be added to sqlite code, nothing blocking adding it for sqlite

Yes, @v0l made an implementation for postgres only. Then I wanted to use that, but I found it's easier to port that to sqlite than to adopt postgres code to the new master branch, so I went with sqlite.

If someone resolves the conflicts between the postgres code and master, it should be fine. I used the same datastructures in the common code what @v0l 's postgres commit used.

lez avatar Jun 25 '24 17:06 lez