Chore: Delete the in-memory Tantivy backend and run the search tests on disk (#14216)

TantivyBackend(path=None) built an in-memory index that is not used by production ever used. The backend now requires a path, the open, write-batch and rebuild branches are gone, and the shared backend fixture and the fulltext similar-documents fixture build a real index under the per-test directory layout.
This commit is contained in:
Trenton H
2026-09-22 08:02:16 -07:00
committed by GitHub
parent cb85441c2f
commit e4367b5648
3 changed files with 60 additions and 67 deletions
+7 -2
View File
@@ -1,6 +1,7 @@
import datetime
from collections.abc import Generator
from types import SimpleNamespace
from typing import TYPE_CHECKING
from unittest.mock import MagicMock
from unittest.mock import patch
@@ -28,6 +29,9 @@ from paperless_testing.factories import TagFactory
from paperless_testing.factories import UserFactory
from paperless_testing.permissions import grant_object
if TYPE_CHECKING:
from paperless_testing.dirs import PaperlessDirs
@pytest.fixture
def mock_document():
@@ -630,10 +634,11 @@ class TestFulltextSimilarDocuments:
def fulltext_backend(
self,
mocker: pytest_mock.MockerFixture,
paperless_dirs: "PaperlessDirs",
) -> Generator[TantivyBackend, None, None]:
"""An in-memory Tantivy backend, wired up as the module-level
"""An on-disk Tantivy backend, wired up as the module-level
singleton _fulltext_similar_documents resolves via get_backend()."""
backend = TantivyBackend(path=None)
backend = TantivyBackend(path=paperless_dirs.index_dir)
backend.open()
mocker.patch("documents.search.get_backend", return_value=backend)
try: