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

Les majuscules impactent les résultats de recherche #4223

Closed
pierre-24 opened this issue Feb 20, 2017 · 3 comments
Closed

Les majuscules impactent les résultats de recherche #4223

pierre-24 opened this issue Feb 20, 2017 · 3 comments
Assignees
Labels
C-Back Concerne le back-end Django S-BUG Corrige un problème

Comments

@pierre-24
Copy link
Member

pierre-24 commented Feb 20, 2017

Du forum:

Par exemple, je cherche 'Nazara', je trouve le bon résultat, pas de problème mais quand je tape 'nazara', je trouve les même résultats mais rangés très différemment, je comprends pas trop la logique, c'est sensible à la casse mais j'ai pourtant les mêmes résultats que quand j'écris avec une majuscule sauf que c'est pas ordonné pareil. ^^


Et en effet : nazara vs Nazara.

Ce qui est bizarre, parce que Elasticsearch est configuré chez nous pour être case insensitive. De plus, Elasticsearch comprend à priori la même chose:

tokens utilisés par Elasticsearch (à droite) à partir de "Nazara" et "nazara"

@pierre-24 pierre-24 added C-Back Concerne le back-end Django S-BUG Corrige un problème labels Feb 20, 2017
@pierre-24 pierre-24 self-assigned this Feb 20, 2017
@pierre-24
Copy link
Member Author

pierre-24 commented Feb 20, 2017

Du coup, petit devoir pour @vhf : exécuter ces deux commandes et me donner les retours:

curl "localhost:9200/zds_search/_search?explain&pretty" -d '{"from":0, "size": 10, "query": {"function_score": {"query": {"bool": {"should": [{"bool": {"must": [{"match": {"_type": "chapter"}}, {"multi_match": {"fields": ["title", "text"], "query": "nazara"}}]}}, {"function_score": {"query": {"bool": {"must": [{"match": {"_type": "publishedcontent"}}, {"multi_match": {"fields": ["title", "description", "categories", "tags", "text"], "query": "nazara"}}]}}, "functions": [{"filter": {"match": {"content_type": "TUTORIAL"}}, "weight": 1.0}, {"filter": {"match": {"content_type": "ARTICLE"}}, "weight": 1.0}], "boost_mode": "multiply"}}, {"function_score": {"query": {"bool": {"must": [{"match": {"_type": "topic"}}, {"terms": {"forum_pk": [1, 2, 3, 16, 17, 18, 19, 20, 21, 22, 23, 24]}}, {"multi_match": {"fields": ["title", "subtitle", "tags"], "query": "nazara"}}]}}, "functions": [{"filter": {"match": {"is_solved": true}}, "weight": 1.1}, {"filter": {"match": {"is_sticky": true}}, "weight": 1.2}, {"filter": {"match": {"is_locked": true}}, "weight": 0.1}], "boost_mode": "multiply"}}, {"function_score": {"query": {"bool": {"must": [{"match": {"_type": "post"}}, {"terms": {"forum_pk": [1, 2, 3, 16, 17, 18, 19, 20, 21, 22, 23, 24]}}, {"term": {"is_visible": true}}, {"multi_match": {"fields": ["text_html"], "query": "nazara"}}]}}, "functions": [{"filter": {"match": {"position": 1}}, "weight": 1.2}, {"filter": {"match": {"is_useful": true}}, "weight": 1.5}, {"filter": {"range": {"like_dislike_ratio": {"gt": 1}}}, "weight": 1.05}, {"filter": {"range": {"like_dislike_ratio": {"lt": 1}}}, "weight": 0.95}], "boost_mode": "multiply"}}]}}, "functions": [{"filter": {"match": {"_type": "topic"}}, "weight": 2.0}, {"filter": {"match": {"_type": "publishedcontent"}}, "weight": 3.0}, {"filter": {"match": {"_type": "post"}}, "weight": 1.0}, {"filter": {"match": {"_type": "chapter"}}, "weight": 1.5}], "boost_mode": "multiply"}}}'
curl "localhost:9200/zds_search/_search?explain&pretty" -d '{"from":0, "size": 10, "query": {"function_score": {"query": {"bool": {"should": [{"bool": {"must": [{"match": {"_type": "chapter"}}, {"multi_match": {"fields": ["title", "text"], "query": "Nazara"}}]}}, {"function_score": {"query": {"bool": {"must": [{"match": {"_type": "publishedcontent"}}, {"multi_match": {"fields": ["title", "description", "categories", "tags", "text"], "query": "Nazara"}}]}}, "functions": [{"filter": {"match": {"content_type": "TUTORIAL"}}, "weight": 1.0}, {"filter": {"match": {"content_type": "ARTICLE"}}, "weight": 1.0}], "boost_mode": "multiply"}}, {"function_score": {"query": {"bool": {"must": [{"match": {"_type": "topic"}}, {"terms": {"forum_pk": [1, 2, 3, 16, 17, 18, 19, 20, 21, 22, 23, 24]}}, {"multi_match": {"fields": ["title", "subtitle", "tags"], "query": "Nazara"}}]}}, "functions": [{"filter": {"match": {"is_solved": true}}, "weight": 1.1}, {"filter": {"match": {"is_sticky": true}}, "weight": 1.2}, {"filter": {"match": {"is_locked": true}}, "weight": 0.1}], "boost_mode": "multiply"}}, {"function_score": {"query": {"bool": {"must": [{"match": {"_type": "post"}}, {"terms": {"forum_pk": [1, 2, 3, 16, 17, 18, 19, 20, 21, 22, 23, 24]}}, {"term": {"is_visible": true}}, {"multi_match": {"fields": ["text_html"], "query": "Nazara"}}]}}, "functions": [{"filter": {"match": {"position": 1}}, "weight": 1.2}, {"filter": {"match": {"is_useful": true}}, "weight": 1.5}, {"filter": {"range": {"like_dislike_ratio": {"gt": 1}}}, "weight": 1.05}, {"filter": {"range": {"like_dislike_ratio": {"lt": 1}}}, "weight": 0.95}], "boost_mode": "multiply"}}]}}, "functions": [{"filter": {"match": {"_type": "topic"}}, "weight": 2.0}, {"filter": {"match": {"_type": "publishedcontent"}}, "weight": 3.0}, {"filter": {"match": {"_type": "post"}}, "weight": 1.0}, {"filter": {"match": {"_type": "chapter"}}, "weight": 1.5}], "boost_mode": "multiply"}}}'

Bon, ça va générer BEAUCOUP de texte, donc on fait comme la fois passée, utilise des gists. D'avance merci :)

Note pour le futur: la liste des forums en local et en live ne matchent évidement pas. Pas oublier de la changer par [1, 2, 3, 16, 17, 18, 19, 20, 21, 22, 23, 24].

@pierre-24
Copy link
Member Author

Trouvé : https://www.elastic.co/guide/en/elasticsearch/reference/5.2/keyword.html#keyword

They are typically used for filtering (Find me all blog posts where status is published), for sorting, and for aggregations. Keyword fields are only searchable by their exact value.

@gllmc
Copy link
Member

gllmc commented Feb 25, 2017

Est-ce qu'on n'a pas oublié de fermer ?

@vhf vhf closed this as completed Feb 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Back Concerne le back-end Django S-BUG Corrige un problème
Projects
None yet
Development

No branches or pull requests

3 participants