apache / apache/lucene

Impossible to delete doc by docId, undeleteAll or setNorm(docId..) [LUCENE-3828]

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

Description

It appears that there is a major regression in the trunk API. It's no longer possible to:
1. delete document by internal id (even though you can iterate and retrieve docs by internal ids)
2. undelete all deleted (but not yet reclaimed) documents
3. set norm value on a specific document (by internal id)

The lack of `#1` means that you have to use delete by term or by query, which in turn means that now we require that documents have a unique primary key (otherwise you won't be able to delete a particular document that shares terms with other docs). IMHO this item is critical and should be fixed.

The lack of `#2` might not be critical but it still comes handy in some situations.

The lack of `#3` means that you have to update the whole doc if you just want to correct one field, which might be ok for the time being - it's a special case of not having updateable fields in general. But it's quite inconvenient if all you want to do is to adjust a weight of doc without reindexing, something that is possible with 3.x.

---
Migrated from [LUCENE-3828](https://issues.apache.org/jira/browse/LUCENE-3828) by Andrzej Bialecki (@sigram)

Contributor guide

Open the contributing guide

Research direction

Start by locating the current Lucene APIs for deleting by internal document ID, undeleting all documents, and setting norms by document ID, then compare their behavior with the 3.x API. Reproduce each missing operation and trace the affected index-writer or reader entry points; done means all three operations work without requiring a term or query replacement.

Written by the indexing model from the issue text.

Assessment

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