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

Fix #176 - indexing support in collection creation #177

Closed
wants to merge 2 commits into from

Conversation

erichare
Copy link
Collaborator

Needs a test... wasn't actually sure the best way to go about that especially in lieu of the recent issues with timeouts...

@erichare erichare linked an issue Jan 25, 2024 that may be closed by this pull request
@@ -1941,6 +1941,7 @@ def create_collection(
options: Optional[Dict[str, Any]] = None,
dimension: Optional[int] = None,
metric: Optional[str] = None,
indexing: Optional[Dict[str, Any]] = None,
Copy link
Contributor

@nicoloboschi nicoloboschi Jan 25, 2024

Choose a reason for hiding this comment

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

shouldn't be better to expose the deny and allow parameters directly ? like

create_collection("test", allow_indexing=["field1"], deny_indexing=["field2"])

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So i totally agree @nicoloboschi ... it's just that we kind of move away from the API signature. In the past we've typically had syntactic sugar on separate functions that are wrappers, if that makes sense. With that said, if we're kind of slowly working towards just having AstraPy be more pythonic i totally agree and would happily update this. its definitely cleaner

@cbornet
Copy link
Collaborator

cbornet commented Jan 25, 2024

Is there a way to add a test ?

for k, v in {
"name": collection_name,
"options": options,
"indexing": indexing,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Careful. "indexing" is not a new top-level param as it seemed initially.
It was later confirmed that it is inside the "options" dict.

So...

  1. not urgent to sugar the indexing into a friendlier way since one can take advantage of the feature right away
  2. in case of separate indexing parameters to the method, similarly to 'dimension' and 'metric' it is necessary to check that it is not passed twice (once within the options and once as separate argument to create_collection)

And for what is worth, if sugar has to be, I would favor two parameters to the effect of allow and deny (and a check that no both are nonempty at the same time)

@hemidactylus hemidactylus added the do_not_merge Don't merge yet! label Jan 29, 2024
@hemidactylus
Copy link
Collaborator

Everyone, do not merge as the mismatch above ("indexing" should be inside options) still stands.

Pro: not so urgent as options is supported already everywhere and users can take advantage of the indexing right away
Con: needs a small rework of the above (amounting to making it only sugar around the options stuff)

@cbornet cbornet marked this pull request as draft January 30, 2024 08:54
@erichare
Copy link
Collaborator Author

erichare commented Feb 1, 2024

Closing this for now. Will open a new PR for adding syntactic sugar to the indexing (allow, deny)

@erichare erichare closed this Feb 1, 2024
@erichare erichare deleted the feature/#176-indexing branch February 1, 2024 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do_not_merge Don't merge yet!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants