Index Readiness
The indexes that are ready to read, and the indexing of those that are not.
Every service that reads the index (search and
reading) asks here first. A repository, or the blog, that
is not indexed yet is queued for indexing, with a Celery task, at most once every
INDEX_QUEUE_TIMEOUT seconds, and the caller is told to try again in a few minutes.
Note
Experimental. The MCPServer was designed and coded by Claude Code (Anthropic’s Claude Opus 5.5), with Lawrence McDaniel as co-author. It is experimental, and will be documented.
- smarter.apps.mcpserver.services.indexing.indexes.INDEX_QUEUE_TIMEOUT = 600
Seconds during which a repository that is not indexed is queued for indexing only once.
- smarter.apps.mcpserver.services.indexing.indexes.not_indexed_error(names)[source]
Return the error for repositories that are not indexed yet, and have been queued.
- Parameters:
names (
str) – The repositories’ names, e.g.smarter-cli, orThe blog, <url>,.- Return type:
- Returns:
The error, for the caller to raise.
- smarter.apps.mcpserver.services.indexing.indexes.queue_indexing(repository)[source]
Queue a repository, or the blog, that is not indexed for indexing, at most once every
INDEX_QUEUE_TIMEOUTseconds.Many requests may find the same repository not indexed while it is being indexed, so a cache key, added only if it is missing, makes sure that only the first of them queues a task.
Side effects: a cache write, and, if the key was not there, a Celery task queued:
smarter.apps.mcpserver.tasks.index_blog()orsmarter.apps.mcpserver.tasks.index_repository().- Parameters:
repository (
ProjectRepository|ProjectBlog) – The repository, or the blog.- Return type:
- smarter.apps.mcpserver.services.indexing.indexes.queue_indexing_key(name)[source]
Return the cache key that remembers that a repository was queued for indexing.
- smarter.apps.mcpserver.services.indexing.indexes.ready_indexes(repositories)[source]
Return the indexes of the repositories that are ready to read, and queue the others for indexing.
Side effects: one database query, and
queue_indexing()for each repository that is not ready.- Parameters:
repositories (
Sequence[ProjectRepository|ProjectBlog]) – The repositories, or the blog.- Return type:
- Returns:
The ready indexes, by repository name.
- smarter.apps.mcpserver.services.indexing.indexes.require_blog_index(blog)[source]
Return the blog’s index.
Side effects: see
ready_indexes().- Parameters:
blog (
ProjectBlog) – The blog.- Return type:
- Returns:
Its index.
- Raises:
SmarterMCPServerServiceError – If the blog is not indexed yet. It is then queued for indexing.
- smarter.apps.mcpserver.services.indexing.indexes.require_index(repository)[source]
Return a repository’s index.
Side effects: see
ready_indexes().- Parameters:
repository (
ProjectRepository) – The repository.- Return type:
- Returns:
Its index.
- Raises:
SmarterMCPServerServiceError – If the repository is not indexed yet. It is then queued for indexing.