Continuing my exploration of Searchcraft I loaded all of my blog into it. It fully posted, indexed, and had my content ready for search in a literal blink. It was like the experience of python devs running ruff for the first time, and having the no way you just did that experience.

Ok so semantic search is so freaking cool, does not compare to fuzzy search at all. I don't have to include parts of the title or something to find a post. I don't have to spell things right, I dont even have to get the thing right. I can ask "create a mycraft server in kibinerers" and it takes me to the post about running Minecraft in containers.


import asyncio
import httpx

SEARCHCRAFT_URL = "http://0.0.0.0:8000"
INDEX_NAME = "creation_test"


def upload_documents(m):
    documents = [
        {
            "id": post.slug,
            "title": post.title,
            "body": post.content,
        }
        for post in m.posts
    ]

    async with httpx.Client() as client:
        url = f"{SEARCHCRAFT_URL}/index/{INDEX_NAME}/documents"
        response = client.post(url, json=documents)
        response.raise_for_status()
        print("Upload:", response.json())

        # Commit changes
        commit_url = f"{SEARCHCRAFT_URL}/index/{INDEX_NAME}/commit"
        commit_resp = client.post(commit_url)
        commit_resp.raise_for_status()
        print("Committed:", commit_resp.json())


from markata import Markata

m = Markata()
upload_documents(m)