about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/helpers/search_helper.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb
index 0f3d09c36..7abb2729d 100644
--- a/app/helpers/search_helper.rb
+++ b/app/helpers/search_helper.rb
@@ -2,6 +2,13 @@ require 'sixarm_ruby_unaccent'
 
 module SearchHelper
 	def expand_search_query(query)
+    return '' if query.blank?
+    if query.include?(':')
+      query_parts = query.split(':', 2)
+      if query_parts[0].in?(%w(tags subj text desc))
+        query = "^#{query_parts[0]} .*#{query_parts[1]}"
+      end
+    end
     query.downcase.unaccent.gsub(/"(.*)"/, '\\y\1\\y')
   end
 end