Skip to content

Conversation

@subway-jack
Copy link
Collaborator

Description

Describe your changes in detail (optional if the linked issue already contains a detailed description of the changes).

Checklist

Go over all the following points, and put an x in all the boxes that apply.

  • I have read the CONTRIBUTION guide (required)
  • I have linked this PR to an issue using the Development section on the right sidebar or by adding Fixes #issue-number in the PR description (required)
  • I have checked if any dependencies need to be added or updated in pyproject.toml and uv lock
  • I have updated the tests accordingly (required for a bug fix or a new feature)
  • I have updated the documentation if needed:
  • I have added examples if this is a new feature

If you are unsure about any of these, don't hesitate to ask. We are here to help!

@subway-jack subway-jack self-assigned this Mar 31, 2025
@subway-jack subway-jack changed the title Base vector storage add search BaseVectorStorage-Add-Search-Function Mar 31, 2025
Copy link
Collaborator

@zjrwtx zjrwtx left a comment

Choose a reason for hiding this comment

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

thanks @subway-jack !left some comments

field_name="id",
datatype=DataType.VARCHAR,
descrition='A unique identifier for the vector',
descrition="A unique identifier for the vector",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
descrition="A unique identifier for the vector",
description="A unique identifier for the vector",

@zjrwtx
Copy link
Collaborator

zjrwtx commented Mar 31, 2025

please run pre-commit before commit

id: str,
payload: Dict[str, Any],
) -> "VectorDBSearchResult":
r"""A class method to construct a `VectorDBSearchResult` instance."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

docstring may need may clear

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, I'll add more details

id: str,
payload: Dict[str, Any],
) -> "VectorDBSearchResult":
r"""A class method to construct a `VectorDBSearchResult` instance."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

docstring may need more clear

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, I'll add more details

@lightaime
Copy link
Member

lightaime commented Mar 31, 2025

Thanks @subway-jack for the contributions!

@AveryYay Hi Avery. It would be great if you can help with reviewing this PR.

add the more description detail
add the more description detail
add the more description detail
add the more description detail
@AveryYay
Copy link
Collaborator

Thanks @subway-jack for the contributions!

@AveryYay Hi Avery. It would be great if you can help with reviewing this PR.

Sure!

if isinstance(cond, dict):
expressions = []
for op, v in cond.items():
if op == "$eq":
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would consider using a dictionary to do the if-else matching here

@Wendong-Fan Wendong-Fan added the Review Required PR need to be reviewed label May 18, 2025
@Wendong-Fan Wendong-Fan added this to the Sprint 30 milestone May 18, 2025
@Wendong-Fan Wendong-Fan requested a review from a7m-1st May 18, 2025 19:04
@Wendong-Fan Wendong-Fan changed the title BaseVectorStorage-Add-Search-Function feat: BaseVectorStorage-Add-Search-Function May 18, 2025
@hesamsheikh hesamsheikh self-requested a review May 21, 2025 15:23
Copy link
Collaborator

@hesamsheikh hesamsheikh left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @subway-jack. I have left some comments.

payload_filter (Dict[str, Any]): The filter criteria used to
select records.For example, {"category": "fruit", "color":
"red"}.
top_top_k (int, optional): The number of top similar vectors to
Copy link
Collaborator

Choose a reason for hiding this comment

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

typo in top_top_k

"""

record: VectorRecord
match_info: Dict[str, Any]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this actually used?

@abstractmethod
def search(
self,
search: VectorDBSearch,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is supposed to be "filter" not search

pass

@abstractmethod
def search(
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe for the sake of name clarity, it's better to rename this function to search_by_payload, to differentiate from the filter funciton

Comment on lines +472 to +473
if index == search.top_k - 1:
break
Copy link
Collaborator

Choose a reason for hiding this comment

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

could you please make sure that the SDK does not support an argument like limit or similar?

from datetime import datetime
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union, cast

from qdrant_client.http.models import Filter
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is already imported multiple times in the functions

Comment on lines +443 to +447
def search(
self,
search: VectorDBSearch,
**kwargs: Any,
) -> List[VectorDBSearchResult]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

empty function

@zjrwtx
Copy link
Collaborator

zjrwtx commented May 30, 2025

hello @subway-jack ,anything blocking you?let us know if you need any help,thanks

@subway-jack
Copy link
Collaborator Author

hello @subway-jack ,anything blocking you?let us know if you need any help,thanks

Thank you for the gentle reminder. I’m sorry I haven’t pushed the latest changes yet—some other tasks cropped up unexpectedly. I’ll make sure to update this PR later this week.

@Wendong-Fan Wendong-Fan added Waiting for Update PR has been reviewed, need to be updated based on review comment and removed Review Required PR need to be reviewed labels Jun 1, 2025
@waleedalzarooni
Copy link
Collaborator

Hey @subway-jack

Thanks again for contributing to this PR, would love to hear about how progress has been coming along and whether we can help in any way!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Waiting for Update PR has been reviewed, need to be updated based on review comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[Feature Request] Add search to BaseVectorStorage and all classes implemented it

8 participants