4
4
from django .db import connection
5
5
from django .test import TestCase
6
6
7
- from django_mongodb_backend .indexes import AtlasSearchIndex , AtlasVectorSearchIndex
7
+ from django_mongodb_backend .indexes import SearchIndex , VectorSearchIndex
8
8
9
9
from .models import Article , Data
10
10
@@ -34,7 +34,7 @@ def assertAddRemoveIndex(self, editor, model, index):
34
34
35
35
def test_simple (self ):
36
36
with connection .schema_editor () as editor :
37
- index = AtlasSearchIndex (
37
+ index = SearchIndex (
38
38
name = "recent_article_idx" ,
39
39
fields = ["number" ],
40
40
)
@@ -43,7 +43,7 @@ def test_simple(self):
43
43
44
44
def test_multiple_fields (self ):
45
45
with connection .schema_editor () as editor :
46
- index = AtlasSearchIndex (
46
+ index = SearchIndex (
47
47
name = "recent_article_idx" ,
48
48
fields = ["headline" , "number" , "body" , "data" , "embedded" , "auto_now" ],
49
49
)
@@ -83,7 +83,7 @@ def test_multiple_fields(self):
83
83
self .assertAddRemoveIndex (editor , Article , index )
84
84
85
85
def test_field_not_exists (self ):
86
- index = AtlasSearchIndex (
86
+ index = SearchIndex (
87
87
name = "recent_article_idx" ,
88
88
fields = ["headline" , "non_existing_name" ],
89
89
)
@@ -137,7 +137,7 @@ def assertAddRemoveIndex(self, editor, model, index):
137
137
138
138
def test_simple (self ):
139
139
with connection .schema_editor () as editor :
140
- index = AtlasSearchIndex (
140
+ index = SearchIndex (
141
141
name = "recent_article_idx" ,
142
142
fields = ["number" ],
143
143
)
@@ -146,7 +146,7 @@ def test_simple(self):
146
146
147
147
def test_multiple_fields (self ):
148
148
with connection .schema_editor () as editor :
149
- index = AtlasSearchIndex (
149
+ index = SearchIndex (
150
150
name = "recent_article_idx" ,
151
151
fields = ["headline" , "number" , "body" , "data" , "embedded" , "auto_now" ],
152
152
)
@@ -186,7 +186,7 @@ def test_multiple_fields(self):
186
186
self .assertAddRemoveIndex (editor , Article , index )
187
187
188
188
189
- class AtlasSearchIndexTests (TestCase ):
189
+ class SearchIndexTests (TestCase ):
190
190
# Schema editor is used to create the index to test that it works.
191
191
# available_apps = ["indexes"]
192
192
available_apps = None # could be removed?
@@ -209,9 +209,9 @@ def assertAddRemoveIndex(self, editor, model, index):
209
209
),
210
210
)
211
211
212
- def test_simple_atlas_vector_search (self ):
212
+ def test_simple_vector_search (self ):
213
213
with connection .schema_editor () as editor :
214
- index = AtlasVectorSearchIndex (
214
+ index = VectorSearchIndex (
215
215
name = "recent_article_idx" ,
216
216
fields = ["number" ],
217
217
)
@@ -220,7 +220,7 @@ def test_simple_atlas_vector_search(self):
220
220
221
221
def test_multiple_fields (self ):
222
222
with connection .schema_editor () as editor :
223
- index = AtlasVectorSearchIndex (
223
+ index = VectorSearchIndex (
224
224
name = "recent_article_idx" ,
225
225
fields = ["headline" , "number" , "body" , "description_embedded" ],
226
226
)
@@ -255,7 +255,7 @@ def test_multiple_fields(self):
255
255
self .assertAddRemoveIndex (editor , Article , index )
256
256
257
257
def test_field_not_exists (self ):
258
- index = AtlasVectorSearchIndex (
258
+ index = VectorSearchIndex (
259
259
name = "recent_article_idx" ,
260
260
fields = ["headline" , "non_existing_name" , "title_embedded" ],
261
261
)
@@ -267,7 +267,7 @@ def test_field_not_exists(self):
267
267
editor .add_index (index = index , model = Article )
268
268
269
269
270
- class AtlasSearchIndexTestsWithData (TestCase ):
270
+ class SearchIndexTestsWithData (TestCase ):
271
271
available_apps = None # could be removed?
272
272
273
273
@classmethod
@@ -307,9 +307,9 @@ def assertAddRemoveIndex(self, editor, model, index):
307
307
),
308
308
)
309
309
310
- def test_simple_atlas_vector_search (self ):
310
+ def test_simple_vector_search (self ):
311
311
with connection .schema_editor () as editor :
312
- index = AtlasVectorSearchIndex (
312
+ index = VectorSearchIndex (
313
313
name = "recent_article_idx" ,
314
314
fields = ["number" ],
315
315
)
@@ -318,7 +318,7 @@ def test_simple_atlas_vector_search(self):
318
318
319
319
def test_multiple_fields (self ):
320
320
with connection .schema_editor () as editor :
321
- index = AtlasVectorSearchIndex (
321
+ index = VectorSearchIndex (
322
322
name = "recent_article_idx" ,
323
323
fields = ["headline" , "number" , "body" , "description_embedded" ],
324
324
)
@@ -367,7 +367,7 @@ def test_corrupted_data(self):
367
367
number_list = [2 ] * 22 ,
368
368
name_list = [f"name_{ 2 } " ] * 7 ,
369
369
)
370
- index = AtlasVectorSearchIndex (
370
+ index = VectorSearchIndex (
371
371
name = "recent_article_idx" ,
372
372
fields = ["headline" , "number" , "body" , "description_embedded" ],
373
373
)
0 commit comments