Skip to content

Commit

Permalink
refactor: add search_title method
Browse files Browse the repository at this point in the history
  • Loading branch information
ankit-v2-3 committed Nov 6, 2024
1 parent 15c01f0 commit c4acaf8
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions videodb/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,6 @@ def search(
score_threshold: Optional[float] = None,
dynamic_score_percentage: Optional[float] = None,
) -> SearchResult:
if search_type == SearchType.llm:
search_data = self._connection.post(
path=f"{ApiPath.collection}/{self.id}/{ApiPath.search}/{ApiPath.title}",
data={
"query": query,
"search_type": search_type,
},
)
return [
Video(self._connection, **result.get("video")) for result in search_data
]

search = SearchFactory(self._connection).get_search(search_type)
return search.search_inside_collection(
collection_id=self.id,
Expand All @@ -129,6 +117,18 @@ def search(
dynamic_score_percentage=dynamic_score_percentage,
)

def search_title(self, query) -> List[Video]:
search_data = self._connection.post(
path=f"{ApiPath.collection}/{self.id}/{ApiPath.search}/{ApiPath.title}",
data={
"query": query,
"search_type": SearchType.llm,
},
)
return [
Video(self._connection, **result.get("video")) for result in search_data
]

def upload(
self,
file_path: str = None,
Expand Down

0 comments on commit c4acaf8

Please sign in to comment.