-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Introduce Serbian analyzer #14571
base: main
Are you sure you want to change the base?
Introduce Serbian analyzer #14571
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
/* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
package org.opensearch.analysis.common; | ||
|
||
import org.apache.lucene.analysis.CharArraySet; | ||
import org.apache.lucene.analysis.sr.SerbianAnalyzer; | ||
import org.opensearch.common.settings.Settings; | ||
import org.opensearch.env.Environment; | ||
import org.opensearch.index.IndexSettings; | ||
import org.opensearch.index.analysis.AbstractIndexAnalyzerProvider; | ||
import org.opensearch.index.analysis.Analysis; | ||
|
||
public class SerbianAnalyzerProvider extends AbstractIndexAnalyzerProvider<SerbianAnalyzer> { | ||
|
||
private final SerbianAnalyzer analyzer; | ||
|
||
SerbianAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { | ||
|
||
super(indexSettings, name, settings); | ||
analyzer = new SerbianAnalyzer( | ||
Analysis.parseStopWords(env, settings, SerbianAnalyzer.getDefaultStopSet()), | ||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET) | ||
Check warning on line 52 in modules/analysis-common/src/main/java/org/opensearch/analysis/common/SerbianAnalyzerProvider.java Codecov / codecov/patchmodules/analysis-common/src/main/java/org/opensearch/analysis/common/SerbianAnalyzerProvider.java#L49-L52
|
||
); | ||
} | ||
Check warning on line 54 in modules/analysis-common/src/main/java/org/opensearch/analysis/common/SerbianAnalyzerProvider.java Codecov / codecov/patchmodules/analysis-common/src/main/java/org/opensearch/analysis/common/SerbianAnalyzerProvider.java#L54
|
||
|
||
@Override | ||
public SerbianAnalyzer get() { | ||
|
||
return this.analyzer; | ||
Check warning on line 59 in modules/analysis-common/src/main/java/org/opensearch/analysis/common/SerbianAnalyzerProvider.java Codecov / codecov/patchmodules/analysis-common/src/main/java/org/opensearch/analysis/common/SerbianAnalyzerProvider.java#L59
|
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a new file so it doesn't need an Elasticsearch license. The license header above this one is sufficient.
Can you also please confirm that this is not a copy of any non-open-source-APLv2-elasticsearch code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with your assessment and will update the file accordingly.
I am not entirely sure how to verify non-open-source-APLv2-elasticsearch code on my own and would appreciate your confirmation to ensure everything is compliant.