Skip to content

Hybrid search fail due to Text_key is stored in a nested field  #19

Closed
@abdelsalamhamdi

Description

@abdelsalamhamdi

When performing the hybrid search the following code in libs/mongodb/langchain_mongodb/retrievers/hybrid_search.py cause a key value error if the text_key is a nested filed example title.text

# Formatting
        docs = []
        for res in cursor:
            text = res.pop(self.vectorstore._text_key)
            # score = res.pop("score")  # The score remains buried!
            make_serializable(res)
            docs.append(Document(page_content=text, metadata=res))
        return docs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions