roboflow-python icon indicating copy to clipboard operation
roboflow-python copied to clipboard

Prompt in search() and search_all() ignored, returns all images in dataset instead

Open 03vmate opened this issue 9 months ago • 1 comments

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

Image

03vmate avatar Mar 02 '25 16:03 03vmate

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 Image from docs.roboflow.com

Additionally, I have submitted a pull request to address this issue.

Ashp116 avatar Jun 15 '25 08:06 Ashp116