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

Le calcul des poids des contenus indexés ne sait pas que tous les contenus peuvent avoir tous les formats #6680

Open
philippemilink opened this issue Oct 30, 2024 · 0 comments · May be fixed by #6685
Labels
C-Search Concerne la recherche (et Typesense) S-BUG Corrige un problème

Comments

@philippemilink
Copy link
Member

Suite à la fusion de #6550 qui permet d'avoir des articles et des billets de n'importe quelle taille, on a oublié de mettre à jour la fonction qui calcule les poids des contenus lors d'une recherche :

def _compute_search_weight(self, is_medium_big_tutorial: bool):
"""
This function calculates a weight for publishedcontent in order to sort them according to different boosts.
There is a boost according to the type of content (article, opinion, tutorial),
if it is a big tutorial or if it is picked.
"""
weights = settings.ZDS_APP["search"]["boosts"]["publishedcontent"]
if self.content_type == "ARTICLE":
return weights["if_article"]
elif self.content_type == "TUTORIAL":
if is_medium_big_tutorial:
return weights["if_medium_or_big_tutorial"]
else:
return weights["if_tutorial"]
else:
assert self.content_type == "OPINION"
if self.content.sha_picked is not None:
return weights["if_opinion"]
else:
return weights["if_opinion_not_picked"]

Il est sans doute possible maintenant de factoriser cette fonction, ainsi que les paramètres qui définissent les poids.

@philippemilink philippemilink added S-BUG Corrige un problème C-Search Concerne la recherche (et Typesense) labels Oct 30, 2024
@Arnaud-D Arnaud-D moved this from À trier to À traiter in Suivi des tickets Oct 31, 2024
@Arnaud-D Arnaud-D linked a pull request Nov 6, 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
C-Search Concerne la recherche (et Typesense) S-BUG Corrige un problème
Projects
Status: À traiter
Development

Successfully merging a pull request may close this issue.

1 participant