1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// Integration tests for {$caseSensitive: true} option to $text query operator.
load('jstests/libs/fts.js');
var coll = db.fts_casesensitive;
coll.drop();
assert.writeOK(coll.insert({_id: 0, a: "The Quick Brown Fox Jumps Over The Lazy Dog"}));
assert.commandWorked(coll.ensureIndex({a: "text"}));
assert.throws(function() {
queryIDS(coll, "hello", null, {$caseSensitive: "invalid"});
});
assert.eq([0], queryIDS(coll, "The quick Brown", null, {$caseSensitive: true}));
assert.eq([0], queryIDS(coll, "Jumped", null, {$caseSensitive: true}));
assert.eq([0], queryIDS(coll, "\"Quick\"", null, {$caseSensitive: true}));
assert.eq([0], queryIDS(coll, "\"Fox\" Jumped", null, {$caseSensitive: true}));
assert.eq([0], queryIDS(coll, "\"Fox Jumps\" \"Over The\"", null, {$caseSensitive: true}));
assert.eq([0], queryIDS(coll, "\"Fox Jumps\" -\"over the\"", null, {$caseSensitive: true}));
assert.eq([], queryIDS(coll, "The", null, {$caseSensitive: true}));
assert.eq([], queryIDS(coll, "quick", null, {$caseSensitive: true}));
assert.eq([], queryIDS(coll, "The quick brown", null, {$caseSensitive: true}));
assert.eq([], queryIDS(coll, "The -quick -brown", null, {$caseSensitive: true}));
assert.eq([], queryIDS(coll, "The quick -brown", null, {$caseSensitive: true}));
assert.eq([], queryIDS(coll, "he Quic", null, {$caseSensitive: true}));
assert.eq([], queryIDS(coll, "\"over the\"", null, {$caseSensitive: true}));
assert.eq([], queryIDS(coll, "\"Fox Jumps\" -\"Over The\"", null, {$caseSensitive: true}));
|