15 lines
473 B
Python
15 lines
473 B
Python
|
from meilisearch_python_sdk import AsyncClient as Client
|
||
|
from Christmas.config import ChristmasConfig
|
||
|
|
||
|
|
||
|
class Search:
|
||
|
def __init__(self):
|
||
|
self.config = ChristmasConfig()
|
||
|
|
||
|
async def connect(self):
|
||
|
self.client = Client(self.config.SEARCH_ENGINE["HOST"], self.config.SEARCH_ENGINE["KEY"])
|
||
|
self.index = self.client.index(self.config.SEARCH_ENGINE["INDEX"])
|
||
|
return self.index
|
||
|
|
||
|
async def close(self):
|
||
|
await self.client.aclose()
|