Skip to content

Commit

Permalink
[api] Using models directly in webui2/search_controller
Browse files Browse the repository at this point in the history
  • Loading branch information
ancorgs authored and coolo committed Oct 22, 2013
1 parent db67af9 commit 60d1808
Show file tree
Hide file tree
Showing 18 changed files with 317 additions and 419 deletions.
6 changes: 2 additions & 4 deletions src/api/app/controllers/search_controller.rb
@@ -1,5 +1,3 @@
include SearchHelper

class SearchController < ApplicationController

require_dependency 'xpath_engine'
Expand Down Expand Up @@ -51,7 +49,7 @@ def attribute
def missing_owner
params[:limit] ||= "0" #unlimited by default

@owners = search_owner(params, nil)
@owners = Owner.search(params, nil).map(&:to_hash)

end

Expand All @@ -70,7 +68,7 @@ def owner
return
end

@owners = search_owner(params, obj)
@owners = Owner.search(params, obj).map(&:to_hash)
end

def predicate_from_match_parameter(p)
Expand Down
13 changes: 0 additions & 13 deletions src/api/app/controllers/webui/owners_controller.rb

This file was deleted.

14 changes: 0 additions & 14 deletions src/api/app/controllers/webui/searches_controller.rb

This file was deleted.

68 changes: 0 additions & 68 deletions src/api/app/helpers/search_helper.rb

This file was deleted.

16 changes: 0 additions & 16 deletions src/api/app/models/full_text_search.rb
Expand Up @@ -83,20 +83,4 @@ def find_issue_id
nil
end
end

def read_attribute_for_serialization(attrib)
if attrib.to_sym == :result
# Format expected by webui search controller
if @result.nil?
nil
else
@result.map {|r| {:type => r.class.model_name.to_s.downcase,
:data => r, :search_attributes => r.sphinx_attributes}}
end
elsif attrib.to_sym == :total_entries
@result.nil? ? nil : @result.total_entries
else
super
end
end
end

0 comments on commit 60d1808

Please sign in to comment.