Skip to content

Commit ed84738

Browse files
committed
Analyze untagged pages on deploy
1 parent 12c2480 commit ed84738

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

app/jobs/pages/analyze_topics_job.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def prompt(page)
9797
- title: #{page.title}
9898
- description: #{page.description}
9999
- url: #{page.request_path}
100+
- current topics: #{page.topics.pluck(:name).join(", ")}
100101
</metadata>
101102
102103
4. Carefully read through the entire article:
@@ -105,7 +106,7 @@ def prompt(page)
105106
</article>
106107
107108
5. Pick 3 to 4 topics that would describe the article best.
108-
Prefer topics from the list of existing topics but you may create new ones if necessary.
109+
Prefer current topics for the article, if any, unless the topics no longer apply. Next, prefer topics from the list of existing topics but you may create new ones if necessary.
109110
110111
If you create a new topic, please ensure that it is relevant to the content of the article and match the recommended topics kind.
111112
Also for new topics please ensure they are not a synonym of an existing topic.

app/jobs/pages/batch_analyze_topics_job.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class BatchAnalyzeTopicsJob < ApplicationJob
33
queue_as :default
44

55
def perform
6-
Page.where(request_path: SitepressArticle.published.map(&:request_path)).find_each do |page|
6+
Page.where(request_path: SitepressArticle.published.map(&:request_path)).missing(:topics).find_each do |page|
77
Pages::AnalyzeTopicsJob.perform_later(page)
88
end
99
end

lib/tasks/deploy.rake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ namespace :deploy do
22
desc "Post deploy script"
33
task finish: :environment do
44
Pages::SearchIndexRefreshJob.perform_later
5+
Pages::BatchAnalyzeTopicsJob.perform_later
56
end
67
end

0 commit comments

Comments
 (0)