@@ 1248-1261 (lines=14) @@ | ||
1245 | * @param string $field |
|
1246 | * @return \Sokil\Mongo\Collection |
|
1247 | */ |
|
1248 | public function ensure2dSphereIndex($field) |
|
1249 | { |
|
1250 | if (is_array($field)) { |
|
1251 | $keys = array_fill_keys($field, '2dsphere'); |
|
1252 | } else { |
|
1253 | $keys = array( |
|
1254 | $field => '2dsphere', |
|
1255 | ); |
|
1256 | } |
|
1257 | ||
1258 | $this->getMongoCollection()->createIndex($keys); |
|
1259 | ||
1260 | return $this; |
|
1261 | } |
|
1262 | ||
1263 | /** |
|
1264 | * Create geo index 2dsphere |
|
@@ 1271-1284 (lines=14) @@ | ||
1268 | * @param string $field |
|
1269 | * @return \Sokil\Mongo\Collection |
|
1270 | */ |
|
1271 | public function ensure2dIndex($field) |
|
1272 | { |
|
1273 | if (is_array($field)) { |
|
1274 | $keys = array_fill_keys($field, '2d'); |
|
1275 | } else { |
|
1276 | $keys = array( |
|
1277 | $field => '2d', |
|
1278 | ); |
|
1279 | } |
|
1280 | ||
1281 | $this->getMongoCollection()->createIndex($keys); |
|
1282 | ||
1283 | return $this; |
|
1284 | } |
|
1285 | ||
1286 | /** |
|
1287 | * Create fulltext index |