-
Notifications
You must be signed in to change notification settings - Fork 161
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
[ZEP-13] corrige le comportement d'Elasticsearch #4262
[ZEP-13] corrige le comportement d'Elasticsearch #4262
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C'est une super PR !
J'ai fait deux/trois retour sur des broutilles mais là c'est juste génial.
@@ -30,6 +30,11 @@ <h3 class="content-title" itemprop="itemListElement"> | |||
{% trans "Article publié" %} | |||
{% elif search_result.content_type == 'TUTORIAL' %} | |||
{% trans "Tutoriel publié" %} | |||
{% elif search_result.content_type == 'OPINION' %} | |||
{% trans "Opinion" %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Le mot de base, c'est "Billiet".
{% elif search_result.content_type == 'OPINION' %} | ||
{% trans "Opinion" %} | ||
{% if search_result.picked %} | ||
{% trans "mise en avant" %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Du coup "mis en avant".
index_manager.delete_document(instance) | ||
index_manager.refresh_index() | ||
|
||
if index_manager.index_exists: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vue la répétition de ces trois lignes, créer une méthode delete_and_refresh
peut être utile non?
|
||
|
||
def get_django_indexable_objects(): | ||
"""Return all indexable objects registered in Django""" | ||
return [model for model in apps.get_models() if issubclass(model, AbstractESDjangoIndexable)] | ||
|
||
|
||
class NeedIndex(Exception): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Juste ajouter une petite docstring pour faire beau dans la doc :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ;)
'filter': Match(content_type='ARTICLE'), | ||
'weight': settings.ZDS_APP['search']['boosts']['publishedcontent']['if_article'] | ||
}, | ||
{ | ||
'filter': Match(content_type='OPINION'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
j'aime ce boost
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<3
QA
Cette QA nécessite Elasticsearch (mais je rappelle que c'est très facile à installer ;) ).
make index-all
). Faire une recherche sur le mot "banane" et vérifier que la tribune apparait bien.make index-flagged
). Faire une recherche sur le mot "banane" et vérifier que tout y est (deux tribunes et un article). Vérifier que l'article apparait bien premier.make index-flagged
). Faire une recherche sur le mot "banane" et vérifier que "banane jaune" apparait bien en second.make index-flagged
). Faire une recherche sur le mot "banane" et vérifier que "banane jaune" apparait bien en troisième.