summaryrefslogtreecommitdiff
path: root/src/mongo/db/fts
diff options
context:
space:
mode:
authorBilly Donahue <billy.donahue@mongodb.com>2019-04-03 18:16:29 -0400
committerBilly Donahue <billy.donahue@mongodb.com>2019-04-08 12:15:08 -0400
commit573921791c4d20e0d1603fd0a200d90d74b65bd5 (patch)
tree9ec3957126fecc636cb31874376f09b6161965ff /src/mongo/db/fts
parentf8f872e029ba3b1f32d8499c912756d48dc1a03b (diff)
downloadmongo-573921791c4d20e0d1603fd0a200d90d74b65bd5.tar.gz
SERVER-40476 remove mongoutils::str::equals
Diffstat (limited to 'src/mongo/db/fts')
-rw-r--r--src/mongo/db/fts/fts_spec.cpp23
-rw-r--r--src/mongo/db/fts/fts_spec_legacy.cpp17
2 files changed, 21 insertions, 19 deletions
diff --git a/src/mongo/db/fts/fts_spec.cpp b/src/mongo/db/fts/fts_spec.cpp
index 49271fa99df..14bb7b8bfdc 100644
--- a/src/mongo/db/fts/fts_spec.cpp
+++ b/src/mongo/db/fts/fts_spec.cpp
@@ -147,7 +147,7 @@ FTSSpec::FTSSpec(const BSONObj& indexInfo) {
while (i.more()) {
BSONElement e = i.next();
- if (str::equals(e.fieldName(), "_fts") || str::equals(e.fieldName(), "_ftsx")) {
+ if ((e.fieldNameStringData() == "_fts") || (e.fieldNameStringData() == "_ftsx")) {
passedFTS = true;
continue;
}
@@ -293,13 +293,13 @@ StatusWith<BSONObj> FTSSpec::fixSpec(const BSONObj& spec) {
BSONObjIterator i(spec["key"].Obj());
while (i.more()) {
BSONElement e = i.next();
- if (str::equals(e.fieldName(), "_fts")) {
+ if (e.fieldNameStringData() == "_fts") {
if (INDEX_NAME != e.valuestrsafe()) {
return {ErrorCodes::CannotCreateIndex, "expecting _fts:\"text\""};
}
addedFtsStuff = true;
b.append(e);
- } else if (str::equals(e.fieldName(), "_ftsx")) {
+ } else if (e.fieldNameStringData() == "_ftsx") {
if (e.numberInt() != 1) {
return {ErrorCodes::CannotCreateIndex, "expecting _ftsx:1"};
}
@@ -346,13 +346,13 @@ StatusWith<BSONObj> FTSSpec::fixSpec(const BSONObj& spec) {
}
// text fields
- bool alreadyFixed = str::equals(e.fieldName(), "_fts");
+ bool alreadyFixed = (e.fieldNameStringData() == "_fts");
if (alreadyFixed) {
if (!i.more()) {
return {ErrorCodes::CannotCreateIndex, "expected _ftsx after _fts"};
}
e = i.next();
- if (!str::equals(e.fieldName(), "_ftsx")) {
+ if (e.fieldNameStringData() != "_ftsx") {
return {ErrorCodes::CannotCreateIndex, "expected _ftsx after _fts"};
}
e = i.next();
@@ -468,20 +468,21 @@ StatusWith<BSONObj> FTSSpec::fixSpec(const BSONObj& spec) {
BSONObjIterator i(spec);
while (i.more()) {
BSONElement e = i.next();
- if (str::equals(e.fieldName(), "key")) {
+ StringData fieldName = e.fieldNameStringData();
+ if (fieldName == "key") {
b.append("key", keyPattern);
- } else if (str::equals(e.fieldName(), "weights")) {
+ } else if (fieldName == "weights") {
b.append("weights", weights);
weights = BSONObj();
- } else if (str::equals(e.fieldName(), "default_language")) {
+ } else if (fieldName == "default_language") {
b.append("default_language", default_language);
default_language = "";
- } else if (str::equals(e.fieldName(), "language_override")) {
+ } else if (fieldName == "language_override") {
b.append("language_override", language_override);
language_override = "";
- } else if (str::equals(e.fieldName(), "v")) {
+ } else if (fieldName == "v") {
version = e.numberInt();
- } else if (str::equals(e.fieldName(), "textIndexVersion")) {
+ } else if (fieldName == "textIndexVersion") {
if (!e.isNumber()) {
return {ErrorCodes::CannotCreateIndex,
"text index option 'textIndexVersion' must be a number"};
diff --git a/src/mongo/db/fts/fts_spec_legacy.cpp b/src/mongo/db/fts/fts_spec_legacy.cpp
index f1e244c616e..dcb7357166b 100644
--- a/src/mongo/db/fts/fts_spec_legacy.cpp
+++ b/src/mongo/db/fts/fts_spec_legacy.cpp
@@ -206,11 +206,11 @@ StatusWith<BSONObj> FTSSpec::_fixSpecV1(const BSONObj& spec) {
BSONObjIterator i(spec["key"].Obj());
while (i.more()) {
BSONElement e = i.next();
- if (str::equals(e.fieldName(), "_fts") || str::equals(e.fieldName(), "_ftsx")) {
+ if ((e.fieldNameStringData() == "_fts") || (e.fieldNameStringData() == "_ftsx")) {
addedFtsStuff = true;
b.append(e);
} else if (e.type() == String &&
- (str::equals("fts", e.valuestr()) || str::equals("text", e.valuestr()))) {
+ (e.valueStringData() == "fts" || e.valueStringData() == "text")) {
if (!addedFtsStuff) {
_addFTSStuff(&b);
addedFtsStuff = true;
@@ -269,20 +269,21 @@ StatusWith<BSONObj> FTSSpec::_fixSpecV1(const BSONObj& spec) {
BSONObjIterator i(spec);
while (i.more()) {
BSONElement e = i.next();
- if (str::equals(e.fieldName(), "key")) {
+ StringData fieldName = e.fieldNameStringData();
+ if (fieldName == "key") {
b.append("key", keyPattern);
- } else if (str::equals(e.fieldName(), "weights")) {
+ } else if (fieldName == "weights") {
b.append("weights", weights);
weights = BSONObj();
- } else if (str::equals(e.fieldName(), "default_language")) {
+ } else if (fieldName == "default_language") {
b.append("default_language", default_language);
default_language = "";
- } else if (str::equals(e.fieldName(), "language_override")) {
+ } else if (fieldName == "language_override") {
b.append("language_override", language_override);
language_override = "";
- } else if (str::equals(e.fieldName(), "v")) {
+ } else if (fieldName == "v") {
version = e.numberInt();
- } else if (str::equals(e.fieldName(), "textIndexVersion")) {
+ } else if (fieldName == "textIndexVersion") {
textIndexVersion = e.numberInt();
if (textIndexVersion != 1) {
return {ErrorCodes::CannotCreateIndex,