-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added "smartcn" analyzer. Signed-off-by: pieper <[email protected]> * Adapted changelog. Signed-off-by: pieper <[email protected]> * Fixed license headers. Signed-off-by: pieper <[email protected]> * Fixed release number. Signed-off-by: pieper <[email protected]> --------- Signed-off-by: pieper <[email protected]>
- Loading branch information
1 parent
64dd87f
commit 1e68c31
Showing
8 changed files
with
399 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
...lient/src/main/java/org/opensearch/client/opensearch/_types/analysis/SmartcnAnalyzer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
package org.opensearch.client.opensearch._types.analysis; | ||
|
||
import java.util.function.Function; | ||
|
||
import org.opensearch.client.json.JsonpDeserializable; | ||
import org.opensearch.client.json.JsonpDeserializer; | ||
import org.opensearch.client.json.JsonpMapper; | ||
import org.opensearch.client.json.JsonpSerializable; | ||
import org.opensearch.client.json.ObjectBuilderDeserializer; | ||
import org.opensearch.client.json.ObjectDeserializer; | ||
import org.opensearch.client.util.ObjectBuilder; | ||
import org.opensearch.client.util.ObjectBuilderBase; | ||
|
||
import jakarta.json.stream.JsonGenerator; | ||
|
||
// typedef: _types.analysis.LanguageAnalyzer | ||
|
||
@JsonpDeserializable | ||
public class SmartcnAnalyzer implements AnalyzerVariant, JsonpSerializable { | ||
|
||
// --------------------------------------------------------------------------------------------- | ||
|
||
private SmartcnAnalyzer(Builder builder) { | ||
|
||
} | ||
|
||
public static SmartcnAnalyzer of(Function<Builder, ObjectBuilder<SmartcnAnalyzer>> fn) { | ||
return fn.apply(new Builder()).build(); | ||
} | ||
|
||
/** | ||
* Analyzer variant kind. | ||
*/ | ||
@Override | ||
public Analyzer.Kind _analyzerKind() { | ||
return Analyzer.Kind.Smartcn; | ||
} | ||
|
||
/** | ||
* Serialize this object to JSON. | ||
*/ | ||
public void serialize(JsonGenerator generator, JsonpMapper mapper) { | ||
generator.writeStartObject(); | ||
serializeInternal(generator, mapper); | ||
generator.writeEnd(); | ||
} | ||
|
||
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { | ||
|
||
generator.write("type", Analyzer.Kind.Smartcn.jsonValue()); | ||
|
||
} | ||
|
||
// --------------------------------------------------------------------------------------------- | ||
|
||
/** | ||
* Builder for {@link SmartcnAnalyzer}. | ||
*/ | ||
|
||
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<SmartcnAnalyzer> { | ||
|
||
/** | ||
* Builds a {@link SmartcnAnalyzer}. | ||
* | ||
* @throws NullPointerException | ||
* if some required fields are null. | ||
*/ | ||
public SmartcnAnalyzer build() { | ||
_checkSingleUse(); | ||
|
||
return new SmartcnAnalyzer(this); | ||
} | ||
} | ||
|
||
// --------------------------------------------------------------------------------------------- | ||
|
||
/** | ||
* Json deserializer for {@link SmartcnAnalyzer} | ||
*/ | ||
public static final JsonpDeserializer<SmartcnAnalyzer> _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, | ||
SmartcnAnalyzer::setupLanguageAnalyzerDeserializer); | ||
|
||
protected static void setupLanguageAnalyzerDeserializer(ObjectDeserializer<SmartcnAnalyzer.Builder> op) { | ||
|
||
op.ignore("type"); | ||
} | ||
|
||
} |
98 changes: 98 additions & 0 deletions
98
...rc/main/java/org/opensearch/client/opensearch/_types/analysis/SmartcnStopTokenFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
package org.opensearch.client.opensearch._types.analysis; | ||
|
||
import java.util.function.Function; | ||
|
||
import org.opensearch.client.json.JsonpDeserializable; | ||
import org.opensearch.client.json.JsonpDeserializer; | ||
import org.opensearch.client.json.JsonpMapper; | ||
import org.opensearch.client.json.ObjectBuilderDeserializer; | ||
import org.opensearch.client.json.ObjectDeserializer; | ||
import org.opensearch.client.util.ObjectBuilder; | ||
|
||
import jakarta.json.stream.JsonGenerator; | ||
|
||
// typedef: _types.analysis.ReverseTokenFilter | ||
|
||
@JsonpDeserializable | ||
public class SmartcnStopTokenFilter extends TokenFilterBase implements TokenFilterDefinitionVariant { | ||
// --------------------------------------------------------------------------------------------- | ||
|
||
private SmartcnStopTokenFilter(Builder builder) { | ||
super(builder); | ||
|
||
} | ||
|
||
public static SmartcnStopTokenFilter of(Function<Builder, ObjectBuilder<SmartcnStopTokenFilter>> fn) { | ||
return fn.apply(new Builder()).build(); | ||
} | ||
|
||
/** | ||
* TokenFilterDefinition variant kind. | ||
*/ | ||
@Override | ||
public TokenFilterDefinition.Kind _tokenFilterDefinitionKind() { | ||
return TokenFilterDefinition.Kind.SmartcnStop; | ||
} | ||
|
||
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { | ||
|
||
generator.write("type", TokenFilterDefinition.Kind.SmartcnStop.jsonValue()); | ||
super.serializeInternal(generator, mapper); | ||
|
||
} | ||
|
||
// --------------------------------------------------------------------------------------------- | ||
|
||
/** | ||
* Builder for {@link SmartcnStopTokenFilter}. | ||
*/ | ||
|
||
public static class Builder extends AbstractBuilder<Builder> | ||
implements | ||
ObjectBuilder<SmartcnStopTokenFilter> { | ||
@Override | ||
protected Builder self() { | ||
return this; | ||
} | ||
|
||
/** | ||
* Builds a {@link SmartcnStopTokenFilter}. | ||
* | ||
* @throws NullPointerException | ||
* if some required fields are null. | ||
*/ | ||
public SmartcnStopTokenFilter build() { | ||
_checkSingleUse(); | ||
|
||
return new SmartcnStopTokenFilter(this); | ||
} | ||
} | ||
|
||
// --------------------------------------------------------------------------------------------- | ||
|
||
/** | ||
* Json deserializer for {@link SmartcnStopTokenFilter} | ||
*/ | ||
public static final JsonpDeserializer<SmartcnStopTokenFilter> _DESERIALIZER = ObjectBuilderDeserializer | ||
.lazy(Builder::new, SmartcnStopTokenFilter::setupSmartcnStopTokenFilterDeserializer); | ||
|
||
protected static void setupSmartcnStopTokenFilterDeserializer(ObjectDeserializer<SmartcnStopTokenFilter.Builder> op) { | ||
setupTokenFilterBaseDeserializer(op); | ||
|
||
op.ignore("type"); | ||
} | ||
|
||
} |
97 changes: 97 additions & 0 deletions
97
...ient/src/main/java/org/opensearch/client/opensearch/_types/analysis/SmartcnTokenizer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
package org.opensearch.client.opensearch._types.analysis; | ||
|
||
import java.util.function.Function; | ||
|
||
import org.opensearch.client.json.JsonpDeserializable; | ||
import org.opensearch.client.json.JsonpDeserializer; | ||
import org.opensearch.client.json.JsonpMapper; | ||
import org.opensearch.client.json.ObjectBuilderDeserializer; | ||
import org.opensearch.client.json.ObjectDeserializer; | ||
import org.opensearch.client.util.ObjectBuilder; | ||
|
||
import jakarta.json.stream.JsonGenerator; | ||
|
||
// typedef: _types.analysis.IcuTokenizer | ||
|
||
@JsonpDeserializable | ||
public class SmartcnTokenizer extends TokenizerBase implements TokenizerDefinitionVariant { | ||
// --------------------------------------------------------------------------------------------- | ||
|
||
private SmartcnTokenizer(Builder builder) { | ||
super(builder); | ||
|
||
} | ||
|
||
public static SmartcnTokenizer of(Function<Builder, ObjectBuilder<SmartcnTokenizer>> fn) { | ||
return fn.apply(new Builder()).build(); | ||
} | ||
|
||
/** | ||
* TokenizerDefinition variant kind. | ||
*/ | ||
@Override | ||
public TokenizerDefinition.Kind _tokenizerDefinitionKind() { | ||
return TokenizerDefinition.Kind.SmartcnTokenizer; | ||
} | ||
|
||
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { | ||
|
||
generator.write("type", TokenizerDefinition.Kind.SmartcnTokenizer.jsonValue()); | ||
super.serializeInternal(generator, mapper); | ||
|
||
} | ||
|
||
// --------------------------------------------------------------------------------------------- | ||
|
||
/** | ||
* Builder for {@link SmartcnTokenizer}. | ||
*/ | ||
|
||
public static class Builder extends AbstractBuilder<Builder> implements ObjectBuilder<SmartcnTokenizer> { | ||
|
||
@Override | ||
protected Builder self() { | ||
return this; | ||
} | ||
|
||
/** | ||
* Builds a {@link SmartcnTokenizer}. | ||
* | ||
* @throws NullPointerException | ||
* if some required fields are null. | ||
*/ | ||
public SmartcnTokenizer build() { | ||
_checkSingleUse(); | ||
|
||
return new SmartcnTokenizer(this); | ||
} | ||
} | ||
|
||
// --------------------------------------------------------------------------------------------- | ||
|
||
/** | ||
* Json deserializer for {@link SmartcnTokenizer} | ||
*/ | ||
public static final JsonpDeserializer<SmartcnTokenizer> _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, | ||
SmartcnTokenizer::setupSmartcnTokenizerDeserializer); | ||
|
||
protected static void setupSmartcnTokenizerDeserializer(ObjectDeserializer<SmartcnTokenizer.Builder> op) { | ||
TokenizerBase.setupTokenizerBaseDeserializer(op); | ||
|
||
op.ignore("type"); | ||
} | ||
|
||
} |
Oops, something went wrong.