@@ 1185-1198 (lines=14) @@ | ||
1182 | * @param string $field |
|
1183 | * @return \Sokil\Mongo\Collection |
|
1184 | */ |
|
1185 | public function ensure2dSphereIndex($field) |
|
1186 | { |
|
1187 | if (is_array($field)) { |
|
1188 | $keys = array_fill_keys($field, '2dsphere'); |
|
1189 | } else { |
|
1190 | $keys = array( |
|
1191 | $field => '2dsphere', |
|
1192 | ); |
|
1193 | } |
|
1194 | ||
1195 | $this->_mongoCollection->ensureIndex($keys); |
|
1196 | ||
1197 | return $this; |
|
1198 | } |
|
1199 | ||
1200 | /** |
|
1201 | * Create geo index 2dsphere |
|
@@ 1208-1221 (lines=14) @@ | ||
1205 | * @param string $field |
|
1206 | * @return \Sokil\Mongo\Collection |
|
1207 | */ |
|
1208 | public function ensure2dIndex($field) |
|
1209 | { |
|
1210 | if (is_array($field)) { |
|
1211 | $keys = array_fill_keys($field, '2d'); |
|
1212 | } else { |
|
1213 | $keys = array( |
|
1214 | $field => '2d', |
|
1215 | ); |
|
1216 | } |
|
1217 | ||
1218 | $this->_mongoCollection->ensureIndex($keys); |
|
1219 | ||
1220 | return $this; |
|
1221 | } |
|
1222 | ||
1223 | /** |
|
1224 | * Create fulltext index |