roboflow-python
roboflow-python copied to clipboard
Prompt in search() and search_all() ignored, returns all images in dataset instead
rf = roboflow.Roboflow(api_key=API_KEY)
workspace = rf.workspace(WORKSPACE)
project = workspace.project(PROJECT_ID)
filename = "vlcsnap-2024-08-28-19h46m52s829.png"
results = []
for result in project.search_all(prompt=f'filename:"{filename}"'):
results.extend(result)
print(len(results))
Running the code above returns every single image in the dataset, instead of just the one with the specific filename. Using the same query in the web UI returns the correct image:
loading Roboflow workspace...
loading Roboflow project...
5887
Hey, the search() and search_all() functions are intended for semantic search. According to the official documentation, "Semantic search happens when you enter a text query without any filter selectors (ex: filename:)". For more information, please see: Semantic search Roboflow documentation.
I have also attached an image to illustrate how the functions behave.
Image from docs.roboflow.com
Additionally, I have submitted a pull request to address this issue.