def add_prefix_to_queries(queries: List[BulkSearchQueryEntity]) -> List[BulkSearchQueryEntity]:
    """
    Add prefix to the queries if it is a text query.

    Raises:
        MediaDownloadError: If the media cannot be downloaded
    """
    prefixed_queries = []
    for q in queries:
        text_query_prefix = q.index.model.get_text_query_prefix(q.text_query_prefix)

        if q.q is None:
            prefixed_q = q.q
        elif isinstance(q.q, str):
            modality = infer_modality(q.q, q.mediaDownloadHeaders)
            if modality == Modality.TEXT:
                prefixed_q = f"{text_query_prefix}{q.q}"
            else:
                prefixed_q = q.q
        else:  # q.q is dict
            prefixed_q = {}
            for key, value in q.q.items():
                # Apply prefix if key is not an image or if index does not treat URLs and pointers as images
                modality = infer_modality(key, q.mediaDownloadHeaders)
                if modality == Modality.TEXT:
                    prefixed_q[f"{text_query_prefix}{key}"] = value
                else:
                    prefixed_q[key] = value
        new_query_object = BulkSearchQueryEntity(
            q=prefixed_q,
            searchableAttributes=q.searchableAttributes,
            searchMethod=q.searchMethod,
            limit=q.limit,
            offset=q.offset,
            showHighlights=q.showHighlights,
            filter=q.filter,
            attributesToRetrieve=q.attributesToRetrieve,
            boost=q.boost,
            mediaDownloadHeaders=q.mediaDownloadHeaders,
            context=q.context,
            scoreModifiers=q.scoreModifiers,
            index=q.index,
            modelAuth=q.modelAuth,
            text_query_prefix=q.text_query_prefix,
            hybridParameters=q.hybridParameters
        )
        prefixed_queries.append(new_query_object)

    return prefixed_queries

    Add prefix to the queries if it is a text query.

    Raises:
        MediaDownloadError: If the media cannot be downloaded
    
src/marqo/tensor_search/tensor_search.py