File tree Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change 3636 START_SEL ,
3737 STOP_SEL ,
3838 TSEARCH_CONFIG_LANGUAGES ,
39- get_document_search_vector ,
4039 DocumentationCategory ,
40+ get_document_search_vector ,
4141)
4242
4343
@@ -230,12 +230,15 @@ def _sync_blog_to_db(self):
230230 Sync the blog entries into search based on the release documents
231231 support end date.
232232 """
233- if self .lang != "en" or not self .release .eol_date :
233+ if self .lang != "en" or ( self . release and not self .release .eol_date ) :
234234 # The blog is only written in English, and we need to know
235235 # the release's support end to know when to stop considering
236236 # blog posts relevant.
237+ # For dev releases, the DocumentRelease.release will not be
238+ # set.
237239 return
238- entries = Entry .objects .published (self .release .eol_date ).searchable ()
240+ as_of = self .release .eol_date if self .release else None
241+ entries = Entry .objects .published (as_of ).searchable ()
239242 Document .objects .bulk_create (
240243 [
241244 Document (
Original file line number Diff line number Diff line change @@ -494,6 +494,28 @@ def test_sync_to_db(self):
494494 transform = attrgetter ("path" ),
495495 )
496496
497+ def test_sync_to_db_no_release (self ):
498+ self .release .release = None
499+ self .release .sync_to_db (
500+ [
501+ {
502+ "body" : "This is the body" ,
503+ "title" : "This is the title" ,
504+ "current_page_name" : "foo/bar" ,
505+ }
506+ ]
507+ )
508+ self .assertQuerySetEqual (
509+ self .release .documents .all (),
510+ [
511+ "foo/bar" ,
512+ reverse ("community-ecosystem" , host = "www" ),
513+ self .entry .get_absolute_url (),
514+ ],
515+ ordered = False ,
516+ transform = attrgetter ("path" ),
517+ )
518+
497519 def test_blog_to_db_skip_non_english (self ):
498520 """
499521 Releases must be English to include the blog and website results in search.
You can’t perform that action at this time.
0 commit comments