apache / apache/lucene

Document. add get(i) and addAll to make interacting with fieldables and documents easier/faster and more readable [LUCENE-2540]

Open
#3,614 4 comments 0 reactions 0 assignees View on GitHub
affects-version:3.0.2 legacy-jira-fix-version:4.9 legacy-jira-fix-version:6.0 legacy-jira-label:dead legacy-jira-priority:Major module:core/other type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

Working with Document Fieldables is often a pain.
getting the ith involves chained method calls and is not very readable:

```Java
// nice
doc.getFieldable(i);

// not nice
doc.getFields().get(i);
```

also, when combining documents, or otherwise aggregating multiple fields into a single document,

```Java
// nice
doc.addAll(fieldables);

// note nice: less readable and more error prone
List fields = ...;
for (Fieldable field : fields) {
result.add(field);
}
```

---
Migrated from [LUCENE-2540](https://issues.apache.org/jira/browse/LUCENE-2540) by Woody Anderson, updated May 09 2016
Attachments: [LUCENE-2540.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-2540/LUCENE-2540.patch)

Contributor guide

Open the contributing guide

Research direction

Start at the Document API and its Fieldable access shown in the issue, then review the linked LUCENE-2540.patch for the intended scope. Done means Document supports the requested get(i) and addAll interactions described in the examples, with relevant tests passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design, search
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.