+
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def to_docs(self, query_params: "BaseDBReader.QueryParams") -> list[Document]:
}
)
doc.properties[DocumentPropertyTypes.SOURCE] = DocumentSource.DB_QUERY
doc.properties["score"] = data["_score"]
result.append(doc)
else:
assert (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from unittest.mock import Mock
import random

from opensearchpy import OpenSearch, RequestError, ConnectionError
import pytest
Expand Down Expand Up @@ -176,7 +177,7 @@ def test_to_docs(self):
},
{"text_representation": "this is a parent doc", "parent_id": None, "doc_id": "doc_1"},
]
hits = [{"_source": record} for record in records]
hits = [{"_source": record, "_score": random.random()} for record in records]
query_response = OpenSearchReaderQueryResponse(hits)
query_params = OpenSearchReaderQueryParams(index_name="some index")
docs = query_response.to_docs(query_params)
Expand All @@ -186,6 +187,7 @@ def test_to_docs(self):
for i in range(len(docs)):
assert docs[i].parent_id == records[i]["parent_id"]
assert docs[i].text_representation == records[i]["text_representation"]
assert "score" in docs[i].properties

def test_to_docs_reconstruct_require_client(self):
query_response = OpenSearchReaderQueryResponse([])
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载