Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Conversation

@nablaone
Copy link
Member

@nablaone nablaone commented Jun 5, 2025

Quesma exposes String columns as text type fields. This is the default behaviour. When a user performs a full-text search, quesma searches through all text fields. It can lead to massive queries.

This PR adds a flag that changes the default type.

flags:
  defaultStringColumnType: keyword

@nablaone nablaone changed the title [WIP] String column is keyword field String column as keyword field Jun 5, 2025
@nablaone nablaone marked this pull request as ready for review June 5, 2025 14:39
@nablaone nablaone requested a review from a team as a code owner June 5, 2025 14:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a new stringColumnIsKeywordField flag that controls whether string columns are exposed as keyword (instead of text) in legacy configs and clickhouse type adapter.

  • Introduce StringColumnIsKeywordField in v2 config, translation, and legacy config
  • Wire the flag through SchemaTypeAdapter to return QuesmaTypeKeyword for "String" when set
  • Add tests for default and enabled behaviors and a sample YAML config

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
platform/config/test_configs/string_column_is_keyword_field.yaml New test config enabling the flag
platform/config/config_v2_test.go Tests for default (false) and enabled (true) flag translation
platform/config/config_v2.go Added StringColumnIsKeywordField to v2 struct and translation
platform/config/config.go Added flag to legacy config struct and config print output
platform/clickhouse/type_adapter.go New SchemaTypeAdapter that respects the flag when converting types
cmd/main.go Pass flag into NewSchemaTypeAdapter
cmd/experimental/main.go Same wiring in experimental main
Comments suppressed due to low confidence (2)

platform/config/config_v2.go:52

  • [nitpick] Add a comment above this field explaining its purpose, default value (false), and how it affects downstream behavior to keep configuration docs in sync.
    StringColumnIsKeywordField  bool                 `koanf:"stringColumnIsKeywordField"`

platform/clickhouse/type_adapter.go:33

  • Add unit tests for SchemaTypeAdapter.Convert covering both flag conditions (true and false) so that the new keyword/text behavior is validated.
    case "String":

@nablaone
Copy link
Member Author

nablaone commented Jun 5, 2025

/run-it

Copy link
Contributor

@jakozaur jakozaur left a comment

Choose a reason for hiding this comment

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

Good, but please change configuration name.

Pipelines []Pipeline `koanf:"pipelines"`
DisableTelemetry bool `koanf:"disableTelemetry"`
MapFieldsDiscoveringEnabled bool `koanf:"mapFieldsDiscoveringEnabled"`
StringColumnIsKeywordField bool `koanf:"stringColumnIsKeywordField"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not like this name.

For example better suggestion:
defaultStringToKeywordType

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed

@nablaone
Copy link
Member Author

nablaone commented Jun 6, 2025

/run-it

@nablaone
Copy link
Member Author

nablaone commented Jun 6, 2025

Added an extra struct for aux flags.

@nablaone nablaone enabled auto-merge June 6, 2025 13:07
@nablaone nablaone added this pull request to the merge queue Jun 6, 2025
Merged via the queue into main with commit 2527ae6 Jun 6, 2025
6 checks passed
@nablaone nablaone deleted the keyword-as-a-default branch June 6, 2025 13:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants