diff --git a/backend/btrixcloud/crawlconfigs.py b/backend/btrixcloud/crawlconfigs.py index 1b1e236589..c0ab98f6ce 100644 --- a/backend/btrixcloud/crawlconfigs.py +++ b/backend/btrixcloud/crawlconfigs.py @@ -608,9 +608,13 @@ async def get_crawl_configs( if sort_by == "name": sort_query["firstSeed"] = sort_direction - # modified for last* fields in case crawl hasn't been run yet + # Special case for last-* fields in case crawl is running elif sort_by in ("lastRun", "lastCrawlTime", "lastCrawlStartTime"): - sort_query["modified"] = sort_direction + sort_query = { + "isCrawlRunning": sort_direction, + sort_by: sort_direction, + "modified": sort_direction, + } aggregate.extend([{"$sort": sort_query}])