Fixes #5887 - Knowledge Base search extremely slow despite fast Elasticsearch response

This commit is contained in:
Mantas Masalskis 2025-12-16 17:58:09 +02:00
parent e0136e4313
commit b465e615b2
3 changed files with 23 additions and 1 deletions

View file

@ -58,7 +58,7 @@ class App.KnowledgeBaseSearchFieldWidget extends App.Controller
@delay( =>
@makeRequest(query)
, 100, 'makeRequest')
, 500, 'makeRequest')
data: (query) ->
attrs = {

View file

@ -78,6 +78,11 @@ class InitializeKnowledgeBase < ActiveRecord::Migration[5.0]
t.references :published_by, foreign_key: { to_table: :users }
t.timestamps limit: 3, null: false
# Covers published (published+internal) and internal (published+internal+archived) scopes
t.index %i[published_at archived_at internal_at], name: 'index_kb_answers_publishing_dates'
# Covers archived scope
t.index [:archived_at]
end
create_table :knowledge_base_answer_translation_contents do |t| # rubocop:disable Rails/CreateTableWithTimestamps

View file

@ -0,0 +1,17 @@
# Copyright (C) 2012-2025 Zammad Foundation, https://zammad-foundation.org/
class KbAddDatesIndex < ActiveRecord::Migration[7.0]
def change
# return if it's a new setup
return if !Setting.exists?(name: 'system_init_done')
change_table :knowledge_base_answers do |t|
# Covers published (published+internal) and internal (published+internal+archived) scopes
t.index %i[published_at archived_at internal_at], name: 'index_kb_answers_publishing_dates'
# Covers archived scope
t.index [:archived_at]
end
KnowledgeBase::Answer.reset_column_information
end
end