diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
index 0843d9a4d2b38f17ffcd08c3bbbb939cd83f0106..47abcf8da59da31342ab60074b7346ce1123b2e6 100644
--- a/app/controllers/search_controller.rb
+++ b/app/controllers/search_controller.rb
@@ -16,7 +16,7 @@ class SearchController < ApplicationController
     end
 
     unless params[:qry].empty?
-      objectsFound = search(params[:qry])
+      objectsFound = search params[:qry], params[:sort]
       @numFound = objectsFound.length
 
       # if params[:sort]
@@ -45,8 +45,6 @@ class SearchController < ApplicationController
       #
       #   a = rater.sortByRate(items) # Returns sorted array of items
       #   objectsFound = a.collect{ |x|  x.info  } #get only the info fields(objects)
-      # when "title"
-      #   objectsFound = sort_title(objectsFound);
       # end
     end
 
@@ -70,11 +68,4 @@ class SearchController < ApplicationController
     # items.each{ |item| item['author'] = sort_author(item['author']) if (item['author'].nil? ? [] : item['author']).size > 0 }
     items
   end
-
-
-  def sort_title(items)
-    # items = items.sort_by{|item| [ item['title'].to_s.downcase ]}
-    # items.each{ |item| item['title'] = sort_title(item['title']) if (item['title'].nil? ? [] : item['title']).size > 0 }
-    items
-  end
 end
diff --git a/app/repositories/orient_db/learning_object_repository.rb b/app/repositories/orient_db/learning_object_repository.rb
index 5998c8728b0f02d4b3dcfaaf7017ba033f63069d..a7eff557a91b642598d26b4846e6ddef507fc337 100644
--- a/app/repositories/orient_db/learning_object_repository.rb
+++ b/app/repositories/orient_db/learning_object_repository.rb
@@ -97,17 +97,26 @@ module OrientDb
     #   ON LearningObject (name, description)
     #   FULLTEXT ENGINE LUCENE
     #   METADATA {"analyzer":"org.apache.lucene.analysis.br.BrazilianAnalyzer"}
-    def search(qry)
-      # learning_objects_hash = connection.query "
-      #                           SELECT EXPAND(rid)
-      #                           FROM index:learningobject_search
-      #                           WHERE key LUCENE '#{qry}'
-      #                         ", limit: 10000
-
-      learning_objects_hash = connection.query "SELECT @rid.asString(), last_modified FROM (
-                                SELECT EXPAND(rid) FROM index:learningobject_search
-                                WHERE key LUCENE '#{qry}'
-                              )", limit: 10000
+    def search(qry, order = nil)
+      # TODO: fix search metadata from dspace
+      order = case order
+      when "author"
+        "metadata.key['dc.contributor.author']"
+      when "publicationasc"
+        "metadata.key['dc.date.submitted']"
+      when "publicationdesc"
+        "metadata.key['dc.date.submitted'] DESC"
+      when "title"
+        "name ASC"
+      else
+        nil
+      end
+
+      query = "SELECT EXPAND(rid) FROM index:learningobject_search WHERE key LUCENE '#{qry}'"
+      query = "SELECT * FROM (" + query + ") ORDER BY #{order}" unless order.nil?
+      query = "SELECT @rid.asString(), last_modified FROM (" + query + ")"
+
+      learning_objects_hash = connection.query query, limit: 10000
 
       # return only rids with their modification time
       learning_objects_hash.map do |e|
diff --git a/lib/search_engine/orientdb_lucene.rb b/lib/search_engine/orientdb_lucene.rb
index 672c05ee70050f873aa2742e6c7a6d0538cbe405..db31ac7ca01d1672a271ba7d090be6e96d357243 100644
--- a/lib/search_engine/orientdb_lucene.rb
+++ b/lib/search_engine/orientdb_lucene.rb
@@ -1,8 +1,8 @@
 module SearchEngine
   module OrientdbLucene
 
-    def search(qry)
-      learning_object_repository.search(qry)
+    def search(qry, order = nil)
+      learning_object_repository.search(qry, order)
     end
 
   end