Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.2.0"
".": "2.3.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 14
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/turbopuffer-benesch/turbopuffer-9b2e78ecf00c29be34999750978f9e4773a27c1a295599aded219c00a50623c0.yml
openapi_spec_hash: 6b35fa549f0b4682714f45c28cc9246a
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/turbopuffer-benesch/turbopuffer-17e5bcde1d39d5673f2b1bf4446afa000d90a0fdb9ae4b86a05bd15f12f9e547.yml
openapi_spec_hash: 4aaf757ac332b99a28f9a44a47891a5f
config_hash: bab72dc9f937352c7a01a37dadd44122
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 2.3.0 (2026-06-08)

Full Changelog: [v2.2.0...v2.3.0](https://github.com/turbopuffer/turbopuffer-java/compare/v2.2.0...v2.3.0)

### Features

* stainless: update sdks to support case-insensitive fuzzy filter ([de8fd29](https://github.com/turbopuffer/turbopuffer-java/commit/de8fd291b48f9332c357833c613911391f1bd3d8))

## 2.2.0 (2026-06-03)

Full Changelog: [v2.2.0-alpha.1...v2.2.0](https://github.com/turbopuffer/turbopuffer-java/compare/v2.2.0-alpha.1...v2.2.0)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<!-- x-release-please-start-version -->

[![Maven Central](https://img.shields.io/maven-central/v/com.turbopuffer/turbopuffer-java)](https://central.sonatype.com/artifact/com.turbopuffer/turbopuffer-java/2.2.0)
[![javadoc](https://javadoc.io/badge2/com.turbopuffer/turbopuffer-java/2.2.0/javadoc.svg)](https://javadoc.io/doc/com.turbopuffer/turbopuffer-java/2.2.0)
[![Maven Central](https://img.shields.io/maven-central/v/com.turbopuffer/turbopuffer-java)](https://central.sonatype.com/artifact/com.turbopuffer/turbopuffer-java/2.3.0)
[![javadoc](https://javadoc.io/badge2/com.turbopuffer/turbopuffer-java/2.3.0/javadoc.svg)](https://javadoc.io/doc/com.turbopuffer/turbopuffer-java/2.3.0)

<!-- x-release-please-end -->

Expand All @@ -22,7 +22,7 @@ Use the turbopuffer MCP Server to enable AI assistants to interact with this API

<!-- x-release-please-start-version -->

The REST API documentation can be found at [turbopuffer.com/docs/overview](https://turbopuffer.com/docs/overview). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.turbopuffer/turbopuffer-java/2.2.0).
The REST API documentation can be found at [turbopuffer.com/docs/overview](https://turbopuffer.com/docs/overview). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.turbopuffer/turbopuffer-java/2.3.0).

<!-- x-release-please-end -->

Expand All @@ -33,7 +33,7 @@ The REST API documentation can be found at [turbopuffer.com/docs/overview](https
### Gradle

```kotlin
implementation("com.turbopuffer:turbopuffer-java:2.2.0")
implementation("com.turbopuffer:turbopuffer-java:2.3.0")
```

### Maven
Expand All @@ -42,7 +42,7 @@ implementation("com.turbopuffer:turbopuffer-java:2.2.0")
<dependency>
<groupId>com.turbopuffer</groupId>
<artifactId>turbopuffer-java</artifactId>
<version>2.2.0</version>
<version>2.3.0</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repositories {

allprojects {
group = "com.turbopuffer"
version = "2.2.0" // x-release-please-version
version = "2.3.0" // x-release-please-version
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,27 @@ import com.turbopuffer.core.toImmutable
import com.turbopuffer.errors.TurbopufferInvalidDataException
import java.util.Collections
import java.util.Objects
import java.util.Optional
import kotlin.jvm.optionals.getOrNull

/** Additional parameters for the Fuzzy filter. */
class FuzzyParams
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val maxEditDistance: JsonField<List<FuzzyMaxEditDistance>>,
private val caseSensitive: JsonField<Boolean>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {

@JsonCreator
private constructor(
@JsonProperty("max_edit_distance")
@ExcludeMissing
maxEditDistance: JsonField<List<FuzzyMaxEditDistance>> = JsonMissing.of()
) : this(maxEditDistance, mutableMapOf())
maxEditDistance: JsonField<List<FuzzyMaxEditDistance>> = JsonMissing.of(),
@JsonProperty("case_sensitive")
@ExcludeMissing
caseSensitive: JsonField<Boolean> = JsonMissing.of(),
) : this(maxEditDistance, caseSensitive, mutableMapOf())

/**
* Maximum edit distance allowed at each query length. Queries shorter than the first threshold
Expand All @@ -43,6 +48,15 @@ private constructor(
fun maxEditDistance(): List<FuzzyMaxEditDistance> =
maxEditDistance.getRequired("max_edit_distance")

/**
* Whether searching with Fuzzy filter is case-sensitive. Defaults to `true` (i.e.
* case-sensitive).
*
* @throws TurbopufferInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun caseSensitive(): Optional<Boolean> = caseSensitive.getOptional("case_sensitive")

/**
* Returns the raw JSON value of [maxEditDistance].
*
Expand All @@ -52,6 +66,15 @@ private constructor(
@ExcludeMissing
fun _maxEditDistance(): JsonField<List<FuzzyMaxEditDistance>> = maxEditDistance

/**
* Returns the raw JSON value of [caseSensitive].
*
* Unlike [caseSensitive], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("case_sensitive")
@ExcludeMissing
fun _caseSensitive(): JsonField<Boolean> = caseSensitive

@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
Expand Down Expand Up @@ -81,11 +104,13 @@ private constructor(
class Builder internal constructor() {

private var maxEditDistance: JsonField<MutableList<FuzzyMaxEditDistance>>? = null
private var caseSensitive: JsonField<Boolean> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
internal fun from(fuzzyParams: FuzzyParams) = apply {
maxEditDistance = fuzzyParams.maxEditDistance.map { it.toMutableList() }
caseSensitive = fuzzyParams.caseSensitive
additionalProperties = fuzzyParams.additionalProperties.toMutableMap()
}

Expand Down Expand Up @@ -119,6 +144,23 @@ private constructor(
}
}

/**
* Whether searching with Fuzzy filter is case-sensitive. Defaults to `true` (i.e.
* case-sensitive).
*/
fun caseSensitive(caseSensitive: Boolean) = caseSensitive(JsonField.of(caseSensitive))

/**
* Sets [Builder.caseSensitive] to an arbitrary JSON value.
*
* You should usually call [Builder.caseSensitive] with a well-typed [Boolean] value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun caseSensitive(caseSensitive: JsonField<Boolean>) = apply {
this.caseSensitive = caseSensitive
}

fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
Expand Down Expand Up @@ -153,6 +195,7 @@ private constructor(
fun build(): FuzzyParams =
FuzzyParams(
checkRequired("maxEditDistance", maxEditDistance).map { it.toImmutable() },
caseSensitive,
additionalProperties.toMutableMap(),
)
}
Expand All @@ -173,6 +216,7 @@ private constructor(
}

maxEditDistance().forEach { it.validate() }
caseSensitive()
validated = true
}

Expand All @@ -191,7 +235,8 @@ private constructor(
*/
@JvmSynthetic
internal fun validity(): Int =
(maxEditDistance.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
(maxEditDistance.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(if (caseSensitive.asKnown().isPresent) 1 else 0)

override fun equals(other: Any?): Boolean {
if (this === other) {
Expand All @@ -200,13 +245,16 @@ private constructor(

return other is FuzzyParams &&
maxEditDistance == other.maxEditDistance &&
caseSensitive == other.caseSensitive &&
additionalProperties == other.additionalProperties
}

private val hashCode: Int by lazy { Objects.hash(maxEditDistance, additionalProperties) }
private val hashCode: Int by lazy {
Objects.hash(maxEditDistance, caseSensitive, additionalProperties)
}

override fun hashCode(): Int = hashCode

override fun toString() =
"FuzzyParams{maxEditDistance=$maxEditDistance, additionalProperties=$additionalProperties}"
"FuzzyParams{maxEditDistance=$maxEditDistance, caseSensitive=$caseSensitive, additionalProperties=$additionalProperties}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ internal class FuzzyParamsTest {
.addMaxEditDistance(
FuzzyMaxEditDistance.builder().distance(0L).minQueryChars(0L).build()
)
.caseSensitive(true)
.build()

assertThat(fuzzyParams.maxEditDistance())
.containsExactly(FuzzyMaxEditDistance.builder().distance(0L).minQueryChars(0L).build())
assertThat(fuzzyParams.caseSensitive()).contains(true)
}

@Test
Expand All @@ -30,6 +32,7 @@ internal class FuzzyParamsTest {
.addMaxEditDistance(
FuzzyMaxEditDistance.builder().distance(0L).minQueryChars(0L).build()
)
.caseSensitive(true)
.build()

val roundtrippedFuzzyParams =
Expand Down
Loading