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

Split the bindings for TSQuery and TSQueryCursor into multiple classes #70

Closed
wants to merge 9 commits into from

Conversation

Emmeral
Copy link

@Emmeral Emmeral commented Jan 10, 2025

Fixes #66

Separation of Query and QueryCursor while still supporting predicates and without breaking API changes. The new QueryCursor class can be used to evaluate the same Query instance on different nodes in parallel. Also it allows to compile a certain query only once if it is used multiple times.

This also fixes a potential bug 1 that appeared if one did not directly consume the Stream returned from Query::findMatches by preloading the entire stream content.

The QueryCursor class is still missing bindings for ts_query_cursor_next_capture (c.f. API) but this can be added in a future PR.

Note: The branch also contains the commits from #63

Footnotes

  1. var s1 = query.findMatches(n1); var s2 = query.findMatches(n2); Stream.concat(s1,s2).forEach(...)

@Emmeral Emmeral force-pushed the SplitQueryAndQueryCursor branch from 4a190d8 to 89dc1fc Compare January 10, 2025 12:45
@amaanq amaanq requested a review from ObserverOfTime January 11, 2025 05:39
@ObserverOfTime
Copy link
Member

I don't particularly like this implementation. I'll think of something else.

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.

Split the bindings for TSQuery and TSQueryCursor into multiple classes
2 participants