Compare commits
No commits in common. "8e775c189fe48fb1b638c91751d307ff07e569bf" and "7bdbbf10b208364f54006ceeae42e9f7b0ad6202" have entirely different histories.
8e775c189f
...
7bdbbf10b2
|
@ -16,7 +16,6 @@ def meili_api(method, route, json=None, params=None, parse_json=True):
|
||||||
if parse_json:
|
if parse_json:
|
||||||
return r.json()
|
return r.json()
|
||||||
else:
|
else:
|
||||||
r.encoding = 'utf-8'
|
|
||||||
return r.text
|
return r.text
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise
|
raise
|
||||||
|
@ -53,7 +52,7 @@ def put_story(story):
|
||||||
|
|
||||||
def search(q):
|
def search(q):
|
||||||
if not SEARCH_ENABLED: return []
|
if not SEARCH_ENABLED: return []
|
||||||
params = dict(q=q, limit=100)
|
params = dict(q=q, limit=250)
|
||||||
r = meili_api(requests.get, 'indexes/qotnews/search', params=params, parse_json=False)
|
r = meili_api(requests.get, 'indexes/qotnews/search', params=params, parse_json=False)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
import time
|
|
||||||
import requests
|
|
||||||
|
|
||||||
def test_search_api():
|
|
||||||
num_tests = 100
|
|
||||||
total_time = 0
|
|
||||||
|
|
||||||
for i in range(num_tests):
|
|
||||||
start = time.time()
|
|
||||||
|
|
||||||
res = requests.get('http://127.0.0.1:33842/api/search?q=iphone')
|
|
||||||
res.raise_for_status()
|
|
||||||
|
|
||||||
duration = time.time() - start
|
|
||||||
total_time += duration
|
|
||||||
|
|
||||||
avg_time = total_time / num_tests
|
|
||||||
|
|
||||||
print('Average search time:', avg_time)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
test_search_api()
|
|
Loading…
Reference in New Issue
Block a user