apache / apache/lucene

remove or fix IndexWriter.tryDeleteDocument [LUCENE-6384]

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

Description

This method is causing bugs in tests, I think its a trap.

I don't think people understand the semantics of it, and i don't like that its difficult for it to return false in tests

So its unlikely to return false in tests, only in production. Broken just like java 7 string hashing.

I think we should either remove it, rename it, fix the javadocs let IndexWriter create a random and intentionally return false from this method say 1% of the time to make it less trappy, something.

---
Migrated from [LUCENE-6384](https://issues.apache.org/jira/browse/LUCENE-6384) by Robert Muir (@rmuir)

Contributor guide

Open the contributing guide

Research direction

Start at IndexWriter.tryDeleteDocument and inspect its callers and the tests that exercise it. Compare the documented and observed return semantics, especially the difficulty of producing false in tests. Done requires a decided direction—removal, renaming, corrected documentation, or deliberate test coverage—and corresponding validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.