generated from deepset-ai/document-store
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
72e7309
commit 01daad8
Showing
4 changed files
with
16 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# SPDX-FileCopyrightText: 2023-present Silvano Cerza <[email protected]> | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
from typing import Optional, Dict, List, Any | ||
from typing import Any, Dict, List, Optional | ||
|
||
from haystack.preview import component, default_to_dict, default_from_dict | ||
from haystack.preview import component, default_from_dict, default_to_dict | ||
from haystack.preview.dataclasses import Document | ||
|
||
from elasticsearch_haystack.document_store import ElasticsearchDocumentStore | ||
|
@@ -13,6 +13,7 @@ | |
class ElasticsearchBM25Retriever: | ||
def __init__( | ||
self, | ||
*, | ||
document_store: ElasticsearchDocumentStore, | ||
filters: Optional[Dict[str, Any]] = None, | ||
top_k: int = 10, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
# SPDX-FileCopyrightText: 2023-present Silvano Cerza <[email protected]> | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
from unittest.mock import patch, Mock | ||
from unittest.mock import Mock, patch | ||
|
||
from haystack.preview.dataclasses import Document | ||
|
||
from elasticsearch_haystack.document_store import ElasticsearchDocumentStore | ||
from elasticsearch_haystack.bm25_retriever import ElasticsearchBM25Retriever | ||
from elasticsearch_haystack.document_store import ElasticsearchDocumentStore | ||
|
||
|
||
def test_init_default(): | ||
|
@@ -19,7 +19,7 @@ def test_init_default(): | |
|
||
|
||
@patch("elasticsearch_haystack.document_store.Elasticsearch") | ||
def test_to_dict(mock_elasticsearch_client): | ||
def test_to_dict(_mock_elasticsearch_client): | ||
document_store = ElasticsearchDocumentStore(hosts="some fake host") | ||
retriever = ElasticsearchBM25Retriever(document_store=document_store) | ||
res = retriever.to_dict() | ||
|
@@ -38,7 +38,7 @@ def test_to_dict(mock_elasticsearch_client): | |
|
||
|
||
@patch("elasticsearch_haystack.document_store.Elasticsearch") | ||
def test_from_dict(mock_elasticsearch_client): | ||
def test_from_dict(_mock_elasticsearch_client): | ||
data = { | ||
"type": "ElasticsearchBM25Retriever", | ||
"init_parameters": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters