From fd17ce652ba30e24a5f39dbda449c2101d1cba59 Mon Sep 17 00:00:00 2001 From: Taka Date: Wed, 26 Feb 2020 08:02:06 +0000 Subject: [PATCH] Added content to the search index in reverse chronological order. --- asl_articles/search.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/asl_articles/search.py b/asl_articles/search.py index 011d962..fd88181 100644 --- a/asl_articles/search.py +++ b/asl_articles/search.py @@ -388,15 +388,17 @@ def init_search( session, logger ): ) # load the searchable content + # NOTE: We insert content in reverse chronological order to get more recent + # content to appear before other equally-ranked content. logger.debug( "Loading the search index..." ) logger.debug( "- Loading publishers." ) - for publ in session.query( Publisher ): + for publ in session.query( Publisher ).order_by( Publisher.time_created.desc() ): add_or_update_publisher( dbconn, publ ) logger.debug( "- Loading publications." ) - for pub in session.query( Publication ): + for pub in session.query( Publication ).order_by( Publication.time_created.desc() ): add_or_update_publication( dbconn, pub ) logger.debug( "- Loading articles." ) - for article in session.query( Article ): + for article in session.query( Article ).order_by( Article.time_created.desc() ): add_or_update_article( dbconn, article ) # load the search aliases