Skip to content

Commit

Permalink
Add simple taxonomy endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
akariv committed Apr 18, 2024
1 parent 233e247 commit ea2ffdf
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion server.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ def simple_cards():
size=30,
offset=0,
filters=filters,
extra='distinct-situations|distinct-responses',
score_threshold=0,
match_type='cross_fields',
match_operator='or',
Expand Down Expand Up @@ -358,6 +357,26 @@ def simple_cards():
ret['search_results'] = results
return ret

@app.route('/api/simple/taxonomy')
def simple_cards():
q = request.args.get('q', '')

es_client = current_app.config['ES_CLIENT']
ret = blueprint.controllers.search(
es_client, ['cards'], q,
size=1,
offset=0,
extra='distinct-situations|distinct-responses',
score_threshold=0,
match_type='cross_fields',
match_operator='or',
)
return dict(
situations=ret.get('situations', [])[:30],
responses=ret.get('responses', [])[:30],
)



@app.after_request
def add_header(response):
Expand Down

0 comments on commit ea2ffdf

Please sign in to comment.