Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow $ and @ characters in field names. #4413

Merged
merged 4 commits into from
Jan 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions quickwit/quickwit-doc-mapper/src/default_doc_mapper/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ pub(crate) use self::tokenizer_entry::{
use crate::QW_RESERVED_FIELD_NAMES;

/// Regular expression validating a field mapping name.
pub const FIELD_MAPPING_NAME_PATTERN: &str = r"^[_\-a-zA-Z][_\.\-a-zA-Z0-9]{0,254}$";
pub const FIELD_MAPPING_NAME_PATTERN: &str = r"^[@$_\-a-zA-Z][@$_\.\-a-zA-Z0-9]{0,254}$";

/// Validates a field mapping name.
/// Returns `Ok(())` if the name can be used for a field mapping. Does not check for reserved field
/// mapping names such as `_source`.
/// Returns `Ok(())` if the name can be used for a field mapping.
///
/// A field mapping name:
/// - may only contain uppercase and lowercase ASCII letters `[a-zA-Z]`, digits `[0-9]`, hyphens
/// `-`, and underscores `_`;
/// `-`, `$` and underscores `_`;
fmassot marked this conversation as resolved.
Show resolved Hide resolved
/// - must not start with a dot or a digit;
/// - must be different from Quickwit's reserved field mapping names `_source`, `_dynamic`;
/// - must be different from Quickwit's reserved field mapping names `_source`, `_dynamic`,
/// `_field_presence`;
/// - must not be longer than 255 characters.
pub fn validate_field_mapping_name(field_mapping_name: &str) -> anyhow::Result<()> {
static FIELD_MAPPING_NAME_PTN: Lazy<Regex> =
Expand Down
Loading