return self.create_results(
            self.inner_embedding_query(
                embedding=embedding, search_filter=search_filter, k=k
            )
        )
[docs]    def inner_embedding_query(
        self,
        embedding: List[float],
        search_filter: Optional[Dict[str, Any]] = None,
        k: int = 4,
    ) -> Dict[str, Any]:
        def generate_embedding_query() -> str:
            tmp_search_config_str = (
                f"config=start:0,hit:{k},format:json&&cluster=general&&kvpairs="
                f"first_formula:proxima_score({self.config.embedding_index_name})&&sort=+RANK"
            )
            tmp_query_str = (
                f"&&query={self.config.embedding_index_name}:"
                + "'"
                + ",".join(str(x) for x in embedding)
                + "'"
            )
            if search_filter is not None:
                filter_clause = "&&filter=" + " AND ".join(
                    [
                        create_filter(md_key, md_value)
                        for md_key, md_value in search_filter.items()
                    ]
                )
                tmp_query_str += filter_clause
            return tmp_search_config_str + tmp_query_str
        def create_filter(md_key: str, md_value: Any) -> str:
            md_filter_expr = self.config.field_name_mapping[md_key]
            if md_filter_expr is None:
                return ""
            expr = md_filter_expr.split(",")
            if len(expr) != 2:
                logger.error(
                    f"filter {md_filter_expr} express is not correct, "
                    f"must contain mapping field and operator."
                )
                return ""
            md_filter_key = expr[0].strip()