apache / apache/lucene

getPath in DirectoryTaxonomyReader should throw an exception [LUCENE-9460]

Open
#10,500 1 comment 0 reactions 0 assignees View on GitHub
affects-version:8.5.2 legacy-jira-priority:Trivial module:facet type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

This issue is a spillover from [LUCENE-9450 PR](https://github.com/apache/lucene-solr/pull/1733) and was suggested by @mikemccand

If the `ordinal` is out of bound it indicates that the user called their main `IndexReader` and the `TaxonomyReader` in the wrong order. 

In this case, we should throw an `IllegalArgumentException` to warn the user instead of returning `null`

---
Migrated from [LUCENE-9460](https://issues.apache.org/jira/browse/LUCENE-9460) by Gautam Worah (@gautamworah96), updated Aug 31 2021

Contributor guide

Open the contributing guide

Research direction

Locate DirectoryTaxonomyReader.getPath and read how it handles an out-of-bounds ordinal. Reproduce or inspect the invalid-order case described in the issue, then add coverage where appropriate. Done means an out-of-bounds ordinal raises IllegalArgumentException instead of returning null.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.