diff options
author | Adam Chelminski <adam.chelminski@mongodb.com> | 2015-07-29 15:05:21 -0400 |
---|---|---|
committer | Adam Chelminski <adam.chelminski@mongodb.com> | 2015-08-11 16:56:55 -0400 |
commit | 92eac3b57d8beaf063fced8839cd870f97826bb7 (patch) | |
tree | 0db84953876345d4725576538c14783cb81391e9 /src/mongo/db/matcher/expression_text.cpp | |
parent | 657343ccff986bd2f8c46fc7455db4238e8801d1 (diff) | |
download | mongo-92eac3b57d8beaf063fced8839cd870f97826bb7.tar.gz |
SERVER-19557 Add text index v3
Diffstat (limited to 'src/mongo/db/matcher/expression_text.cpp')
-rw-r--r-- | src/mongo/db/matcher/expression_text.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/mongo/db/matcher/expression_text.cpp b/src/mongo/db/matcher/expression_text.cpp index 34ea527e6ca..b5ccd9f40bd 100644 --- a/src/mongo/db/matcher/expression_text.cpp +++ b/src/mongo/db/matcher/expression_text.cpp @@ -38,10 +38,14 @@ using std::string; using std::unique_ptr; using stdx::make_unique; -Status TextMatchExpression::init(const string& query, const string& language, bool caseSensitive) { +Status TextMatchExpression::init(const string& query, + const string& language, + bool caseSensitive, + bool diacriticSensitive) { _query = query; _language = language; _caseSensitive = caseSensitive; + _diacriticSensitive = diacriticSensitive; return initPath("_fts"); } @@ -55,7 +59,8 @@ bool TextMatchExpression::matchesSingleElement(const BSONElement& e) const { void TextMatchExpression::debugString(StringBuilder& debug, int level) const { _debugAddSpace(debug, level); debug << "TEXT : query=" << _query << ", language=" << _language - << ", caseSensitive=" << _caseSensitive << ", tag="; + << ", caseSensitive=" << _caseSensitive << ", diacriticSensitive=" << _diacriticSensitive + << ", tag="; MatchExpression::TagData* td = getTag(); if (NULL != td) { td->debugString(&debug); @@ -68,7 +73,7 @@ void TextMatchExpression::debugString(StringBuilder& debug, int level) const { void TextMatchExpression::toBSON(BSONObjBuilder* out) const { out->append("$text", BSON("$search" << _query << "$language" << _language << "$caseSensitive" - << _caseSensitive)); + << _caseSensitive << "$diacriticSensitive" << _diacriticSensitive)); } bool TextMatchExpression::equivalent(const MatchExpression* other) const { @@ -88,12 +93,15 @@ bool TextMatchExpression::equivalent(const MatchExpression* other) const { if (realOther->getCaseSensitive() != _caseSensitive) { return false; } + if (realOther->getDiacriticSensitive() != _diacriticSensitive) { + return false; + } return true; } unique_ptr<MatchExpression> TextMatchExpression::shallowClone() const { unique_ptr<TextMatchExpression> next = make_unique<TextMatchExpression>(); - next->init(_query, _language, _caseSensitive); + next->init(_query, _language, _caseSensitive, _diacriticSensitive); if (getTag()) { next->setTag(getTag()->clone()); } |