FSTs can be very space-inefficient on array-expanded nodes [LUCENE-8084]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
We have FSTs which operate on a larger alphabet (keys in int) space and emit character sequence outputs. I noticed that certain nodes get expanded into fixed-size arrays to accelerate lookups (binary search). This has a potential problem, however, when the outputs emit larger blobs of data (say, one of the outputs is very long, all the others are small). Then the fixed-size array is very much overallocated, as evident on the attached picture.
I wonder if it'd be better to encode the array as fixed-size, but without the outputs and use a local fixed-size pointer into a "value pool" somewhere next to the node's arcs. Theoretically this "value pool" could even be shared by all of automaton's nodes (saved once at the end or flushed periodically).
Just a thought.

---
Migrated from [LUCENE-8084](https://issues.apache.org/jira/browse/LUCENE-8084) by Dawid Weiss (@dweiss), updated Dec 21 2017
Attachments: [capture-4.png](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-8084/capture-4.png)
Linked issues:
- #5747
Contributor guide
Research direction
The issue concerns Lucene FSTs, array-expanded nodes, and large output blobs, but names no source files or tests. Start by locating the FST node encoding and its array-expansion path, then determine whether a value pool design is viable; done would require an agreed design, implementation, and space-efficiency validation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100