apache / apache/lucene

facet by polygon [LUCENE-8368]

Open
#9,415 8 comments 0 reactions 0 assignees View on GitHub
legacy-jira-priority:Major module:facet type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

This can give some nice flexibility if you are working with search results on a map. Of course if everything about your use-case is static, its better to compute this up-front and index string values, but its not always the case. Also it can be helpful if your polygons are changing often, since you don't have to reindex.

Polygon2D already supports multipolygons, but today it only returns a boolean value. This patch adds a `find` method that returns the polygon that actually matched, or -1 if it doesn't match. `contains` is then just written as `find >= 0`.

Then we can solve the problem with just some sugar over the existing range faceting, as each multipolygon is just a range of ids coming back from `find` that correspond with it. e.g. if you were faceting by country, you might have \~200 countries with 100,000 total polygons, and polygons 22,000-32,000 correspond to Canada or whatever.

---
Migrated from [LUCENE-8368](https://issues.apache.org/jira/browse/LUCENE-8368) by Robert Muir (@rmuir), updated Jun 25 2018
Attachments: [LUCENE-8368_hacky_grid.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-8368/LUCENE-8368_hacky_grid.patch) (versions: 3), [LUCENE-8368.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-8368/LUCENE-8368.patch)

Contributor guide

Open the contributing guide

Research direction

Start with Polygon2D and its existing contains method, then inspect the range-faceting code that would consume polygon ids. Review the attached LUCENE-8368 patches for the proposed entry points and run the related spatial and faceting tests. Done means find identifies the matching polygon, contains preserves boolean behavior, and polygon-based faceting works for multipolygons.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.