elasticsearch-haystack 0.1.0__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of elasticsearch-haystack might be problematic. Click here for more details.

Files changed (17) hide show
  1. {elasticsearch_haystack-0.1.0 → elasticsearch_haystack-0.1.2}/PKG-INFO +4 -4
  2. {elasticsearch_haystack-0.1.0 → elasticsearch_haystack-0.1.2}/README.md +1 -1
  3. {elasticsearch_haystack-0.1.0 → elasticsearch_haystack-0.1.2}/pyproject.toml +9 -4
  4. {elasticsearch_haystack-0.1.0 → elasticsearch_haystack-0.1.2}/src/elasticsearch_haystack/document_store.py +1 -1
  5. {elasticsearch_haystack-0.1.0 → elasticsearch_haystack-0.1.2}/tests/test_document_store.py +28 -1
  6. elasticsearch_haystack-0.1.0/src/elasticsearch_haystack/__about__.py +0 -4
  7. {elasticsearch_haystack-0.1.0 → elasticsearch_haystack-0.1.2}/.gitignore +0 -0
  8. {elasticsearch_haystack-0.1.0 → elasticsearch_haystack-0.1.2}/LICENSE +0 -0
  9. {elasticsearch_haystack-0.1.0 → elasticsearch_haystack-0.1.2}/docker-compose.yml +0 -0
  10. {elasticsearch_haystack-0.1.0 → elasticsearch_haystack-0.1.2}/src/elasticsearch_haystack/__init__.py +0 -0
  11. {elasticsearch_haystack-0.1.0 → elasticsearch_haystack-0.1.2}/src/elasticsearch_haystack/bm25_retriever.py +0 -0
  12. {elasticsearch_haystack-0.1.0 → elasticsearch_haystack-0.1.2}/src/elasticsearch_haystack/embedding_retriever.py +0 -0
  13. {elasticsearch_haystack-0.1.0 → elasticsearch_haystack-0.1.2}/src/elasticsearch_haystack/filters.py +0 -0
  14. {elasticsearch_haystack-0.1.0 → elasticsearch_haystack-0.1.2}/tests/__init__.py +0 -0
  15. {elasticsearch_haystack-0.1.0 → elasticsearch_haystack-0.1.2}/tests/test_bm25_retriever.py +0 -0
  16. {elasticsearch_haystack-0.1.0 → elasticsearch_haystack-0.1.2}/tests/test_embedding_retriever.py +0 -0
  17. {elasticsearch_haystack-0.1.0 → elasticsearch_haystack-0.1.2}/tests/test_filters.py +0 -0
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: elasticsearch-haystack
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: Haystack 2.x Document Store for ElasticSearch
5
- Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/document_stores/elasticsearch#readme
5
+ Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/elasticsearch#readme
6
6
  Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
7
- Project-URL: Source, https://github.com/deepset-ai/haystack-core-integrations/tree/main/document_stores/elasticsearch
7
+ Project-URL: Source, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/elasticsearch
8
8
  Author-email: Silvano Cerza <silvanocerza@gmail.com>
9
9
  License-Expression: Apache-2.0
10
10
  License-File: LICENSE
@@ -21,7 +21,7 @@ Requires-Dist: elasticsearch<9,>=8
21
21
  Requires-Dist: haystack-ai
22
22
  Description-Content-Type: text/markdown
23
23
 
24
- [![test](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/document_stores_elasticsearch.yml/badge.svg)](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/document_stores_elasticsearch.yml)
24
+ [![test](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/elasticsearch.yml/badge.svg)](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/elasticsearch.yml)
25
25
 
26
26
  [![PyPI - Version](https://img.shields.io/pypi/v/elasticsearch-haystack.svg)](https://pypi.org/project/elasticsearch-haystack)
27
27
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/elasticsearch-haystack.svg)](https://pypi.org/project/elasticsearch-haystack)
@@ -1,4 +1,4 @@
1
- [![test](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/document_stores_elasticsearch.yml/badge.svg)](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/document_stores_elasticsearch.yml)
1
+ [![test](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/elasticsearch.yml/badge.svg)](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/elasticsearch.yml)
2
2
 
3
3
  [![PyPI - Version](https://img.shields.io/pypi/v/elasticsearch-haystack.svg)](https://pypi.org/project/elasticsearch-haystack)
4
4
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/elasticsearch-haystack.svg)](https://pypi.org/project/elasticsearch-haystack)
@@ -1,5 +1,5 @@
1
1
  [build-system]
2
- requires = ["hatchling"]
2
+ requires = ["hatchling", "hatch-vcs"]
3
3
  build-backend = "hatchling.build"
4
4
 
5
5
  [project]
@@ -29,12 +29,17 @@ dependencies = [
29
29
  ]
30
30
 
31
31
  [project.urls]
32
- Documentation = "https://github.com/deepset-ai/haystack-core-integrations/tree/main/document_stores/elasticsearch#readme"
32
+ Documentation = "https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/elasticsearch#readme"
33
33
  Issues = "https://github.com/deepset-ai/haystack-core-integrations/issues"
34
- Source = "https://github.com/deepset-ai/haystack-core-integrations/tree/main/document_stores/elasticsearch"
34
+ Source = "https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/elasticsearch"
35
35
 
36
36
  [tool.hatch.version]
37
- path = "src/elasticsearch_haystack/__about__.py"
37
+ source = "vcs"
38
+ tag-pattern = 'integrations\/elasticsearch-v(?P<version>.*)'
39
+
40
+ [tool.hatch.version.raw-options]
41
+ root = "../.."
42
+ git_describe_command = 'git describe --tags --match="integrations/elasticsearch-v[0-9]*"'
38
43
 
39
44
  [tool.hatch.envs.default]
40
45
  dependencies = [
@@ -263,7 +263,7 @@ class ElasticsearchDocumentStore:
263
263
  "query": query,
264
264
  "fuzziness": fuzziness,
265
265
  "type": "most_fields",
266
- "operator": "AND",
266
+ "operator": "OR",
267
267
  }
268
268
  }
269
269
  ]
@@ -10,7 +10,7 @@ import pytest
10
10
  from elasticsearch.exceptions import BadRequestError # type: ignore[import-not-found]
11
11
  from haystack.dataclasses.document import Document
12
12
  from haystack.document_stores.errors import DocumentStoreError, DuplicateDocumentError
13
- from haystack.document_stores.protocols import DuplicatePolicy
13
+ from haystack.document_stores.protocol import DuplicatePolicy
14
14
  from haystack.testing.document_store import DocumentStoreBaseTests
15
15
 
16
16
  from elasticsearch_haystack.document_store import ElasticsearchDocumentStore
@@ -182,6 +182,33 @@ class TestDocumentStore(DocumentStoreBaseTests):
182
182
  assert "functional" in res[1].content
183
183
  assert "functional" in res[2].content
184
184
 
185
+ def test_bm25_not_all_terms_must_match(self, document_store: ElasticsearchDocumentStore):
186
+ """
187
+ Test that not all terms must mandatorily match for BM25 retrieval to return a result.
188
+ """
189
+ documents = [
190
+ Document(id=1, content="There are over 7,000 languages spoken around the world today."),
191
+ Document(
192
+ id=2,
193
+ content=(
194
+ "Elephants have been observed to behave in a way that indicates a high level of self-awareness"
195
+ " such as recognizing themselves in mirrors."
196
+ ),
197
+ ),
198
+ Document(
199
+ id=3,
200
+ content=(
201
+ "In certain parts of the world, like the Maldives, Puerto Rico, and San Diego, you can witness"
202
+ " the phenomenon of bioluminescent waves."
203
+ ),
204
+ ),
205
+ ]
206
+ document_store.write_documents(documents)
207
+
208
+ res = document_store._bm25_retrieval("How much self awareness do elephants have?", top_k=3)
209
+ assert len(res) == 1
210
+ assert res[0].id == 2
211
+
185
212
  def test_embedding_retrieval(self, document_store: ElasticsearchDocumentStore):
186
213
  docs = [
187
214
  Document(content="Most similar document", embedding=[1.0, 1.0, 1.0, 1.0]),
@@ -1,4 +0,0 @@
1
- # SPDX-FileCopyrightText: 2023-present deepset GmbH <info@deepset.ai>
2
- #
3
- # SPDX-License-Identifier: Apache-2.0
4
- __version__ = "0.1.0"