Compare commits
No commits in common. "4561b1c1a3a98ff6c3384694cbc33ee8cc30308a" and "2c242aac2950025cfe010e382dbd2ec0e06b2a0b" have entirely different histories.
4561b1c1a3
...
2c242aac29
@ -236,7 +236,7 @@ def flatten(tables):
|
|||||||
|
|
||||||
# if the item has at least two commas in it, split it
|
# if the item has at least two commas in it, split it
|
||||||
if tables[table][key].count(',') >= 2:
|
if tables[table][key].count(',') >= 2:
|
||||||
out[fullkeyname] = list(map(lambda x: x.strip(), tables[table][key].split(",")))
|
out[fullkeyname] = map(lambda x: x.strip(), tables[table][key].split(","))
|
||||||
print("\"" + keyname + "\":", "\"" + str(out[fullkeyname]) + "\",")
|
print("\"" + keyname + "\":", "\"" + str(out[fullkeyname]) + "\",")
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""Interactions with the Meilisearch API for adding and searching cables."""
|
"""Interactions with the Meilisearch API for adding and searching cables."""
|
||||||
from meilisearch import Client
|
from meilisearch import Client
|
||||||
from meilisearch.task import TaskInfo
|
from meilisearch.task import TaskInfo
|
||||||
from meilisearch.errors import MeilisearchApiError
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
DEFAULT_URL = "http://localhost:7700"
|
DEFAULT_URL = "http://localhost:7700"
|
||||||
@ -25,9 +24,7 @@ class JukeboxSearch:
|
|||||||
self.index = index or DEFAULT_INDEX
|
self.index = index or DEFAULT_INDEX
|
||||||
self.client = Client(url, api_key)
|
self.client = Client(url, api_key)
|
||||||
# create the index if it does not exist already
|
# create the index if it does not exist already
|
||||||
try:
|
if self.client.get_index(self.index) is None:
|
||||||
self.client.get_index(self.index)
|
|
||||||
except MeilisearchApiError as _:
|
|
||||||
self.client.create_index(self.index)
|
self.client.create_index(self.index)
|
||||||
|
|
||||||
def add_document(self, document: dict) -> TaskInfo:
|
def add_document(self, document: dict) -> TaskInfo:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user