Skip to content

Text index: rename positions to support_phrase_search - #109900

Merged
rschu1ze merged 4 commits into
masterfrom
ahmadov/phrase-search-rename
Jul 13, 2026
Merged

rschu1ze merged 4 commits into
masterfrom
ahmadov/phrase-search-rename

Conversation

@ahmadov

@ahmadov ahmadov commented Jul 9, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Rename text index parameter positions to support_phrase_search.

Version info

  • Merged into: 26.7.1.847 (included in 26.7 and later)

@rschu1ze rschu1ze self-assigned this Jul 9, 2026
@mintlify

mintlify Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
ClickHouse-docs 🟢 Ready View Preview Jul 9, 2026, 11:33 PM

@clickhouse-gh

clickhouse-gh Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [e5e4447]

Summary: ✅


AI Review

Summary

This PR renames the experimental text-index parameter and gate from positions / allow_experimental_text_index_positions to support_phrase_search / allow_experimental_text_index_phrase_search. The mechanical rename is incomplete: the old spellings are removed instead of kept as compatibility aliases, and internal fuzz/generator code still emits the old syntax. As written, the change can break upgrades for existing tables and weakens coverage of the renamed surface, so it should not merge yet.

Findings

❌ Blockers

  • [src/Storages/MergeTree/MergeTreeIndexText.cpp:1913-2033] Existing table metadata created before this rename will still contain INDEX ... TYPE text(..., positions = 1). After ARGUMENT_POSITIONS is renamed, textIndexValidator / textIndexCreator no longer consume that key and instead throw Unexpected text index arguments: positions, which can make restart or ATTACH fail for already-created text indexes.
    Suggested fix: accept both positions and support_phrase_search during a compatibility window and normalize to the new internal name.
  • [src/Storages/MergeTree/MergeTreeSettings.cpp:699-702] The old MergeTree setting name is removed without an alias. Stored CREATE TABLE ... SETTINGS allow_experimental_text_index_positions = 1 metadata and older automation/backups will now hit an unknown-setting exception on upgrade.
    Suggested fix: keep allow_experimental_text_index_positions as an alias of allow_experimental_text_index_phrase_search with DECLARE_WITH_ALIAS or an equivalent compatibility shim.

⚠️ Majors

  • [src/Common/QueryFuzzer.cpp:2055-2086] QueryFuzzer still mutates and appends the old positions argument. After the validator stops accepting that spelling, this path generates invalid text-index DDL instead of exercising the renamed support_phrase_search surface.
    Suggested fix: rename both the param_id->name() == ... branch and the add_missing_param call to support_phrase_search.
  • [src/Client/BuzzHouse/Generator/TableSettings.cpp:60] BuzzHouse was updated to enable the new table setting, but src/Client/BuzzHouse/Generator/SQLTable.cpp:2029 still emits positions = ... for text indexes. Generated DDL can therefore enable the new gate and still fail validation because the index definition uses the old argument name.
    Suggested fix: rename the emitted index argument in SQLTable.cpp to support_phrase_search.
Final Verdict

Status: ❌ Block

Minimum required actions:

  • Preserve backward compatibility for existing text-index metadata by accepting positions as a legacy spelling of support_phrase_search.
  • Preserve backward compatibility for the MergeTree setting name with an alias from allow_experimental_text_index_positions to allow_experimental_text_index_phrase_search.
  • Rename the remaining old-syntax emitters in QueryFuzzer and BuzzHouse.

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Jul 10, 2026
@rschu1ze rschu1ze changed the title Text index: rename positions into explicit support_phrase_search Text index: rename positions to support_phrase_search Jul 10, 2026
static const String ARGUMENT_POSTING_LIST_BLOCK_SIZE = "posting_list_block_size";
static const String ARGUMENT_POSTING_LIST_CODEC = "posting_list_codec";
static const String ARGUMENT_POSITIONS = "positions";
static const String ARGUMENT_POSITIONS = "support_phrase_search";

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.

This drops the old positions key entirely. Existing table metadata created before this rename will still contain INDEX ... TYPE text(..., positions = 1), and here extractFieldOption no longer consumes that argument, so textIndexValidator / textIndexCreator fall through to Unexpected text index arguments: positions during restart or ATTACH.

Please keep accepting positions as a compatibility spelling here (normalizing it to support_phrase_search internally) so upgrades do not stop loading already-created text indexes.

DECLARE(Bool, allow_experimental_text_index_positions, false, R"(
Allow creating text indexes with the experimental `positions` argument which
stores token positions to support exact phrase matching.
DECLARE(Bool, allow_experimental_text_index_phrase_search, false, R"(

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.

Renaming the MergeTree setting without an alias is backward-incompatible for stored CREATE TABLE ... SETTINGS allow_experimental_text_index_positions = 1 metadata and for automation/backups that still emit the old name. MergeTreeSettings will now treat that as unknown, so tables created on the previous release stop attaching after upgrade.

This needs a compatibility alias, e.g. a DECLARE_WITH_ALIAS that keeps allow_experimental_text_index_positions resolving to allow_experimental_text_index_phrase_search.

add_missing_param("posting_list_block_size", UInt64(fuzz_rand() % 2048 + 1));
add_missing_param("posting_list_codec", String(pickRandomly(fuzz_rand, posting_list_codecs)));
/// `positions = 1` requires the `allow_experimental_text_index_positions` MergeTree setting.
/// `support_phrase_search = 1` requires the `allow_experimental_text_index_phrase_search` MergeTree setting.

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.

The comment is renamed, but the generated parameter is still positions. After MergeTreeIndexText stops accepting that spelling, this path only generates invalid text-index DDL instead of exercising support_phrase_search, so the renamed surface loses QueryFuzzer coverage.

Both the param_id->name() branch above and this add_missing_param call need to switch to support_phrase_search.

{"allow_commit_order_projection", trueOrFalseSetting},
{"allow_experimental_replacing_merge_with_cleanup", trueOrFalseSetting},
{"allow_experimental_text_index_positions", trueOrFalseSetting},
{"allow_experimental_text_index_phrase_search", trueOrFalseSetting},

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.

TableSettings now enables allow_experimental_text_index_phrase_search, but src/Client/BuzzHouse/Generator/SQLTable.cpp:2029 still emits positions = ... for text indexes. That leaves BuzzHouse generating DDL with the new gate and the old index argument, which now fails validation instead of covering phrase-search indexes.

Please rename the generator output there to support_phrase_search as well.

@clickhouse-gh

clickhouse-gh Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 85.80% 85.80% +0.00%
Functions 92.70% 92.70% +0.00%
Branches 77.90% 78.00% +0.10%

Changed lines: Changed C/C++ lines covered: 24/24 (100.00%) · Uncovered code

Full report · Diff report

@rschu1ze
rschu1ze added this pull request to the merge queue Jul 13, 2026
Merged via the queue into master with commit 3d31d8f Jul 13, 2026
176 checks passed
@rschu1ze
rschu1ze deleted the ahmadov/phrase-search-rename branch July 13, 2026 06:33
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 13, 2026
@clickgapai

Copy link
Copy Markdown
Contributor

Hi @ahmadov @rschu1ze — while reviewing this PR I found the following:

Happy to discuss — close anything that's wrong or already addressed.

groeneai added a commit to groeneai/ClickHouse that referenced this pull request Jul 17, 2026
…n attach

ClickHouse#109900 renamed the text-index argument positions to support_phrase_search
without a compatibility alias. A table written by an older server with
positions = 0/1 in its text index leaves positions unrecognized and fails on
attach with 'Unexpected text index arguments: positions' from
textIndexCreator/textIndexValidator, which is a different code path than the
already-filtered 'Unknown setting' message. The previous-release corpus of
02346_text_index_partially_materialized creates exactly this shape.

Allow-list the exact legacy argument message in the upgrade error grep,
narrowed to the exact name so genuinely unexpected text index arguments are
not masked.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Jul 20, 2026
PR ClickHouse#109900 (merged 2026-07-13) renamed the setting
allow_experimental_text_index_positions to
allow_experimental_text_index_phrase_search and the text index argument
positions to support_phrase_search. Update this regression test's SQL
accordingly; the C++ fix is unaffected.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
pull Bot pushed a commit to AnotherGenZ/ClickHouse that referenced this pull request Jul 20, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…earch-rename

Text index: rename `positions` to `support_phrase_search`
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
PR ClickHouse#109900 (merged 2026-07-13) renamed the setting
allow_experimental_text_index_positions to
allow_experimental_text_index_phrase_search and the text index argument
positions to support_phrase_search. Update this regression test's SQL
accordingly; the C++ fix is unaffected.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

This branch was successfully deployed

1 active deployment
staging - docs — e5e44474 Deployed Jul 10, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants