-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Search: stop relying on the DB when indexing #10696
Changes from 14 commits
871bfe2
c6df611
912e457
bc8e4ff
f3853ea
4ef4105
3e2fd31
c5ec080
d57c481
022e7e9
19d7c5c
79e6141
2ccf0e8
8fdbc06
dd9e226
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -118,6 +118,28 @@ def public( | |||||||||||||||||||||||
def api(self, user=None): | ||||||||||||||||||||||||
return self.public(user, only_active=False) | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
def for_reindex(self): | ||||||||||||||||||||||||
""" | ||||||||||||||||||||||||
Get all versions that can be reindexed. | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
A version can be reindexed if: | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
- It's active and has been built at least once successfully. | ||||||||||||||||||||||||
Since that means that it has files to be indexed. | ||||||||||||||||||||||||
- Its project is not delisted or marked as spam. | ||||||||||||||||||||||||
""" | ||||||||||||||||||||||||
return ( | ||||||||||||||||||||||||
self.filter( | ||||||||||||||||||||||||
active=True, | ||||||||||||||||||||||||
built=True, | ||||||||||||||||||||||||
builds__state=BUILD_STATE_FINISHED, | ||||||||||||||||||||||||
builds__success=True, | ||||||||||||||||||||||||
) | ||||||||||||||||||||||||
.exclude(project__delisted=True) | ||||||||||||||||||||||||
.exclude(project__is_spam=True) | ||||||||||||||||||||||||
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. We should probably use a score here. Otherwise, only projects manually marked as spam will be excluded here. 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. This is a copy of readthedocs.org/readthedocs/search/documents.py Lines 120 to 130 in 53e21bb
probably better discuss this at #9899 |
||||||||||||||||||||||||
.distinct() | ||||||||||||||||||||||||
) | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
class VersionQuerySet(SettingsOverrideObject): | ||||||||||||||||||||||||
_default_class = VersionQuerySetBase | ||||||||||||||||||||||||
|
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.
We don't need to filter builds by internal/external here, if we are accessing the version, we already know if it's external o internal.