Skip to content

Commit e056afd

Browse files
author
Zhe Yu
committed
fix query filter
1 parent b53ef99 commit e056afd

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/vectorcode/database/chroma0.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from tree_sitter import Point
2222

2323
from vectorcode.chunking import Chunk, TreeSitterChunker
24-
from vectorcode.cli_utils import Config, LockManager, expand_path
24+
from vectorcode.cli_utils import Config, LockManager, QueryInclude, expand_path
2525
from vectorcode.common import get_embedding_function
2626
from vectorcode.database.base import DatabaseConnectorBase
2727
from vectorcode.database.errors import CollectionNotFoundError
@@ -277,6 +277,14 @@ async def query(self, collection_path, keywords_embeddings, opts):
277277
query_filter = cast(
278278
chromadb.Where, {"path": {"$nin": list(opts.excluded_files)}}
279279
)
280+
if QueryInclude.chunk in self._configs.include:
281+
if query_filter is None:
282+
query_filter = cast(chromadb.Where, {"start": {"$gte": 0}})
283+
else:
284+
query_filter = cast(
285+
chromadb.Where,
286+
{"$and": [query_filter.copy(), {"start": {"$gte": 0}}]},
287+
)
280288
query_result = await collection.query(
281289
query_embeddings=keywords_embeddings,
282290
include=[

0 commit comments

Comments
 (0)