Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird results when searching on title with elasticsearch #1697

Open
desnoes opened this issue Nov 15, 2023 · 1 comment · May be fixed by #1796
Open

Weird results when searching on title with elasticsearch #1697

desnoes opened this issue Nov 15, 2023 · 1 comment · May be fixed by #1796
Assignees

Comments

@desnoes
Copy link

desnoes commented Nov 15, 2023

The search on title (home page and topoguide search) provides weird results. For instance, the exact word match is often not ranked first. This is probably due to an incorrect configuration of the elasticsearch query in the function get_text_query_on_title() (repository: \v6_api\c2corg_api\search). The results of the search on ngrams and draw are boosted at the expence of the word match. I don't see the reason why the search is done on ngrams and draw !?
One solution to be tested is to remove the fields in order to rely on a simple search on words. When the fuzziness parameter is set to 'auto', the search returns documents that contain terms similar to the search term (cf. https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-fuzzy-query.html).
I tried to install the API environment on my laptop (windows 10) but it failed. One could try the following modification of the function get_text_query_on_title(). If it works fine, a proper modification should remove the search_lang variable (impact on UI code to be scrutinized).

def get_text_query_on_title(search_term, search_lang=None):
return MultiMatch(
query=search_term,
fuzziness='auto',
operator='and'
)

@loicperrin
Copy link

Précisions fonctionnelles : https://forum.camptocamp.org/t/topoguide-recherche-par-chaine-de-caracteres-dans-le-titre-plus-assez-selective/319862/69

Quelques pistes :

@jphilou jphilou self-assigned this May 10, 2024
@jphilou jphilou linked a pull request May 10, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants