apache / apache/lucene

Add type of triangle info to ShapeField encoding [LUCENE-8997]

Open
#10,040 4 comments 0 reactions 0 assignees View on GitHub
legacy-jira-priority:Minor type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

We are currently encoding three type of triangle in ShapeField:
- POINT: all three coordinates are equal
- LINE: two coordinates are equal
- TRIANGLE: all coordinates are different

Because we still have two unused bits, it might be worthy to encode this information in those two bits as follows:
- 0 0 : Unknown so this is an index created before adding this information. We can compute in this case the information while decoding for backwards compatibility.
- 1 0: The encoded triangle is a POINT
- 0 1: The encoded triangle is a LINE
- 1 1: The encoded triangle is a TRIANGLE

We can later leverage this information so we don't need to decode all dimensions in case of POINT and LINE and we are currently computing in some of the methods ithe type of triangle we are dealing with, This will go as well.

---
Migrated from [LUCENE-8997](https://issues.apache.org/jira/browse/LUCENE-8997) by Ignacio Vera (@iverase), updated Jan 08 2020

Contributor guide

Open the contributing guide

Research direction

Start by locating ShapeField's triangle encoding and decoding paths, then inspect the methods that currently compute whether a triangle is a POINT, LINE, or TRIANGLE. The work is done when the two unused bits represent the three types, preserve the unknown value for older indexes, and decoding remains backward compatible.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.