@@ 1197-1210 (lines=14) @@ | ||
1194 | * @param string $field |
|
1195 | * @return \Sokil\Mongo\Collection |
|
1196 | */ |
|
1197 | public function ensure2dSphereIndex($field) |
|
1198 | { |
|
1199 | if (is_array($field)) { |
|
1200 | $keys = array_fill_keys($field, '2dsphere'); |
|
1201 | } else { |
|
1202 | $keys = array( |
|
1203 | $field => '2dsphere', |
|
1204 | ); |
|
1205 | } |
|
1206 | ||
1207 | $this->_mongoCollection->ensureIndex($keys); |
|
1208 | ||
1209 | return $this; |
|
1210 | } |
|
1211 | ||
1212 | /** |
|
1213 | * Create geo index 2dsphere |
|
@@ 1220-1233 (lines=14) @@ | ||
1217 | * @param string $field |
|
1218 | * @return \Sokil\Mongo\Collection |
|
1219 | */ |
|
1220 | public function ensure2dIndex($field) |
|
1221 | { |
|
1222 | if (is_array($field)) { |
|
1223 | $keys = array_fill_keys($field, '2d'); |
|
1224 | } else { |
|
1225 | $keys = array( |
|
1226 | $field => '2d', |
|
1227 | ); |
|
1228 | } |
|
1229 | ||
1230 | $this->_mongoCollection->ensureIndex($keys); |
|
1231 | ||
1232 | return $this; |
|
1233 | } |
|
1234 | ||
1235 | /** |
|
1236 | * Create fulltext index |