Error when adding 3 or 4 filters to Knowledge Explorer plugin

Bug Report:
If you click more than 3 or 4 filters in knowledge explorer it kind of explodes and kills your session.
See Gif Below

Generates this Error

Recent
Message
ActiveRecord::StatementInvalid (PG::DuplicateAlias: ERROR: table name “t2” specified more than once
)
app/controllers/application_controller.rb:354:in block in with_resolved_locale' app/controllers/application_controller.rb:354:in with_resolved_locale’
lib/middleware/omniauth_bypass_middleware.rb:68:in call' lib/content_security_policy/middleware.rb:12:in call’
lib/middleware/anonymous_cache.rb:354:in call' config/initializers/100-quiet_logger.rb:23:in call’
config/initializers/100-silence_logger.rb:31:in call' lib/middleware/enforce_hostname.rb:22:in call’
lib/middleware/request_tracker.rb:176:in call' Backtrace rack-mini-profiler (2.1.0) lib/patches/db/pg.rb:72:in exec_params’
rack-mini-profiler (2.1.0) lib/patches/db/pg.rb:72:in exec_params' activerecord (6.0.3.3) lib/active_record/connection_adapters/postgresql_adapter.rb:675:in block (2 levels) in exec_no_cache’
activesupport (6.0.3.3) lib/active_support/dependencies/interlock.rb:48:in block in permit_concurrent_loads' activesupport (6.0.3.3) lib/active_support/concurrency/share_lock.rb:187:in yield_shares’
activesupport (6.0.3.3) lib/active_support/dependencies/interlock.rb:47:in permit_concurrent_loads' activerecord (6.0.3.3) lib/active_record/connection_adapters/postgresql_adapter.rb:674:in block in exec_no_cache’
activerecord (6.0.3.3) lib/active_record/connection_adapters/abstract_adapter.rb:722:in block (2 levels) in log' activesupport (6.0.3.3) lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in block (2 levels) in synchronize’
activesupport (6.0.3.3) lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in handle_interrupt' activesupport (6.0.3.3) lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in block in synchronize’
activesupport (6.0.3.3) lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in handle_interrupt' activesupport (6.0.3.3) lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in synchronize’
activerecord (6.0.3.3) lib/active_record/connection_adapters/abstract_adapter.rb:721:in block in log' activesupport (6.0.3.3) lib/active_support/notifications/instrumenter.rb:24:in instrument’
activerecord (6.0.3.3) lib/active_record/connection_adapters/abstract_adapter.rb:712:in log' activerecord (6.0.3.3) lib/active_record/connection_adapters/postgresql_adapter.rb:673:in exec_no_cache’
activerecord (6.0.3.3) lib/active_record/connection_adapters/postgresql_adapter.rb:654:in execute_and_clear' activerecord (6.0.3.3) lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in exec_query’
activerecord (6.0.3.3) lib/active_record/connection_adapters/abstract/database_statements.rb:489:in select' activerecord (6.0.3.3) lib/active_record/connection_adapters/abstract/database_statements.rb:70:in select_all’
activerecord (6.0.3.3) lib/active_record/connection_adapters/abstract/query_cache.rb:105:in block in select_all' activerecord (6.0.3.3) lib/active_record/connection_adapters/abstract/query_cache.rb:122:in block in cache_sql’
activesupport (6.0.3.3) lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in block (2 levels) in synchronize' activesupport (6.0.3.3) lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in handle_interrupt’
activesupport (6.0.3.3) lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in block in synchronize' activesupport (6.0.3.3) lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in handle_interrupt’
activesupport (6.0.3.3) lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in synchronize' activerecord (6.0.3.3) lib/active_record/connection_adapters/abstract/query_cache.rb:113:in cache_sql’
activerecord (6.0.3.3) lib/active_record/connection_adapters/abstract/query_cache.rb:105:in select_all' activerecord (6.0.3.3) lib/active_record/relation/calculations.rb:346:in block in execute_grouped_calculation’
activerecord (6.0.3.3) lib/active_record/relation.rb:839:in skip_query_cache_if_necessary' activerecord (6.0.3.3) lib/active_record/relation/calculations.rb:346:in execute_grouped_calculation’
activerecord (6.0.3.3) lib/active_record/relation/calculations.rb:250:in perform_calculation' activerecord (6.0.3.3) lib/active_record/relation/calculations.rb:142:in calculate’
activerecord (6.0.3.3) lib/active_record/relation/calculations.rb:140:in calculate' activerecord (6.0.3.3) lib/active_record/relation/calculations.rb:49:in count’
plugins/discourse-knowledge-explorer/lib/knowledge_explorer/query.rb:97:in list' plugins/discourse-knowledge-explorer/app/controllers/knowledge_explorer/knowledge_explorer_controller.rb:21:in index’
actionpack (6.0.3.3) lib/action_controller/metal/basic_implicit_render.rb:6:in send_action' actionpack (6.0.3.3) lib/abstract_controller/base.rb:195:in process_action’
actionpack (6.0.3.3) lib/action_controller/metal/rendering.rb:30:in process_action' actionpack (6.0.3.3) lib/abstract_controller/callbacks.rb:42:in block in process_action’
activesupport (6.0.3.3) lib/active_support/callbacks.rb:112:in block in run_callbacks' app/controllers/application_controller.rb:354:in block in with_resolved_locale’
i18n (1.8.5) lib/i18n.rb:313:in with_locale' app/controllers/application_controller.rb:354:in with_resolved_locale’
activesupport (6.0.3.3) lib/active_support/callbacks.rb:121:in block in run_callbacks' activesupport (6.0.3.3) lib/active_support/callbacks.rb:139:in run_callbacks’
actionpack (6.0.3.3) lib/abstract_controller/callbacks.rb:41:in process_action' actionpack (6.0.3.3) lib/action_controller/metal/rescue.rb:22:in process_action’
actionpack (6.0.3.3) lib/action_controller/metal/instrumentation.rb:33:in block in process_action' activesupport (6.0.3.3) lib/active_support/notifications.rb:180:in block in instrument’
activesupport (6.0.3.3) lib/active_support/notifications/instrumenter.rb:24:in instrument' activesupport (6.0.3.3) lib/active_support/notifications.rb:180:in instrument’
actionpack (6.0.3.3) lib/action_controller/metal/instrumentation.rb:32:in process_action' actionpack (6.0.3.3) lib/action_controller/metal/params_wrapper.rb:245:in process_action’
activerecord (6.0.3.3) lib/active_record/railties/controller_runtime.rb:27:in process_action' actionpack (6.0.3.3) lib/abstract_controller/base.rb:136:in process’
actionview (6.0.3.3) lib/action_view/rendering.rb:39:in process' rack-mini-profiler (2.1.0) lib/mini_profiler/profiling_methods.rb:104:in block in profile_method’
actionpack (6.0.3.3) lib/action_controller/metal.rb:190:in dispatch' actionpack (6.0.3.3) lib/action_controller/metal.rb:254:in dispatch’
actionpack (6.0.3.3) lib/action_dispatch/routing/route_set.rb:50:in dispatch' actionpack (6.0.3.3) lib/action_dispatch/routing/route_set.rb:33:in serve’
actionpack (6.0.3.3) lib/action_dispatch/routing/mapper.rb:18:in block in <class:Constraints>' actionpack (6.0.3.3) lib/action_dispatch/routing/mapper.rb:48:in serve’
actionpack (6.0.3.3) lib/action_dispatch/journey/router.rb:49:in block in serve' actionpack (6.0.3.3) lib/action_dispatch/journey/router.rb:32:in each’
actionpack (6.0.3.3) lib/action_dispatch/journey/router.rb:32:in serve' actionpack (6.0.3.3) lib/action_dispatch/routing/route_set.rb:834:in call’
railties (6.0.3.3) lib/rails/engine.rb:527:in call' railties (6.0.3.3) lib/rails/railtie.rb:190:in public_send’
railties (6.0.3.3) lib/rails/railtie.rb:190:in method_missing' actionpack (6.0.3.3) lib/action_dispatch/routing/mapper.rb:19:in block in class:Constraints
actionpack (6.0.3.3) lib/action_dispatch/routing/mapper.rb:48:in serve' actionpack (6.0.3.3) lib/action_dispatch/journey/router.rb:49:in block in serve’
actionpack (6.0.3.3) lib/action_dispatch/journey/router.rb:32:in each' actionpack (6.0.3.3) lib/action_dispatch/journey/router.rb:32:in serve’
actionpack (6.0.3.3) lib/action_dispatch/routing/route_set.rb:834:in call' lib/middleware/omniauth_bypass_middleware.rb:68:in call’
rack (2.2.3) lib/rack/tempfile_reaper.rb:15:in call' rack (2.2.3) lib/rack/conditional_get.rb:27:in call’
rack (2.2.3) lib/rack/head.rb:12:in call' lib/content_security_policy/middleware.rb:12:in call’
lib/middleware/anonymous_cache.rb:354:in call' rack (2.2.3) lib/rack/session/abstract/id.rb:266:in context’
rack (2.2.3) lib/rack/session/abstract/id.rb:260:in call' actionpack (6.0.3.3) lib/action_dispatch/middleware/cookies.rb:648:in call’
actionpack (6.0.3.3) lib/action_dispatch/middleware/callbacks.rb:27:in block in call' activesupport (6.0.3.3) lib/active_support/callbacks.rb:101:in run_callbacks’
actionpack (6.0.3.3) lib/action_dispatch/middleware/callbacks.rb:26:in call' actionpack (6.0.3.3) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in call’
actionpack (6.0.3.3) lib/action_dispatch/middleware/debug_exceptions.rb:32:in call' actionpack (6.0.3.3) lib/action_dispatch/middleware/show_exceptions.rb:33:in call’
logster (2.9.4) lib/logster/middleware/reporter.rb:43:in call' railties (6.0.3.3) lib/rails/rack/logger.rb:37:in call_app’
railties (6.0.3.3) lib/rails/rack/logger.rb:28:in call' config/initializers/100-quiet_logger.rb:23:in call’
config/initializers/100-silence_logger.rb:31:in call' actionpack (6.0.3.3) lib/action_dispatch/middleware/remote_ip.rb:81:in call’
actionpack (6.0.3.3) lib/action_dispatch/middleware/request_id.rb:27:in call' lib/middleware/enforce_hostname.rb:22:in call’
rack (2.2.3) lib/rack/method_override.rb:24:in call' actionpack (6.0.3.3) lib/action_dispatch/middleware/executor.rb:14:in call’
rack (2.2.3) lib/rack/sendfile.rb:110:in `call’
actionpack (6.0.3.3) lib/action_dispatch/middleware/host_authorization.rb
Env
hostname doclx-app
process_id 5275
application_version e54c8a998bae0dd2ec025a8da3281e23523f9228
HTTP_HOST
REQUEST_URI /docs.json?category=5&tags=apinvhed|ap-invoice-entry|bpm-data-form
REQUEST_METHOD GET
HTTP_USER_AGENT Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36
HTTP_ACCEPT application/json, text/javascript, /; q=0.01
HTTP_REFERER https:///docs?category=5&tags=apinvhed%7Cap-invoice-entry
HTTP_X_FORWARDED_FOR 10.81.20.163
HTTP_X_REAL_IP 10.81.20.163
username jcgomez
params
category 5
tags apinvhed|ap-invoice-entry|bpm-data-form
Solve Remove Protect Copy

1 Like

Thanks for the report! We can reproduce this. I’ll have a look into it.

3 Likes

PR is up for a fix here! Will merge as soon as I get a second set of eyes on it.

https://github.com/discourse/discourse-knowledge-explorer/pull/12

3 Likes

Awesome thank you @justin!!!

1 Like

Fixed here!

https://github.com/discourse/discourse-knowledge-explorer/commit/795935515994be42b1a0d0257dd0fcb8fb1e3913

3 Likes