Deleting items breaks the index
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 683
- Forks
- 129
- Avg merge
- 15m
- Merged PRs (30d)
- 2
Description
I'm new with rtree (and R-trees in general) and I don't know how an R-tree is implemented (I just know the high-level theory), but I've found a weird behavior when trying to delete items from an index.
For an index with a few items, deleting some of them generally doesn't break anything. However, when complexity grows and I delete one item, points that before matched with other items stop doing it.
As I don't understand this behavior, I created a repo with a sample code to illustrate my problem. This code just:
- Reads a list of countries geometries from a geojson file.
- Adds every polygon bounds to an index (using a UUID for each polygon).
- Generates one point for each polygon.
- Checks every generated point has at least one match using the index.
- Deletes the polygons of only one country.
- Checks every generated point again.
- Prints the data of every point without matches with its country.
In the example, I'm deleting all USA polygons, but all the points inside USA keeps matching. However, other points from other countries fail, even though I didn't remove its country from the index.
Maybe I'm missing something about R-trees, but I think this doesn't make sense. Chances are I'm using it wrong, but I don't know why. I'm sorry this issue involves some work to check, but would appreciate some help.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked rtree_deletion_issue reproduction and follow its GeoJSON loading, index insertion, point-query, and deletion sequence. Compare the matches before and after deleting the USA polygons; the issue is resolved when points for other countries continue to match after that deletion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100