userver: storages::mongo::options::Collation Class Reference
Loading...
Searching...
No Matches
storages::mongo::options::Collation Class Referencefinal

#include <userver/storages/mongo/options.hpp>

Detailed Description

Specifies collation options for text comparison.

See also
https://docs.mongodb.com/manual/reference/collation/
https://unicode-org.github.io/icu/userguide/collation/concepts.html

Definition at line 317 of file options.hpp.

Public Types

enum class  Strength {
  kPrimary = 1 ,
  kSecondary = 2 ,
  kTertiary = 3 ,
  kQuaternary = 4 ,
  kIdentical = 5
}
 
enum class  CaseFirst {
  kOff ,
  kUpper ,
  kLower
}
 
enum class  Alternate {
  kNonIgnorable ,
  kShifted
}
 
enum class  MaxVariable {
  kPunct ,
  kSpace
}
 

Public Member Functions

 Collation (std::string locale)
 Creates a collation with mandatory locale.
 
CollationSetStrength (Strength strength)
 Sets the ICU collation level Default is kTertiary.
 
CollationSetCaseLevel (bool case_level)
 Sets whether to include case comparison at strength level 1 or 2 Default is false.
 
CollationSetCaseFirst (CaseFirst case_first)
 Sets sort order of case differences during tertiary level comparisons Default is kOff.
 
CollationSetNumericOrdering (bool numeric_ordering)
 Sets whether to compare numeric strings as numbers or as strings Default is false (compare as strings)
 
CollationSetAlternate (Alternate alternate)
 Sets whether collation should consider whitespace and punctuation as base characters Default is kNonIgnorable.
 
CollationSetMaxVariable (MaxVariable max_variable)
 Sets up to which characters are considered ignorable when alternate is kShifted Has no effect if alternate is kNonIgnorable.
 
CollationSetBackwards (bool backwards)
 Sets whether strings with diacritics sort from back of the string Default is false (compare from front to back)
 
CollationSetNormalization (bool normalization)
 Sets whether to check if text require normalization and perform normalization Default is false.
 

Member Enumeration Documentation

◆ Alternate

Enumerator
kNonIgnorable 

Whitespace and punctuation are considered base characters (default)

kShifted 

Whitespace and punctuation not considered base characters.

Definition at line 341 of file options.hpp.

◆ CaseFirst

Enumerator
kOff 

Default value, similar to lower with slight differences.

kUpper 

Uppercase sorts before lowercase.

kLower 

Lowercase sorts before uppercase.

Definition at line 332 of file options.hpp.

◆ MaxVariable

Enumerator
kPunct 

Both whitespace and punctuation are ignorable.

kSpace 

Only whitespace is ignorable.

Definition at line 348 of file options.hpp.

◆ Strength

Enumerator
kPrimary 

Primary level of comparison (base characters only)

kSecondary 

Secondary level (base characters + diacritics)

kTertiary 

Tertiary level (base + diacritics + case), default.

kQuaternary 

Quaternary level.

kIdentical 

Identical level (tie breaker)

Definition at line 319 of file options.hpp.


The documentation for this class was generated from the following file: