apache / lucene

Apache Lucene open-source search software
https://lucene.apache.org/
Apache License 2.0
2.61k stars 1.02k forks source link

gh-13340: Allow adding a parent field to an index with no fields #13341

Closed msokolov closed 4 months ago

msokolov commented 4 months ago

Addresses #13340 . It relaxes the previous rule that adding a parent field to an existing index is always forbidden, allowing it in the case where no fields have been created. In such a case it will be safe, and this enables the trivial case of opening and closing a new empty index twice to work in a sensible way.

msokolov commented 4 months ago

hm maybe this is not safe? If one creates a doc block filled with empty documents? I'm not sure ... OTOH if they have no fields how can it ever matter what one does with them?!

msokolov commented 4 months ago

I'll push since there don't seem to be any concerns raised. If we later want to make the index metadata a first-class file on its own we can always do that.

kkrik-es commented 3 months ago

Would it be possible to back-port this fix to v.9.11? I did hit this issue as well while trying to make use of #12829.

msokolov commented 3 months ago

I don't think we can backport to 9.11 since it has already been released, but I will backport to 9.x and then it should get released with the next. There was some talk about a 9.11.1, so maybe it would be in that?

kkrik-es commented 3 months ago

That would be nice, thanks. @jpountz @benwtrent fyi.

benwtrent commented 3 months ago

@msokolov it might be worth doing a 9.11.1 release to fix this particular bug and maybe another other one: https://github.com/apache/lucene/pull/13475

I didn't know about this outstanding bug (parent field with empty index) when I originally did the 9.11 release, I should have investigated.

msokolov commented 3 months ago

sigh, I would have backported right away except for some reason I thought the parent-field enforcement was only on 10.x not 9.x