Skip to content
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

feat: tag '&' query #178

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

feat: tag '&' query #178

wants to merge 1 commit into from

Conversation

v0l
Copy link
Contributor

@v0l v0l commented Nov 28, 2023

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

@dskvr
Copy link

dskvr commented Mar 28, 2024

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

@v0l
Copy link
Contributor Author

v0l commented Mar 28, 2024

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

@dskvr
Copy link

dskvr commented Jun 24, 2024

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

@lez
Copy link

lez commented Jun 24, 2024

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.

@dskvr
Copy link

dskvr commented Jun 24, 2024

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

@v0l
Copy link
Contributor Author

v0l commented Jun 25, 2024

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

@lez
Copy link

lez commented Jun 25, 2024

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.

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

Successfully merging this pull request may close these issues.

None yet

3 participants