Skip to content

Commit

Permalink
Fix SQL parser Error in MyScale vdb. (langgenius#7255)
Browse files Browse the repository at this point in the history
  • Loading branch information
MochiXu authored Aug 14, 2024
1 parent 3a27166 commit ba79088
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions api/core/rag/datasource/vdb/myscale/myscale_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def add_texts(self, documents: list[Document], embeddings: list[list[float]], **

@staticmethod
def escape_str(value: Any) -> str:
return "".join(f"\\{c}" if c in ("\\", "'") else c for c in str(value))
return "".join(" " if c in ("\\", "'") else c for c in str(value))

def text_exists(self, id: str) -> bool:
results = self._client.query(f"SELECT id FROM {self._config.database}.{self._collection_name} WHERE id='{id}'")
Expand All @@ -118,7 +118,7 @@ def search_by_vector(self, query_vector: list[float], **kwargs: Any) -> list[Doc
return self._search(f"distance(vector, {str(query_vector)})", self._vec_order, **kwargs)

def search_by_full_text(self, query: str, **kwargs: Any) -> list[Document]:
return self._search(f"TextSearch(text, '{query}')", SortOrder.DESC, **kwargs)
return self._search(f"TextSearch('enable_nlq=false')(text, '{query}')", SortOrder.DESC, **kwargs)

def _search(self, dist: str, order: SortOrder, **kwargs: Any) -> list[Document]:
top_k = kwargs.get("top_k", 5)
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ services:
# MyScale vector database
myscale:
container_name: myscale
image: myscale/myscaledb:1.6
image: myscale/myscaledb:1.6.4
profiles:
- myscale
restart: always
Expand Down

0 comments on commit ba79088

Please sign in to comment.