[SERVER-10363] User should be able to specify 2dsphere paramaters Created: 28/Jul/13 Updated: 06/Dec/22 Resolved: 12/Sep/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Geo |
| Affects Version/s: | 2.4.0 |
| Fix Version/s: | 2.6.0 |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Stephen Remde | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Done | Votes: | 2 |
| Labels: | indexing | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
all |
||
| Issue Links: |
|
||||||||||||||||||||||||
| Assigned Teams: |
Query
|
||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||
| Description |
|
My database has approximately 103 million documents representing polygons in the UK. Currently, a query for a 10x10m square can scan 500-100 rows and return 5. I know S2-geo-lib has the potential for cells of <2cm so I believe the default values in S2IndexingParams: maxCellsInCovering are inadequate for me at the moment, and so it would be beneficial to be able to set these upon index creation. |
| Comments |
| Comment by Asya Kamsky [ 12/Sep/17 ] |
|
This seems to have been fixed around version 2.5.5. |
| Comment by Stephen Remde [ 20/Jan/16 ] |
|
Dan Pasette - I think this can be closed now as finestIndexedLevel and coarsestIndexedLevel were already settable (but undocumented) and maxCellsInCovering is now implemented in |
| Comment by Kevin Albertson [ 24/Jul/15 ] |
|
|
| Comment by Daniel Pasette (Inactive) [ 09/Mar/14 ] |
|
This task is just missing maxCellsInCovering. finestIndexedLevel and coarsestIndexedLevel are settable at index creation time. |
| Comment by Stephen Remde [ 18/Feb/14 ] |
|
Hari Khalsa, Chris Lambert, see |
| Comment by Githook User [ 06/Jan/14 ] |
|
Author: {u'username': u'hkhalsa', u'name': u'Hari Khalsa', u'email': u'hkhalsa@10gen.com'}Message: |
| Comment by hari.khalsa@10gen.com [ 24/Nov/13 ] |
|
clambert@lyft.com Correct, the indexing and query code in the 2.5.x branch is in a state of flux and currently the extra 2dsphere parameters are ignored. I will fix it soon in 2.5.x. It should work in 2.4.x though. |
| Comment by Chris Lambert [ 24/Nov/13 ] |
|
I overwrote coarsestIndexedLevel and finestIndexedLevel, but I think they're not used when creating the s2 criteria for a querying. If I issue a very large (by coverage area) $geoWithin, no documents are returned unless they lie on the edges of my polygon. This made me think it was using the default value for coarsestIndexedLevel when covering the polygon for index, rather than the one specified in the index. Line 51 seems to confirm my suspicions, but I don't know the code enough to be sure: |
| Comment by hari.khalsa@10gen.com [ 18/Nov/13 ] |
|
clambert 2. Defaults: So, should be ~ 500m and 100km on a side. The idea was to be able to index continents but also search for things in a city. 3. Not that I know of. smremde I can make maxCells configurable. It should be in a 2.5.x. S2 uses it as an advisory parameter but hopefully it helps solve your problem. |
| Comment by Chris Lambert [ 12/Nov/13 ] |
|
We're considering rolling our own s2/geohash based indexing solution since we can't seem to get efficient performance from Mongo's built in geospatial indexing, even with the new 2dsphere index type. I just found this ticket, though, and tuning finestIndexedLevel and coarsestIndexedLevel seems like it would help substantially. Before going down this road, I'd love to know: 1) Are these index options safe to use? They don't seem to be documented anywhere, so I want to make sure we can use them safely without support being pulled from a future version. |
| Comment by Stephen Remde [ 07/Aug/13 ] |
|
So, from poking around the code, I found it is possible to set finestIndexedLevel and coarsestIndexedLevel, via the index options: db.collection.ensureIndex( {geometry:"2dsphere"}, {finestIndexedLevel:30, coarsestIndexedLevel:10}) This is enough for me IFF the default value for maxCellsInCovering was sensible. It is not. |