apache / apache/lucene

Rethink Fields.size() returning -1 [LUCENE-4319]

Open
#5,387 2 comments 0 reactions 0 assignees View on GitHub
affects-version:4.0-BETA legacy-jira-priority:Major module:core/index type:task
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

Fields.size() is allowed to return -1, if size of iterator is unknown. But for all codecs, we know this size and also Fields implements Iterable (see also discussion on LUCENE-4315).

We should think about enfocing it to be defined.

Some things to do:
- Maybe automatically make Fields.size() base class iterate, if not reimplemented (risky!).
- MultiFields.size() must implement it

---
Migrated from [LUCENE-4319](https://issues.apache.org/jira/browse/LUCENE-4319) by Uwe Schindler (@uschindler)
Linked issues:
- #5383

Contributor guide

Open the contributing guide

Research direction

Start by reading the Fields and MultiFields APIs, then review the discussion on LUCENE-4315 and the linked issue #5383. Determine whether Fields.size() should be enforced or computed by a base implementation, and ensure MultiFields.size() follows the decided behavior across codecs.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Refactor
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.