Skip to content

feat(custom-fields): add searchable option for custom fields - #584

Merged
pikann merged 3 commits into
masterfrom
feature/add-use-in-search-functionality-for-custom-fields
Oct 16, 2026
Merged

pikann merged 3 commits into
masterfrom
feature/add-use-in-search-functionality-for-custom-fields

Conversation

@pikann

@pikann pikann commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #576. Custom fields can now be flagged Use in search; when the task search box is used, it also matches the value stored in those fields (e.g. tracking numbers or client ids entered in a custom field).

Changes

API

  • New migration 000069_custom_field_use_in_search.sql adds custom_field_definitions.use_in_search BOOLEAN NOT NULL DEFAULT FALSE (idempotent).
  • use_in_search is accepted on create/update and returned in the custom field definition response.
  • Task search (applyTaskFilter) adds an OR EXISTS clause over the project's flagged definitions, case-insensitive ILIKE on the stored value. Array values (multi-select) are matched on their JSON text. Existing title / #number / content matching is unchanged.

Web

  • "Use in search" switch in the create and edit custom field dialogs.
  • New "Use in search" column in the custom fields settings table.
  • use_in_search added to the CustomFieldDefinition type and create/update payloads.
  • Translations added for all 9 locales.

Docs

  • database-schema.md and http-design.md updated.

Testing

  • New e2e test TestE2ETaskSearch_CustomFieldUseInSearch (real Postgres): a flagged field's value is found case-insensitively; the same value in an unflagged field is not.
  • go build, API unit tests, web tsc, Biome and the settings vitest suite pass.
  • The UI was not checked manually in a browser.

Notes

  • Not included: the MCP server (apps/mcp) types/tools don't expose use_in_search yet.
  • Search runs an ILIKE per flagged field with no index, so it scans the project's tasks like the existing title search does.

@pikann pikann changed the title feat(custom-fields): add searchable option for custom fields in task … feat(custom-fields): add searchable option for custom fields Oct 16, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — a few minor suggestions inline, plus a small docs gap.

Reviewed changes

  • Migration 000069_custom_field_use_in_search.sql — adds custom_field_definitions.use_in_search BOOLEAN NOT NULL DEFAULT FALSE.
  • API plumbing — threads use_in_search through the domain entity, create/update inputs, HTTP DTOs, handler, and the repository column list, INSERT, UPDATE and response mapping.
  • Task search — applyTaskFilter adds an OR EXISTS over the project's flagged definitions, matching the stored JSON value with ILIKE (array/object values via ::text, scalars via ->>). Existing title / #number / content matching is unchanged.
  • Web — "Use in search" toggle in the create/edit dialogs, a new settings-table column, updated CustomFieldDefinition types and payloads, and translations for all 9 locales.
  • Docs & tests — schema and HTTP docs touched; new e2e TestE2ETaskSearch_CustomFieldUseInSearch (real Postgres).

ℹ️ Custom-field examples in http-design.md don't show use_in_search

The API now returns use_in_search on every custom-field definition and accepts it on create, but neither the GET /custom-fields response example nor the POST /custom-fields request example was updated — only the PATCH "mutable fields" line and the schema doc were. The two examples are now stale.

Technical details
# Stale custom-field examples in docs/api/http-design.md

## Affected sites
- docs/api/http-design.md:1336-1352 — `GET /custom-fields` response example omits `use_in_search`.
- docs/api/http-design.md:1362-1372 — `POST /custom-fields` request example omits `use_in_search`.

## Required outcome
- The response and request examples reflect the `use_in_search` field the API
  now reads and returns.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Re-reviewed the delta since the prior pullfrog review (564b03c → bfae8f4). The new commit resolves all three inline threads and touches four files.

  • Reworked the custom-field toggles to use the shared Switch — the "Required" and "Use in search" toggles in the create and edit dialogs now render @/components/ui/switch instead of the hand-rolled button, matching the pattern already used in PolicyEditor.tsx and JevSettings.tsx.
  • Simplified migration 000069 — dropped the IF NOT EXISTS guard and the inaccurate "re-runs on startup" comment; a plain one-shot ADD COLUMN is correct under the ledger-based runner.
  • Made the non-searchable e2e assertion meaningful — the unflagged field now stores ONLY-IN-SECRET and the second subtest searches only-in-secret, rather than a value that returned nothing regardless of the flag.
  • Disambiguated the e2e switch selectors — the custom-fields spec now targets the toggles by accessible name, since two switches share the dialog.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Re-reviewed the delta since the prior pullfrog review (bfae8f4 → c69d57a, 5 files).

  • MCP use_in_search support — useInSearch is now on the create_custom_field/update_custom_field zod schemas and their tool JSON schemas, threaded through the client payloads, added to the CustomFieldDefinition and create/update input types, and surfaced in the get_custom_field formatter. This closes the gap the PR previously listed as out of scope.
  • Migration 000069 adds a partial index — idx_custom_field_definitions_use_in_search ON custom_field_definitions (project_id) WHERE use_in_search, matching the search predicate, with IF NOT EXISTS guards on both statements (consistent with the repo's other migrations).
  • New unit test — TestUpdateCustomFieldDefinition_UseInSearch covers create setting the flag, an omitted field preserving it, and an explicit false clearing it.
  • Comment correction — the search-clause comment now notes that object JSON text also includes key names and punctuation.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pikann
pikann merged commit 6e8c9c8 into master Oct 16, 2026
9 checks passed
@pikann
pikann deleted the feature/add-use-in-search-functionality-for-custom-fields branch October 16, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Search by custom fields values

1 participant