summaryrefslogtreecommitdiff
path: root/jstests/core/fts_spanish.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/fts_spanish.js')
-rw-r--r--jstests/core/fts_spanish.js51
1 files changed, 23 insertions, 28 deletions
diff --git a/jstests/core/fts_spanish.js b/jstests/core/fts_spanish.js
index 89915cf2889..264e1d9125b 100644
--- a/jstests/core/fts_spanish.js
+++ b/jstests/core/fts_spanish.js
@@ -1,37 +1,32 @@
(function() {
- "use strict";
+"use strict";
- load("jstests/libs/fts.js");
+load("jstests/libs/fts.js");
- const coll = db.text_spanish;
- coll.drop();
+const coll = db.text_spanish;
+coll.drop();
- assert.writeOK(coll.insert({_id: 1, title: "mi blog", text: "Este es un blog de prueba"}));
- assert.writeOK(
- coll.insert({_id: 2, title: "mi segundo post", text: "Este es un blog de prueba"}));
- assert.writeOK(coll.insert(
- {_id: 3, title: "cuchillos son divertidos", text: "este es mi tercer blog stemmed"}));
- assert.writeOK(coll.insert({
- _id: 4,
- language: "en",
- title: "My fourth blog",
- text: "This stemmed blog is in english"
- }));
+assert.writeOK(coll.insert({_id: 1, title: "mi blog", text: "Este es un blog de prueba"}));
+assert.writeOK(coll.insert({_id: 2, title: "mi segundo post", text: "Este es un blog de prueba"}));
+assert.writeOK(coll.insert(
+ {_id: 3, title: "cuchillos son divertidos", text: "este es mi tercer blog stemmed"}));
+assert.writeOK(coll.insert(
+ {_id: 4, language: "en", title: "My fourth blog", text: "This stemmed blog is in english"}));
- // Create a text index, giving more weight to the "title" field.
- assert.commandWorked(coll.createIndex({title: "text", text: "text"},
- {weights: {title: 10}, default_language: "es"}));
+// Create a text index, giving more weight to the "title" field.
+assert.commandWorked(coll.createIndex({title: "text", text: "text"},
+ {weights: {title: 10}, default_language: "es"}));
- assert.eq(4, coll.count({$text: {$search: "blog"}}));
- assert.eq([4], queryIDS(coll, "stem"));
- assert.eq([3], queryIDS(coll, "stemmed"));
- assert.eq([4], queryIDS(coll, "stemmed", null, {"$language": "en"}));
- assert.eq([1, 2], queryIDS(coll, "prueba").sort());
+assert.eq(4, coll.count({$text: {$search: "blog"}}));
+assert.eq([4], queryIDS(coll, "stem"));
+assert.eq([3], queryIDS(coll, "stemmed"));
+assert.eq([4], queryIDS(coll, "stemmed", null, {"$language": "en"}));
+assert.eq([1, 2], queryIDS(coll, "prueba").sort());
- assert.writeError(coll.insert({_id: 5, language: "spanglish", title: "", text: ""}));
+assert.writeError(coll.insert({_id: 5, language: "spanglish", title: "", text: ""}));
- assert.commandWorked(coll.dropIndexes());
- assert.commandFailedWithCode(
- coll.createIndex({title: "text", text: "text"}, {default_language: "spanglish"}),
- ErrorCodes.CannotCreateIndex);
+assert.commandWorked(coll.dropIndexes());
+assert.commandFailedWithCode(
+ coll.createIndex({title: "text", text: "text"}, {default_language: "spanglish"}),
+ ErrorCodes.CannotCreateIndex);
}());