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

Narek/streaming hnsw index selects #322

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Ngalstyan4
Copy link
Contributor

No description provided.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

  • Renamed and reorganized SQL update files for better structure
  • Updated triggers and functions for async tasks and vector search
  • Modified HNSW index scan logic with continue_search variable
  • Updated third_party/usearch submodule to a new commit hash
  • Added empty sql/updates/0.3.0--0.3.1.sql file for version tracking

src/hnsw/scan.c Outdated
@@ -181,6 +181,7 @@ bool ldb_amgettuple(IndexScanDesc scan, ScanDirection dir)

int ef = ldb_hnsw_ef_search; // 0 if not set, but we pass it into usearch_custom_ef anyway since 0 is also a
// sentinel value there
bool continue_search = false;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introduced continue_search to manage search state.

src/hnsw/scan.c Outdated
@@ -225,6 +226,7 @@ bool ldb_amgettuple(IndexScanDesc scan, ScanDirection dir)
scanstate->usearch_scalar,
k,
ef,
continue_search,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passed continue_search to usearch_search_ef.

@@ -252,6 +254,8 @@ bool ldb_amgettuple(IndexScanDesc scan, ScanDirection dir)
return false;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set continue_search to true for subsequent searches.

src/hnsw/scan.c Outdated
@@ -272,12 +276,14 @@ bool ldb_amgettuple(IndexScanDesc scan, ScanDirection dir)
scanstate->usearch_scalar,
k,
ef,
continue_search,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passed continue_search to usearch_search_ef.

scanstate->labels,
scanstate->distances,
&error);
ldb_wal_retriever_area_reset(scanstate->retriever_ctx);

scanstate->count = num_returned;
scanstate->current = 0;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reset scanstate->current to 0 after search.

@@ -1 +1 @@
Subproject commit a20193e1f3e10e18c0a8edd860727b11bf424e44
Subproject commit ece8908a58597ffa6570ca6fc5ef043103d05038
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated submodule commit from a20193e1f3e10e18c0a8edd860727b11bf424e44 to ece8908a58597ffa6570ca6fc5ef043103d05038.

Default to streaming search for index pagination

This used to have a GUC option. I removed streaming search GUC and
defaulted to it becasue the old approach had an issue and could
simetimes skip some index values and never returned them when paginating
@Ngalstyan4 Ngalstyan4 force-pushed the narek/streaming-hnsw-index-selects branch from 53bb3bb to 194e0f1 Compare July 4, 2024 12:18
@Ngalstyan4 Ngalstyan4 force-pushed the narek/streaming-hnsw-index-selects branch from 194e0f1 to 87aa88a Compare July 5, 2024 12:47
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

1 participant