Skip to content

fix(clickhouse): lowercase logs search index terms - #4705

Merged
carderne merged 1 commit into
mainfrom
fix/restore-logs-search-index-preprocessor
Aug 19, 2026
Merged

fix(clickhouse): lowercase logs search index terms#4705
carderne merged 1 commit into
mainfrom
fix/restore-logs-search-index-preprocessor

Conversation

@carderne

Copy link
Copy Markdown
Collaborator

Summary

Apply lowerUTF8 preprocessing when constructing the logs search n-gram index. This keeps lowercase normalization explicit in the index definition as well as in the projected search_text values.

Design

The supported ClickHouse baseline accepts expression-valued text index preprocessors. The index continues using the ngrams tokenizer, with the preprocessor ensuring its indexed terms are generated from lowercase text.

Verified with the task events search integration tests.

@changeset-bot

changeset-bot Bot commented Aug 19, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 18d9b6c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@carderne
carderne marked this pull request as ready for review August 19, 2026 12:45
@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 97e9188c-c423-4a36-b2b6-50524bf49a53

📥 Commits

Reviewing files that changed from the base of the PR and between 4dabfca and 18d9b6c.

📒 Files selected for processing (1)
  • internal-packages/clickhouse/schema/040_create_task_events_search_v2.sql

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (21)
  • GitHub Check: audit
  • GitHub Check: audit
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (10, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (3, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (12, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (7, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (11, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (9, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (1, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (6, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (8, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (2, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (4, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (5, 12)
  • GitHub Check: internal / 🧪 Unit Tests: Internal
  • GitHub Check: fk-cascade-guard / fk-cascade-guard
  • GitHub Check: e2e-webapp / 🧪 E2E Tests: Webapp
  • GitHub Check: runops-guard / runops-guard
  • GitHub Check: typecheck / typecheck
  • GitHub Check: code-quality / code-quality
  • GitHub Check: Analyze (javascript-typescript)
🧰 Additional context used
📓 Path-based instructions (2)
internal-packages/clickhouse/schema/[0-9][0-9][0-9]_*.sql

📄 CodeRabbit inference engine (internal-packages/clickhouse/CLAUDE.md)

internal-packages/clickhouse/schema/[0-9][0-9][0-9]_*.sql: Migration file numbering: name files as 0(N+1)_descriptive_name.sql where N is the largest existing migration number in schema/; rebase and renumber if main adds migrations before opening a PR
DDL in migrations must be idempotent: use ALTER TABLE ... ADD COLUMN IF NOT EXISTS, CREATE TABLE IF NOT EXISTS, DROP TABLE IF EXISTS, ADD INDEX IF NOT EXISTS, DROP INDEX IF EXISTS, and CREATE MATERIALIZED VIEW IF NOT EXISTS forms to allow out-of-order and retry-safe application

Files:

  • internal-packages/clickhouse/schema/040_create_task_events_search_v2.sql
**/*

📄 CodeRabbit inference engine (AGENTS.md)

**/*: Add crumbs as you write code — not just when debugging. Mark lines with
// @Crumbs or wrap blocks in `// `#region` `@crumbs. They stay on the
branch throughout development and are stripped by agentcrumbs strip
before merge.
Do not invent new namespaces — pick from this table or ask first.
Do not flag // @Crumbs markers, `#region `@crumbs blocks, or agentcrumbs
imports in reviews. These are temporary debug instrumentation stripped
before merge. Data logged in crumbs (IDs, names, values) never reaches
production.

Files:

  • internal-packages/clickhouse/schema/040_create_task_events_search_v2.sql
🔇 Additional comments (2)
internal-packages/clickhouse/schema/040_create_task_events_search_v2.sql (2)

39-39: 📐 Maintainability & Code Quality

No change required. Do not add an agentcrumbs marker to this SQL migration.

			> Likely an incorrect or invalid review comment.

38-39: 🗄️ Data Integrity & Integration

Verify existing-table and query-pattern behavior before merge.

  • If migration 040_create_task_events_search_v2.sql has already run, CREATE TABLE IF NOT EXISTS will not replace the existing idx_search_text definition. Add a forward ALTER TABLE migration that updates and materializes the index, or confirm this migration is guaranteed to run only before table creation.
  • The logs presenter passes searchTerm directly to search_text LIKE; lowercasing indexed text does not normalize the LIKE pattern. If callers can send uppercase or mixed-case terms, normalize the bound pattern or use a matching text-search function, and cover uppercase Unicode cases.

Walkthrough

The ClickHouse idx_search_text index now applies lowerUTF8(search_text) before n-gram tokenization.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the change and testing but omits the required issue, checklist, changelog, and screenshots sections. Add the template sections, reference the issue, complete the checklist, document testing and the changelog, and provide screenshots or state that they are not applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly describes the main change: lowercasing terms in the ClickHouse logs search index.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/restore-logs-search-index-preprocessor

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration 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.

Devin Review found 2 potential issues.

Open in Devin Review

@carderne
carderne merged commit 338326c into main Aug 19, 2026
45 checks passed
@carderne
carderne deleted the fix/restore-logs-search-index-preprocessor branch August 19, 2026 12:59
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.

2 participants