mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-09 04:50:37 +00:00
community[pathch]: Add missing custom content_key handling in Redis vector store (#27736)
This fix an error caused by missing custom content_key handling in Redis vector store in function similarity_search_with_score.
This commit is contained in:
parent
5a2cfb49e0
commit
8d8e38b090
@ -866,7 +866,8 @@ class Redis(VectorStore):
|
|||||||
metadata = {"id": result.id}
|
metadata = {"id": result.id}
|
||||||
metadata.update(self._collect_metadata(result))
|
metadata.update(self._collect_metadata(result))
|
||||||
|
|
||||||
doc = Document(page_content=result.content, metadata=metadata)
|
content_key = self._schema.content_key
|
||||||
|
doc = Document(page_content=getattr(result, content_key), metadata=metadata)
|
||||||
distance = self._calculate_fp_distance(result.distance)
|
distance = self._calculate_fp_distance(result.distance)
|
||||||
docs_with_scores.append((doc, distance))
|
docs_with_scores.append((doc, distance))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user