Content
View differences
Updated by Eric Schubert over 1 year ago
**As a** user
**I want to** be able ### Steps to search for item labels of reproduce
1. Have a custom field of type hierarchy
**so that** I can find work packages which have that is marked as "Searchable"
2. Provide a value assigned matching for the search term. custom field on a work package
### What is the buggy behavior?
**Acceptance Criteria**
* If a text Search for the value in the project search
### What is searched globally, the search result must contain expected behavior?
1. Have the work packages, that have a value assigned to a custom field of type hierarchy where package found if the search term string matches the following expectations:
* value selected for the search term is a substring of work package
OR:
1. Remove the item label
* option from the search term is a substring of any ancestor label on custom field form
### Screenshots and other files
Work package can be filtered for by the branch of value "Berlin"
### <img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/241533/content">
The same custom field cannot be found by inserting "Berlin" into the item
* the search term
<img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/241534/content"> <img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/241535/content">
The CF is a substring of the item short
marked as searchable
<img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/241536/content">
### Information
* the custom values of custom fields of type list do have special handling in `act_as_searchable.rb`
```ruby
def build_custom_field_condition(custom_field_ids)
CustomValue.select("1")
.joins(<<~SQL.squish)
LEFT JOIN custom_options
ON custom_options.custom_field_id = custom_values.custom_field_id
AND custom_options.id::VARCHAR = custom_values.value
SQL
.where(customized_type: name, custom_field_id: custom_field_ids)
.where("customized_id=#{table_name}.id")
.where("(custom_values.value ILIKE ?) OR (custom_options.value ILIKE ?)")
end
```
* usually this kind of code should go into responsibility of the custom field itself
**I want to** be able
1. Have
**so that** I can find work packages which have
2. Provide
### What is the buggy behavior?
**Acceptance Criteria**
* If a text
### What
1. Have the
*
OR:
1. Remove
*
### Screenshots and other files
Work package can be filtered for by
### <img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/241533/content">
The same custom field cannot be found by inserting "Berlin" into
* the search term
<img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/241534/content"> <img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/241535/content">
The CF
<img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/241536/content">
* the custom values of custom fields of type list do have special handling in `act_as_searchable.rb`
```ruby
def build_custom_field_condition(custom_field_ids)
CustomValue.select("1")
.joins(<<~SQL.squish)
LEFT JOIN custom_options
ON custom_options.custom_field_id = custom_values.custom_field_id
AND custom_options.id::VARCHAR = custom_values.value
SQL
.where(customized_type: name, custom_field_id: custom_field_ids)
.where("customized_id=#{table_name}.id")
.where("(custom_values.value ILIKE ?) OR (custom_options.value ILIKE ?)")
end
```
* usually this kind of code should go into responsibility of the custom field itself