Skip to content

Commit

Permalink
Generate more analyzer/tokenizer/tokenfilter
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia committed Sep 26, 2024
1 parent e0c062e commit 759af88
Show file tree
Hide file tree
Showing 22 changed files with 375 additions and 344 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@
* GitHub history for details.
*/

//----------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------

package org.opensearch.client.opensearch._types.analysis;

import jakarta.json.stream.JsonGenerator;
import java.util.function.Function;
import javax.annotation.Generated;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
Expand All @@ -44,40 +49,41 @@
// typedef: _types.analysis.RemoveDuplicatesTokenFilter

@JsonpDeserializable
@Generated("org.opensearch.client.codegen.CodeGenerator")
public class RemoveDuplicatesTokenFilter extends TokenFilterBase implements TokenFilterDefinitionVariant {

// ---------------------------------------------------------------------------------------------

private RemoveDuplicatesTokenFilter(Builder builder) {
super(builder);

}

public static RemoveDuplicatesTokenFilter of(Function<Builder, ObjectBuilder<RemoveDuplicatesTokenFilter>> fn) {
public static RemoveDuplicatesTokenFilter of(
Function<RemoveDuplicatesTokenFilter.Builder, ObjectBuilder<RemoveDuplicatesTokenFilter>> fn
) {
return fn.apply(new Builder()).build();
}

/**
* TokenFilterDefinition variant kind.
* {@link TokenFilterDefinition} variant kind.
*/
@Override
public TokenFilterDefinition.Kind _tokenFilterDefinitionKind() {
return TokenFilterDefinition.Kind.RemoveDuplicates;
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.write("type", "remove_duplicates");
super.serializeInternal(generator, mapper);

}

// ---------------------------------------------------------------------------------------------

/**
* Builder for {@link RemoveDuplicatesTokenFilter}.
*/

public static class Builder extends TokenFilterBase.AbstractBuilder<Builder> implements ObjectBuilder<RemoveDuplicatesTokenFilter> {

@Override
protected Builder self() {
return this;
Expand All @@ -86,8 +92,7 @@ protected Builder self() {
/**
* Builds a {@link RemoveDuplicatesTokenFilter}.
*
* @throws NullPointerException
* if some of the required fields are null.
* @throws NullPointerException if some of the required fields are null.
*/
public RemoveDuplicatesTokenFilter build() {
_checkSingleUse();
Expand All @@ -107,9 +112,8 @@ public RemoveDuplicatesTokenFilter build() {
);

protected static void setupRemoveDuplicatesTokenFilterDeserializer(ObjectDeserializer<RemoveDuplicatesTokenFilter.Builder> op) {
TokenFilterBase.setupTokenFilterBaseDeserializer(op);
setupTokenFilterBaseDeserializer(op);

op.ignore("type");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@
* GitHub history for details.
*/

//----------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------

package org.opensearch.client.opensearch._types.analysis;

import jakarta.json.stream.JsonGenerator;
import java.util.function.Function;
import javax.annotation.Generated;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
Expand All @@ -44,40 +49,39 @@
// typedef: _types.analysis.ReverseTokenFilter

@JsonpDeserializable
@Generated("org.opensearch.client.codegen.CodeGenerator")
public class ReverseTokenFilter extends TokenFilterBase implements TokenFilterDefinitionVariant {

// ---------------------------------------------------------------------------------------------

private ReverseTokenFilter(Builder builder) {
super(builder);

}

public static ReverseTokenFilter of(Function<Builder, ObjectBuilder<ReverseTokenFilter>> fn) {
public static ReverseTokenFilter of(Function<ReverseTokenFilter.Builder, ObjectBuilder<ReverseTokenFilter>> fn) {
return fn.apply(new Builder()).build();
}

/**
* TokenFilterDefinition variant kind.
* {@link TokenFilterDefinition} variant kind.
*/
@Override
public TokenFilterDefinition.Kind _tokenFilterDefinitionKind() {
return TokenFilterDefinition.Kind.Reverse;
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.write("type", "reverse");
super.serializeInternal(generator, mapper);

}

// ---------------------------------------------------------------------------------------------

/**
* Builder for {@link ReverseTokenFilter}.
*/

public static class Builder extends TokenFilterBase.AbstractBuilder<Builder> implements ObjectBuilder<ReverseTokenFilter> {

@Override
protected Builder self() {
return this;
Expand All @@ -86,8 +90,7 @@ protected Builder self() {
/**
* Builds a {@link ReverseTokenFilter}.
*
* @throws NullPointerException
* if some of the required fields are null.
* @throws NullPointerException if some of the required fields are null.
*/
public ReverseTokenFilter build() {
_checkSingleUse();
Expand All @@ -111,5 +114,4 @@ protected static void setupReverseTokenFilterDeserializer(ObjectDeserializer<Rev

op.ignore("type");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@
* GitHub history for details.
*/

//----------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------

package org.opensearch.client.opensearch._types.analysis;

import jakarta.json.stream.JsonGenerator;
import java.util.function.Function;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
Expand All @@ -45,7 +50,9 @@
// typedef: _types.analysis.ShingleTokenFilter

@JsonpDeserializable
@Generated("org.opensearch.client.codegen.CodeGenerator")
public class ShingleTokenFilter extends TokenFilterBase implements TokenFilterDefinitionVariant {

@Nullable
private final String fillerToken;

Expand All @@ -68,22 +75,20 @@ public class ShingleTokenFilter extends TokenFilterBase implements TokenFilterDe

private ShingleTokenFilter(Builder builder) {
super(builder);

this.fillerToken = builder.fillerToken;
this.maxShingleSize = builder.maxShingleSize;
this.minShingleSize = builder.minShingleSize;
this.outputUnigrams = builder.outputUnigrams;
this.outputUnigramsIfNoShingles = builder.outputUnigramsIfNoShingles;
this.tokenSeparator = builder.tokenSeparator;

}

public static ShingleTokenFilter of(Function<Builder, ObjectBuilder<ShingleTokenFilter>> fn) {
public static ShingleTokenFilter of(Function<ShingleTokenFilter.Builder, ObjectBuilder<ShingleTokenFilter>> fn) {
return fn.apply(new Builder()).build();
}

/**
* TokenFilterDefinition variant kind.
* {@link TokenFilterDefinition} variant kind.
*/
@Override
public TokenFilterDefinition.Kind _tokenFilterDefinitionKind() {
Expand Down Expand Up @@ -139,64 +144,55 @@ public final String tokenSeparator() {
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.write("type", "shingle");
super.serializeInternal(generator, mapper);
if (this.fillerToken != null) {
generator.writeKey("filler_token");
generator.write(this.fillerToken);

}

if (this.maxShingleSize != null) {
generator.writeKey("max_shingle_size");
generator.write(this.maxShingleSize);

}

if (this.minShingleSize != null) {
generator.writeKey("min_shingle_size");
generator.write(this.minShingleSize);

}

if (this.outputUnigrams != null) {
generator.writeKey("output_unigrams");
generator.write(this.outputUnigrams);

}

if (this.outputUnigramsIfNoShingles != null) {
generator.writeKey("output_unigrams_if_no_shingles");
generator.write(this.outputUnigramsIfNoShingles);

}

if (this.tokenSeparator != null) {
generator.writeKey("token_separator");
generator.write(this.tokenSeparator);

}

}

// ---------------------------------------------------------------------------------------------

/**
* Builder for {@link ShingleTokenFilter}.
*/

public static class Builder extends TokenFilterBase.AbstractBuilder<Builder> implements ObjectBuilder<ShingleTokenFilter> {
@Nullable
private String fillerToken;

@Nullable
private String maxShingleSize;

@Nullable
private String minShingleSize;

@Nullable
private Boolean outputUnigrams;

@Nullable
private Boolean outputUnigramsIfNoShingles;

@Nullable
private String tokenSeparator;

Expand Down Expand Up @@ -256,8 +252,7 @@ protected Builder self() {
/**
* Builds a {@link ShingleTokenFilter}.
*
* @throws NullPointerException
* if some of the required fields are null.
* @throws NullPointerException if some of the required fields are null.
*/
public ShingleTokenFilter build() {
_checkSingleUse();
Expand Down Expand Up @@ -287,5 +282,4 @@ protected static void setupShingleTokenFilterDeserializer(ObjectDeserializer<Shi

op.ignore("type");
}

}
Loading

0 comments on commit 759af88

Please sign in to comment.