-
Notifications
You must be signed in to change notification settings - Fork 165
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
Met à jour les poids de recherche #6685
Open
Arnaud-D
wants to merge
1
commit into
zestedesavoir:dev
Choose a base branch
from
Arnaud-D:fix-weight-search
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1135,29 +1135,27 @@ def get_document_source(self, excluded_fields=[]): | |
if versioned.has_extracts(): | ||
data["text"] = clean_html(versioned.get_content_online()) | ||
|
||
is_medium_big_tutorial = versioned.has_sub_containers() | ||
data["weight"] = self._compute_search_weight(is_medium_big_tutorial) | ||
is_multipage = versioned.has_sub_containers() | ||
data["weight"] = self._get_search_weight(is_multipage) | ||
|
||
return data | ||
|
||
def _compute_search_weight(self, is_medium_big_tutorial: bool): | ||
def _get_search_weight(self, is_multipage: bool): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Je n'ai rien contre renommer cette fonction, mais dans ce cas, par cohérence, il faut également renommer les autres occurrences de cette fonction ( |
||
""" | ||
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. | ||
Calculate the weight used to sort search results. | ||
We make a difference between validated content (either single or multipage) and content published freely | ||
(picked for the front page or not). | ||
""" | ||
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"] | ||
if self.content.requires_validation(): | ||
if is_multipage: | ||
return weights["if_validated_and_multipage"] | ||
else: | ||
return weights["if_tutorial"] | ||
return weights["if_validated"] | ||
else: | ||
assert self.content_type == "OPINION" | ||
if self.content.sha_picked is not None: | ||
if self.content.is_picked(): | ||
return weights["if_opinion"] | ||
else: | ||
return weights["if_opinion_not_picked"] | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.
Heu non, ça n'est pas résolu, la typo est toujours là :)
Et en relisant, je me rends compte que je proposerais même :
(sinon ça peut laisser penser que ça ne concerne toujours que les tutoriels)