def _build_query_filter(
        self, mode, embedding_field, vector_top_k, similarity_top_k
    ):
        """
        Build query filter for Vespa query.
        The part after "select * from {sources_str} where" in the query.
        """
        if mode in [
            VectorStoreQueryMode.SEMANTIC_HYBRID,
            VectorStoreQueryMode.HYBRID,
        ]:
            return f"rank({{targetHits:{vector_top_k}}}nearestNeighbor({embedding_field},q), userQuery()) limit {similarity_top_k}"
        else:
            raise ValueError(f"Query mode {mode} not supported.")

        Build query filter for Vespa query.
        The part after "select * from {sources_str} where" in the query.
        
llama-index-integrations/vector_stores/llama-index-vector-stores-vespa/llama_index/vector_stores/vespa/base.py