@@ 1275-1288 (lines=14) @@ | ||
1272 | * @param string $field |
|
1273 | * @return \Sokil\Mongo\Collection |
|
1274 | */ |
|
1275 | public function ensure2dSphereIndex($field) |
|
1276 | { |
|
1277 | if (is_array($field)) { |
|
1278 | $keys = array_fill_keys($field, '2dsphere'); |
|
1279 | } else { |
|
1280 | $keys = array( |
|
1281 | $field => '2dsphere', |
|
1282 | ); |
|
1283 | } |
|
1284 | ||
1285 | $this->getMongoCollection()->createIndex($keys); |
|
1286 | ||
1287 | return $this; |
|
1288 | } |
|
1289 | ||
1290 | /** |
|
1291 | * Create geo index 2dsphere |
|
@@ 1298-1311 (lines=14) @@ | ||
1295 | * @param string $field |
|
1296 | * @return \Sokil\Mongo\Collection |
|
1297 | */ |
|
1298 | public function ensure2dIndex($field) |
|
1299 | { |
|
1300 | if (is_array($field)) { |
|
1301 | $keys = array_fill_keys($field, '2d'); |
|
1302 | } else { |
|
1303 | $keys = array( |
|
1304 | $field => '2d', |
|
1305 | ); |
|
1306 | } |
|
1307 | ||
1308 | $this->getMongoCollection()->createIndex($keys); |
|
1309 | ||
1310 | return $this; |
|
1311 | } |
|
1312 | ||
1313 | /** |
|
1314 | * Create fulltext index |