Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

add endpoint search #224

Merged
merged 8 commits into from
May 3, 2021
Merged

add endpoint search #224

merged 8 commits into from
May 3, 2021

Conversation

remi-dupre
Copy link
Contributor

This mostly reuses code from instant_answer but I tried to change the API a bit to be more consistent with what we usually use internally between erdapfel and Idunn:

  • the answer format is simpler, either consisting of the same format as get_place (through key place) or the format of get_bbox_places (through key bbox_places)
  • we don't usually raise error codes 404 when we have an empty geocoder result, I tried to stick with this by returning an empty result

The only slight behavior change is that there is no truncating of the input query, maybe we should add a global parameter for this? I've also thought about skipping normalization since it would seem weird to "ignore or change part of what is in the search bar" but this seems like a free potential improvement of results?

Part of the logs may be weird with the current state of the branch, I'm still thinking there may be some global pattern that could be built since fetching the context from the logger is a common issue we have (eg. how we build extra infos in nlu_client or in this case understanding what endpoint is currently being used).

@amatissart amatissart changed the title add enpoint search add endpoint search Apr 27, 2021
idunn/api/instant_answer.py Outdated Show resolved Hide resolved
idunn/api/search.py Outdated Show resolved Hide resolved
idunn/api/search.py Outdated Show resolved Hide resolved
idunn/api/search.py Outdated Show resolved Hide resolved
idunn/api/instant_answer.py Outdated Show resolved Hide resolved
idunn/api/search.py Outdated Show resolved Hide resolved
Comment on lines 78 to 82
APIRoute(
"/search",
search,
response_model=IdunnAutocomplete,
),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with "/autocomplete", methods and response_model_exclude_unset should be defined too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and we should allow to provide extra parameters through POST queries 👍

"""
query.q = normalize(query.q)

if query.lang in nlu_allowed_languages:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if query.lang in nlu_allowed_languages:
if query.nlu and query.lang in nlu_allowed_languages:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also want to keep this option overridden by AUTOCOMPLETE_NLU_SHADOW_ENABLED, right?

Copy link
Contributor

@amatissart amatissart May 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this option has never been actually used, and is probably not very useful now that the nlu=true is used by the application in most cases.
So I think this flag AUTOCOMPLETE_NLU_SHADOW_ENABLED can be ignored for /search.

This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants