Search engine: issue custom fields can now be searched.

Each issue custom field (excepting numeric, date and boolean fields) can be marked as "Searchable" (default to false).

git-svn-id: http://redmine.rubyforge.org/svn/trunk@994 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2007-12-14 18:54:55 +00:00
parent 38b185f1dc
commit 58610ec52a
27 changed files with 89 additions and 11 deletions
+3 -2
View File
@@ -11,16 +11,17 @@ custom_fields_001:
is_required: false
field_format: list
custom_fields_002:
name: Build
name: Searchable field
min_length: 1
regexp: ""
is_for_all: true
type: IssueCustomField
max_length: 10
max_length: 100
possible_values: ""
id: 2
is_required: false
field_format: string
searchable: true
custom_fields_003:
name: Development status
min_length: 0
+8 -1
View File
@@ -46,4 +46,11 @@ custom_values_008:
custom_field_id: 1
customized_id: 3
id: 11
value: "MySQL"
value: "MySQL"
custom_values_009:
customized_type: Issue
custom_field_id: 2
customized_id: 3
id: 12
value: "this is a stringforcustomfield search"
+13 -2
View File
@@ -5,7 +5,7 @@ require 'search_controller'
class SearchController; def rescue_action(e) raise e end; end
class SearchControllerTest < Test::Unit::TestCase
fixtures :projects, :issues
fixtures :projects, :issues, :custom_fields, :custom_values
def setup
@controller = SearchController.new
@@ -25,7 +25,9 @@ class SearchControllerTest < Test::Unit::TestCase
assert assigns(:results).include?(Project.find(1))
end
def test_search_in_project
def test_search_without_searchable_custom_fields
CustomField.update_all "searchable = #{ActiveRecord::Base.connection.quoted_false}"
get :index, :id => 1
assert_response :success
assert_template 'index'
@@ -36,6 +38,15 @@ class SearchControllerTest < Test::Unit::TestCase
assert_template 'index'
end
def test_search_with_searchable_custom_fields
get :index, :id => 1, :q => "stringforcustomfield"
assert_response :success
results = assigns(:results)
assert_not_nil results
assert_equal 1, results.size
assert results.include?(Issue.find(3))
end
def test_quick_jump_to_issue
# issue of a public project
get :index, :q => "3"