}
        add_meta = (
            {
                "id": outline_res["document"]["id"],
                "ranking": outline_res["ranking"],
                "collection_id": outline_res["document"]["collectionId"],
                "parent_document_id": outline_res["document"]["parentDocumentId"],
                "revision": outline_res["document"]["revision"],
                "created_by": outline_res["document"]["createdBy"]["name"],
            }
            if self.load_all_available_meta
            else {}
        )
        doc = Document(
            page_content=outline_res["document"]["text"][: self.doc_content_chars_max],
            metadata={
                **main_meta,
                **add_meta,
            },
        )
        return doc
    def _outline_api_query(self, query: str) -> List:
        raw_result = requests.post(
            f"{self.outline_instance_url}{self.outline_search_endpoint}",
            data={"query": query, "limit": self.top_k_results},
            headers={"Authorization": f"Bearer {self.outline_api_key}"},
        )
        if not raw_result.ok:
            raise ValueError("Outline API returned an error: ", raw_result.text)
        return raw_result.json()["data"]
[docs]    def run(self, query: str) -> List[Document]:
        """
        Run Outline search and get the document content plus the meta information.
        Returns: a list of documents.
        """
        results = self._outline_api_query(query[:OUTLINE_MAX_QUERY_LENGTH])
        docs = []
        for result in results[: self.top_k_results]:
            if doc := self._result_to_document(result):
                docs.append(doc)
        return docs