diff --git a/app/controllers/tickets_controller.rb b/app/controllers/tickets_controller.rb index 922ea3277..e7e0cb549 100644 --- a/app/controllers/tickets_controller.rb +++ b/app/controllers/tickets_controller.rb @@ -329,7 +329,6 @@ class TicketsController < ApplicationController query: params[:term], condition: params[:condition], current_user: current_user, - detail: params[:detail] ) assets = {} ticket_result = [] @@ -372,10 +371,8 @@ class TicketsController < ApplicationController } user_tickets_open = Ticket.search( limit: limit, - #:query => params[:term], condition: condition, current_user: current_user, - detail: true, ) user_tickets_open_ids = assets_of_tickets(user_tickets_open, assets) @@ -386,10 +383,8 @@ class TicketsController < ApplicationController } user_tickets_closed = Ticket.search( limit: limit, - #:query => params[:term], condition: condition, current_user: current_user, - detail: true, ) user_tickets_closed_ids = assets_of_tickets(user_tickets_closed, assets) @@ -438,10 +433,8 @@ class TicketsController < ApplicationController } org_tickets_open = Ticket.search( limit: limit, - #:query => params[:term], condition: condition, current_user: current_user, - detail: true, ) org_tickets_open_ids = assets_of_tickets(org_tickets_open, assets) @@ -452,10 +445,8 @@ class TicketsController < ApplicationController } org_tickets_closed = Ticket.search( limit: limit, - #:query => params[:term], condition: condition, current_user: current_user, - detail: true, ) org_tickets_closed_ids = assets_of_tickets(org_tickets_closed, assets) diff --git a/app/models/ticket/search.rb b/app/models/ticket/search.rb index 766baafa3..138406051 100644 --- a/app/models/ticket/search.rb +++ b/app/models/ticket/search.rb @@ -22,7 +22,7 @@ search tickets via search index :current_user => User.find(123), :query => 'search something', :limit => 15, - :full => 0 + :full => false, ) returns @@ -33,10 +33,19 @@ search tickets via database result = Ticket.search( :current_user => User.find(123), - :condition => '', - :detail => true, + :condition => { + 'tickets.owner_id' => user.id, + 'tickets.state_id' => Ticket::State.where( + state_type_id: Ticket::StateType.where( + name: [ + 'pending reminder', + 'pending action', + ], + ), + ), + }, :limit => 15, - :full => 0 + :full => false, ) returns @@ -57,7 +66,7 @@ returns end # try search index backend - if !params[:detail] && SearchIndexBackend.enabled? + if !params[:condition] && SearchIndexBackend.enabled? query_extention = {} query_extention['bool'] = {} query_extention['bool']['must'] = [] diff --git a/lib/i_cal/ticket.rb b/lib/i_cal/ticket.rb index 1a18764fe..f58537177 100644 --- a/lib/i_cal/ticket.rb +++ b/lib/i_cal/ticket.rb @@ -16,7 +16,6 @@ module ICal::Ticket tickets = Ticket.search( current_user: user, condition: condition, - detail: true, ) events_data = [] @@ -52,7 +51,6 @@ module ICal::Ticket tickets = Ticket.search( current_user: user, condition: condition, - detail: true, ) events_data = [] @@ -83,7 +81,6 @@ module ICal::Ticket tickets = Ticket.search( current_user: user, condition: condition, - detail: true, ) events_data = []