summaryrefslogtreecommitdiff
path: root/continuedev/src/continuedev/core
diff options
context:
space:
mode:
authorKirill Dubovitskiy <kirill2003de@gmail.com>2023-08-08 22:58:03 -0700
committerKirill Dubovitskiy <kirill2003de@gmail.com>2023-08-08 22:59:22 -0700
commitac14b40bbd93ccea991bb81615ed5ea0a1f29a86 (patch)
treefd8e6eefb0f07cb4d6d83f71799b5f42ede72ada /continuedev/src/continuedev/core
parent47c19fa8da8b459c4cfc1d9a535c6cadaa5fa5ec (diff)
downloadsncontinue-ac14b40bbd93ccea991bb81615ed5ea0a1f29a86.tar.gz
sncontinue-ac14b40bbd93ccea991bb81615ed5ea0a1f29a86.tar.bz2
sncontinue-ac14b40bbd93ccea991bb81615ed5ea0a1f29a86.zip
Fixed an issue with files from other workspaces showing up in @context search
- Adding workspace folder information to react-app that uses - Adding workspace_dir to the meilisearch documents - Keeping the original singlton index as that requires a bigger change - Truncated the context descriptions from absolute paths to only include path relative to workspace directory Note: I have freely changed the store.config model from workspacePath to workspacePaths as it was unused, can't think of a way how it would backfire at the moment with older versions that might have been using it. Might be missing something here
Diffstat (limited to 'continuedev/src/continuedev/core')
-rw-r--r--continuedev/src/continuedev/core/context.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/continuedev/src/continuedev/core/context.py b/continuedev/src/continuedev/core/context.py
index b1f68b50..48c14ed6 100644
--- a/continuedev/src/continuedev/core/context.py
+++ b/continuedev/src/continuedev/core/context.py
@@ -176,14 +176,21 @@ class ContextManager:
"id": item.description.id.to_string(),
"name": item.description.name,
"description": item.description.description,
- "content": item.content
+ "content": item.content,
+ "workspace_dir": workspace_dir,
}
for item in context_items
]
if len(documents) > 0:
try:
async with Client('http://localhost:7700') as search_client:
- await asyncio.wait_for(search_client.index(SEARCH_INDEX_NAME).add_documents(documents), timeout=5)
+ # The index is currently shared by all workspaces
+ globalSearchIndex = await search_client.get_index(SEARCH_INDEX_NAME)
+ await asyncio.wait_for(asyncio.gather(
+ # Ensure that the index has the correct filterable attributes
+ globalSearchIndex.update_filterable_attributes(["workspace_dir"]),
+ globalSearchIndex.add_documents(documents)
+ ), timeout=5)
except Exception as e:
logger.debug(f"Error loading meilisearch index: {e}")