mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-05-01 12:29:25 +00:00
0fb57205db
Dual-field approach for notes/custom_fields: JSON fields support structured queries (notes.user:alice, custom_fields.name:invoice); companion text fields (note, custom_field) carry content for default full-text search — tantivy-py 0.25 parse_query rejects dotted paths in default_field_names. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
31 lines
675 B
Python
31 lines
675 B
Python
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
import pytest
|
|
|
|
from documents.search._backend import TantivyBackend
|
|
from documents.search._backend import reset_backend
|
|
|
|
if TYPE_CHECKING:
|
|
from collections.abc import Generator
|
|
from pathlib import Path
|
|
|
|
from pytest_django.fixtures import SettingsWrapper
|
|
|
|
|
|
@pytest.fixture
|
|
def index_dir(tmp_path: Path, settings: SettingsWrapper) -> Path:
|
|
path = tmp_path / "index"
|
|
path.mkdir()
|
|
settings.INDEX_DIR = path
|
|
return path
|
|
|
|
|
|
@pytest.fixture
|
|
def backend(index_dir: Path) -> Generator[TantivyBackend, None, None]:
|
|
b = TantivyBackend()
|
|
with b:
|
|
yield b
|
|
reset_backend()
|