Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Fixes #573. Changed segment names to match Lucene 4.8.0 and Lucene.NET 3.x #576

Merged
merged 1 commit into from
Dec 13, 2021

Conversation

NightOwl888
Copy link
Contributor

Fixes #573. This is a breaking change. The segment file names were being generated in base 10 rather than base 36 (Character.MaxRadix), which caused us to generate different segment file names than Lucene and Lucene.NET 3.x. This changes the base back to 36, but it means 4.8.0-beta00016 and beyond will not be able to read indexes produced by previous betas by default.

To fix this, we added a SegmentInfos.UseLegacySegmentNames setting to read 4.8.0-beta00001 thru 4.8.0-beta00015 indexes, which is false by default. Setting to true at application startup will enable reading indexes from prior beta versions (with broken segment names).

NOTE: We recommend regenerating your indexes, if possible, rather than using this "feature". Enabling this makes the file names inconsistent. Some methods were generating or parsing in the correct base/radix, but others were not. This restores the state to exactly how it was in 4.8.0-beta00015, but do note the inconsistency likely means that certain indexes with more than 10 segments will fail under certain use cases.

SegmentInfos.UseLegacySegmentNames = true;

Alternatively, set the system property "useLegacySegmentNames" to "true". Using the default setup, this can be done by adding an environment variable named "lucene:useLegacySegmentNames" with a value of "true".

The "useLegacySegmentNames" setting can be injected by supplying a custom Lucene.Net.Configuration.IConfigurationFactory using Lucene.Net.Configuration.ConfigurationSettings.SetConfigurationFactory(Configuration.IConfigurationFactory). See Configuration Providers in .NET for details about how to configure them. In general there should be 1 IConfiguration per application and it should be passed into the constructor of the IConfigurationFactory implementation and returned from the IConfigurationFactory.GetConfiguration() method.

See #307 for more information about system properties.

NOTE: The prefix "lucene:" only applies to environment variable names, all other system property names should exclude this prefix.

…ne.NET 3.x. This is a breaking change. Added a SegmentInfos.UseLegacySegmentNames to read 4.8.0-beta00001 thru 4.8.0-beta00015 indexes, which is false by default.
@NightOwl888 NightOwl888 merged commit 4c5b94c into apache:master Dec 13, 2021
@NightOwl888 NightOwl888 added this to the 4.8.0-beta00016 milestone Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect Index Segment Names
1 participant