DEV: Add apply_modifier for SemanticTopicQuery topics list (#830)
This commit is contained in:
committed by
GitHub
parent
c5b323fc07
commit
52d90cf1bc
@@ -16,12 +16,12 @@ class DiscourseAi::Embeddings::SemanticTopicQuery < TopicQuery
|
||||
create_list(:semantic_related, query_opts) do |topics|
|
||||
candidate_ids = DiscourseAi::Embeddings::SemanticRelated.new.related_topic_ids_for(topic)
|
||||
|
||||
list =
|
||||
topics
|
||||
.where.not(id: topic.id)
|
||||
.where(id: candidate_ids)
|
||||
.order("array_position(ARRAY#{candidate_ids}, topics.id)") # array_position forces the order of the topics to be preserved
|
||||
list = topics.where.not(id: topic.id).where(id: candidate_ids)
|
||||
|
||||
list = DiscoursePluginRegistry.apply_modifier(:semantic_related_topics_query, list)
|
||||
|
||||
# array_position forces the order of the topics to be preserved
|
||||
list = list.order("array_position(ARRAY#{candidate_ids}, topics.id)")
|
||||
list = remove_muted(list, @user, query_opts)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user