> ## Documentation Index
> Fetch the complete documentation index at: https://ahen.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Query a collection

> Query a collection for similar result

<Steps titleSize="h3">
  <Step title="Query a collection">
    To query a collection assuming their is already data in the collection:

    ```python Python theme={"system"}
    # Query for similar documents
    results = collection.query(
        query_texts=["This is a query document"],
        n_results=2
    )

    # Access results
    if not results:
        print("No results found.")
    else:
        for i, doc_id in enumerate(results["ids"][0]):
            print(f"{doc_id}, {results['documents'][0][i]}, {results['distances'][0][i]}")
    ```
  </Step>
</Steps>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.