Skip to content

Commit 37186a6

Browse files
committed
Ensure that text search is fully ignored when running against MongoDB 2.4
1 parent bac3f04 commit 37186a6

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

driver-core/src/test/functional/com/mongodb/client/model/FiltersFunctionalSpecification.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ class FiltersFunctionalSpecification extends OperationFunctionalSpecification {
6868

6969
def setup() {
7070
getCollectionHelper().insertDocuments(a, b, c)
71-
getCollectionHelper().createIndex(new Document('y', 'text'))
7271
}
7372

7473
def 'find'(Bson filter) {
@@ -255,6 +254,9 @@ class FiltersFunctionalSpecification extends OperationFunctionalSpecification {
255254
@SuppressWarnings('deprecated')
256255
@IgnoreIf({ !serverVersionAtLeast(2, 6) })
257256
def 'should render $text'() {
257+
given:
258+
getCollectionHelper().createIndex(new Document('y', 'text'))
259+
258260
when:
259261
def textDocument = new Document('_id', 4).append('y', 'mongoDB for GIANT ideas')
260262
collectionHelper.insertDocuments(textDocument)

driver-core/src/test/functional/com/mongodb/client/model/IndexesFunctionalSpecification.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class IndexesFunctionalSpecification extends OperationFunctionalSpecification {
108108
getCollectionHelper().listIndexes()*.get('key').contains(parse('{x : "geoHaystack", b: -1}'))
109109
}
110110

111-
@IgnoreIf({ !serverVersionAtLeast(2, 4) })
111+
@IgnoreIf({ !serverVersionAtLeast(2, 6) })
112112
def 'text'() {
113113
when:
114114
getCollectionHelper().createIndex(text('x'))

driver-core/src/test/functional/com/mongodb/client/model/ProjectionFunctionalSpecification.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ class ProjectionFunctionalSpecification extends OperationFunctionalSpecification
5252

5353
def setup() {
5454
getCollectionHelper().insertDocuments(a)
55-
getCollectionHelper().createIndex(new Document('y', 'text'))
5655
}
5756

5857
def 'find'(Bson projection) {
@@ -101,6 +100,9 @@ class ProjectionFunctionalSpecification extends OperationFunctionalSpecification
101100

102101
@IgnoreIf({ !serverVersionAtLeast(2, 6) })
103102
def 'metaTextScore'() {
103+
given:
104+
getCollectionHelper().createIndex(new Document('y', 'text'))
105+
104106
expect:
105107
find(metaTextScore('score')) == [aWithScore]
106108
}

driver-core/src/test/functional/com/mongodb/client/model/SortsFunctionalSpecification.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class SortsFunctionalSpecification extends OperationFunctionalSpecification {
3939

4040
def setup() {
4141
getCollectionHelper().insertDocuments(a, b, c)
42-
getCollectionHelper().createIndex(new Document('y', 'text'))
4342
}
4443

4544
def 'find'(Bson sort) {
@@ -66,6 +65,9 @@ class SortsFunctionalSpecification extends OperationFunctionalSpecification {
6665

6766
@IgnoreIf({ !serverVersionAtLeast(2, 6) })
6867
def 'metaTextScore'() {
68+
given:
69+
getCollectionHelper().createIndex(new Document('y', 'text'))
70+
6971
expect:
7072
find(metaTextScore('score'), new Document('score', new Document('$meta', 'textScore')))*.containsKey('score')
7173
}

driver-core/src/test/functional/com/mongodb/operation/CreateIndexesOperationSpecification.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ class CreateIndexesOperationSpecification extends OperationFunctionalSpecificati
338338
async << [true, false]
339339
}
340340

341-
@IgnoreIf({ !serverVersionAtLeast(2, 4) })
341+
@IgnoreIf({ !serverVersionAtLeast(2, 6) })
342342
def 'should be able to create a textIndex'() {
343343
given:
344344
def operation = new CreateIndexesOperation(getNamespace(),
@@ -360,7 +360,7 @@ class CreateIndexesOperationSpecification extends OperationFunctionalSpecificati
360360
async << [true, false]
361361
}
362362

363-
@IgnoreIf({ !serverVersionAtLeast(2, 4) })
363+
@IgnoreIf({ !serverVersionAtLeast(2, 6) })
364364
def 'should be able to create a textIndexVersion'() {
365365
given:
366366
def operation = new CreateIndexesOperation(getNamespace(),

0 commit comments

Comments
 (0)