Bug #4443

Auto-completion of organization search fails as sort column is not in result set

Added by Thomas McKay over 3 years ago. Updated over 3 years ago.

Status:Closed
Priority:Normal
Assigned To:Amos Benari
Category:Search
Target version:Sprint 21
Difficulty: Bugzilla link:
Found in release: Pull request:
Story points-
Velocity based estimate-
Release1.5.0Release relationshipAuto

Description

'name' is still available in the UI autocomplete but triggers errors when trying to display available values. 'title' does work


Related issues

Related to Foreman - Bug #4486: Cannot search for an organization by name, only label Closed 02/27/2014
Related to Foreman - Bug #4789: search auto completer on progress many times fail Duplicate 03/24/2014

History

#1 Updated by Dominic Cleal over 3 years ago

  • Subject changed from organization no searchable by name to organization not searchable by name
  • Category changed from Query interface to Search
  • Status changed from New to Need more information

Please provide the errors?

#2 Updated by Thomas McKay over 3 years ago

Started GET "/organizations/auto_complete_search?search=name+%3D+" for 127.0.0.1 at 2014-02-25 08:05:19 -0500
Processing by OrganizationsController#auto_complete_search as JSON
  Parameters: {"search"=>"name = "}
  User Load (0.4ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1  [["id", 1]]
Setting current user thread-local variable to Admin User
   (0.3ms)  SELECT COUNT(*) FROM "taxonomies" WHERE "taxonomies"."type" IN ('Organization')
  Organization Load (0.5ms)  SELECT "taxonomies".* FROM "taxonomies" WHERE "taxonomies"."type" IN ('Organization') AND "taxonomies"."id" = 10 ORDER BY title LIMIT 1
Setting current organization thread-local variable to Mega Corporation
   (0.3ms)  SELECT COUNT(*) FROM "taxonomies" WHERE "taxonomies"."type" IN ('Location')
Setting current location thread-local variable to none
  Organization Load (0.8ms)  SELECT DISTINCT "taxonomies".name FROM "taxonomies" WHERE "taxonomies"."type" IN ('Organization') ORDER BY title LIMIT 20
PG::InvalidColumnReference: ERROR:  for SELECT DISTINCT, ORDER BY expressions must appear in select list
LINE 1: ... "taxonomies"."type" IN ('Organization') ORDER BY title LIMI...
                                                             ^
: SELECT  DISTINCT "taxonomies".name FROM "taxonomies"  WHERE "taxonomies"."type" IN ('Organization') ORDER BY title LIMIT 20
Completed 500 Internal Server Error in 27.8ms

ActiveRecord::StatementInvalid (PG::InvalidColumnReference: ERROR:  for SELECT DISTINCT, ORDER BY expressions must appear in select list
LINE 1: ... "taxonomies"."type" IN ('Organization') ORDER BY title LIMI...
                                                             ^
: SELECT  DISTINCT "taxonomies".name FROM "taxonomies"  WHERE "taxonomies"."type" IN ('Organization') ORDER BY title LIMIT 20):
  app/controllers/concerns/foreman/controller/auto_complete_search.rb:7:in `auto_complete_search'
  app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
  lib/middleware/catch_json_parse_errors.rb:9:in `call'

  Rendered /home/tomckay/.rvm/gems/ruby-1.9.3-p327@foreman/gems/actionpack-3.2.17/lib/action_dispatch/middleware/templates/rescues/_trace.erb (2.4ms)
  Rendered /home/tomckay/.rvm/gems/ruby-1.9.3-p327@foreman/gems/actionpack-3.2.17/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.6ms)
  Rendered /home/tomckay/.rvm/gems/ruby-1.9.3-p327@foreman/gems/actionpack-3.2.17/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (11.8ms)

#3 Updated by Dominic Cleal over 3 years ago

  • Status changed from Need more information to New

#4 Updated by Og Maciel over 3 years ago

Same happens for CLI:

# hammer -v organization list --search 'name=ACME_Corporation'
[ERROR 2014-02-27 09:18:26 Exception] Error: 400 Bad Request
Error: 400 Bad Request
[ERROR 2014-02-27 09:18:26 Exception]

RestClient::BadRequest (400 Bad Request):
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/abstract_response.rb:48:in `return!'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:220:in `process_result'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:169:in `transmit'
    /usr/lib/ruby/1.8/net/http.rb:543:in `start'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:166:in `transmit'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:60:in `execute'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:31:in `execute'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/resource.rb:54:in `get'
    /usr/lib/ruby/gems/1.8/gems/katello_api-0.0.8/lib/katello_api/base.rb:70:in `send'
    /usr/lib/ruby/gems/1.8/gems/katello_api-0.0.8/lib/katello_api/base.rb:70:in `http_call'
    /usr/lib/ruby/gems/1.8/gems/katello_api-0.0.8/lib/katello_api/base.rb:51:in `perform_call'
    /usr/lib/ruby/gems/1.8/gems/katello_api-0.0.8/lib/katello_api/resources/organization.rb:22:in `index'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.18/lib/hammer_cli/./apipie/resource.rb:53:in `send'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.18/lib/hammer_cli/./apipie/resource.rb:53:in `call'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.18/lib/hammer_cli/./apipie/read_command.rb:17:in `retrieve_data'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.18/lib/hammer_cli_foreman/commands.rb:48:in `retrieve_data'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.18/lib/hammer_cli_foreman/commands.rb:93:in `retrieve_and_print'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.18/lib/hammer_cli_foreman/commands.rb:68:in `execute'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.18/lib/hammer_cli_foreman/resource_supported_test.rb:9:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.18/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.18/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.18/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.18/bin/hammer:61
    /usr/bin/hammer:19:in `load'
    /usr/bin/hammer:19

#5 Updated by Dominic Cleal over 3 years ago

  • Related to Bug #4486: Cannot search for an organization by name, only label added

#6 Updated by Tomáš Strachota over 3 years ago

  • Related to deleted (Bug #4486: Cannot search for an organization by name, only label)

#7 Updated by Tomáš Strachota over 3 years ago

  • Duplicates Bug #4486: Cannot search for an organization by name, only label added

#8 Updated by Tomáš Strachota over 3 years ago

  • Status changed from New to Duplicate

#9 Updated by Tomáš Strachota over 3 years ago

  • Status changed from Duplicate to New

#10 Updated by Tomáš Strachota over 3 years ago

  • Duplicates deleted (Bug #4486: Cannot search for an organization by name, only label)

#11 Updated by Tomáš Strachota over 3 years ago

  • Related to Bug #4486: Cannot search for an organization by name, only label added

#12 Updated by Dominic Cleal over 3 years ago

  • Subject changed from organization not searchable by name to Auto-completion of organization search fails as sort column is not in result set

#13 Updated by Dominic Cleal over 3 years ago

  • Related to Bug #4789: search auto completer on progress many times fail added

#14 Updated by Dominic Cleal over 3 years ago

  • Status changed from New to Closed
  • Assigned To set to Amos Benari
  • Target version set to Sprint 21
  • % Done changed from 0 to 100
  • Release set to 1.5.0

scoped_search 2.7.1 resolves the issue reported in comment 2. RPM built into nightly, bundler users should run `bundle update scoped_search`.

Also available in: Atom PDF