Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
4.7.2, 4.9
-
None
-
New
Description
The method removeFromParent of QueryNodeImpl, calls getChildren on the parent and removes any occurrence of "this" from the result.
However, since a few releases, getChildren returns a copy of the children list, so the code has no effect (except creating a copy of the children list which will then be thrown away).
Even worse, since setChildren calls removeFromParent on any previous child, setChildren now has a complexity of O(n^2) and creates a lot of throw-away copies of the children list (for nodes with a lot of children)
public void removeFromParent() { if (this.parent != null) { List<QueryNode> parentChildren = this.parent.getChildren(); Iterator<QueryNode> it = parentChildren.iterator(); while (it.hasNext()) { if (it.next() == this) { it.remove(); } } this.parent = null; } }
Attachments
Attachments
Issue Links
- is duplicated by
-
LUCENE-6865 BooleanQuery2ModifierNodeProcessor breaks the query node hierarchy
- Closed