geonetwork / geonetwork/core-geonetwork

[lucene] instantiation issue with the LuceneOptimizerManager

Open
#2,771 3 comments 0 reactions 1 assignee Claimed by @cmangeat View on GitHub
bug stale
Dominant language
Java
Stars
521
Forks
515
Avg merge
6d 13h
Merged PRs (30d)
19

Description

Considering the following code: https://github.com/geonetwork/core-geonetwork/blob/develop/core/src/main/java/org/fao/geonet/kernel/search/LuceneOptimizerManager.java#L70-L74

If the first state of the optimizer is `enabled` set to `false`, the `_beginAt` member variable would never be initialized, causing any change in the admin UI (activating / deactivating the index optimizer) to fail with the following message:

```
Parameters saved but cannot restart Lucene Index Optimizer: **null**
```

Following the generated stacktrace lead me here:
```
https://github.com/geonetwork/core-geonetwork/blob/develop/core/src/main/java/org/fao/geonet/kernel/search/LuceneOptimizerManager.java?utf8=%E2%9C%93#L106
```

I guess the correct behaviour would be, regardless of the `enabled` value, to set the `_beginAt` variable in the constructor (even if the bean is actually deactivated).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.