feat: advanced issue search with custom field filters #496

Open
opened 2026-06-05 05:12:12 +00:00 by jmiller · 0 comments
Owner

Summary

Add the ability to filter issues by custom field values in the issue list. Users should be able to narrow issues by any org-level issue-scoped custom field (e.g. filter by Priority=High, Status=Pending Testing).

Implementation

1. Database Layer

  • Add CustomFieldFilters map[int64]string to IssuesOptions struct in models/issues/issue_search.go
  • Add applyCustomFieldCondition() that JOINs custom_field_value table (one JOIN per filtered field, AND semantics)

2. Indexer Options

  • Add CustomFieldFilters map[int64]string to SearchOptions in modules/indexer/issues/internal/model.go
  • Update DB indexer ToDBOptions() to pass through

3. Web Handler

  • Parse cf_{fieldID}={value} query parameters in prepareIssueFilterAndList()
  • Load org-level issue-scoped custom field definitions for the filter UI
  • Pass field definitions + current filter values to template context

4. Filter UI

  • Add custom field filter dropdowns after existing filters in templates/repo/issue/filter_list.tmpl
  • Dropdown fields show options as selectable items
  • Text fields show a text input filter
  • Use QueryBuild to maintain filter state across page navigation

5. API

  • Accept cf_{fieldID}={value} query parameters in ListIssues and SearchIssues
  • Resolve to CustomFieldFilters map

Dependencies

  • #483 (org-level custom fields) - DONE
  • #493 (custom fields in issue sidebar) - DONE

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

## Summary Add the ability to filter issues by custom field values in the issue list. Users should be able to narrow issues by any org-level issue-scoped custom field (e.g. filter by Priority=High, Status=Pending Testing). ## Implementation ### 1. Database Layer - Add `CustomFieldFilters map[int64]string` to `IssuesOptions` struct in `models/issues/issue_search.go` - Add `applyCustomFieldCondition()` that JOINs `custom_field_value` table (one JOIN per filtered field, AND semantics) ### 2. Indexer Options - Add `CustomFieldFilters map[int64]string` to `SearchOptions` in `modules/indexer/issues/internal/model.go` - Update DB indexer `ToDBOptions()` to pass through ### 3. Web Handler - Parse `cf_{fieldID}={value}` query parameters in `prepareIssueFilterAndList()` - Load org-level issue-scoped custom field definitions for the filter UI - Pass field definitions + current filter values to template context ### 4. Filter UI - Add custom field filter dropdowns after existing filters in `templates/repo/issue/filter_list.tmpl` - Dropdown fields show options as selectable items - Text fields show a text input filter - Use `QueryBuild` to maintain filter state across page navigation ### 5. API - Accept `cf_{fieldID}={value}` query parameters in `ListIssues` and `SearchIssues` - Resolve to `CustomFieldFilters` map ## Dependencies - #483 (org-level custom fields) - DONE - #493 (custom fields in issue sidebar) - DONE --- _Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>_
Sign in to join this conversation.
No labels
Type
Status
Priority
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoGitea#496