1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
import pytest
from lunr import lunr
@pytest.fixture
def documents():
return [
{
"id": "a",
"title": "Mr. Green kills Colonel Mustard",
"body": """Mr. Green killed Colonel Mustard in the study with the
candlestick. Mr. Green is not a very nice fellow.""",
"word_count": 19,
},
{
"id": "b",
"title": "Plumb waters plant",
"body": "Professor Plumb has a green plant in his study",
"word_count": 9,
},
{
"id": "c",
"title": "Scarlett helps Professor",
"body": """Miss Scarlett watered Professor Plumbs green plant
while he was away from his office last week.""",
"word_count": 16,
},
]
@pytest.fixture
def index(documents):
return lunr(ref="id", fields=("title", "body"), documents=documents)
|