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 324 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.
 
Collation & SetStrength (Strength strength)
 Sets the ICU collation level Default is kTertiary.
 
Collation & SetCaseLevel (bool case_level)
 Sets whether to include case comparison at strength level 1 or 2 Default is false.
 
Collation & SetCaseFirst (CaseFirst case_first)
 Sets sort order of case differences during tertiary level comparisons Default is kOff.
 
Collation & SetNumericOrdering (bool numeric_ordering)
 Sets whether to compare numeric strings as numbers or as strings Default is false (compare as strings)
 
Collation & SetAlternate (Alternate alternate)
 Sets whether collation should consider whitespace and punctuation as base characters Default is kNonIgnorable.
 
Collation & SetMaxVariable (MaxVariable max_variable)
 Sets up to which characters are considered ignorable when alternate is kShifted Has no effect if alternate is kNonIgnorable.
 
Collation & SetBackwards (bool backwards)
 Sets whether strings with diacritics sort from back of the string Default is false (compare from front to back)
 
Collation & SetNormalization (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 348 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 339 of file options.hpp.

◆ MaxVariable

Enumerator
kPunct 

Both whitespace and punctuation are ignorable.

kSpace 

Only whitespace is ignorable.

Definition at line 355 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 326 of file options.hpp.


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