|
| 1 | +# Changelog |
| 2 | + |
| 3 | +Notable changes to the ObjectBox Java library. |
| 4 | + |
| 5 | +For more insights into what changed in the ObjectBox C++ core, [check the ObjectBox C changelog](https://github.com/objectbox/objectbox-c/blob/main/CHANGELOG.md). |
| 6 | + |
| 7 | +## 4.0.2 - 2024-08-20 |
| 8 | + |
| 9 | +* Add convenience `oneOf` and `notOneOf` conditions that accept `Date` to avoid manual conversion using `getTime()`. |
| 10 | +* When `BoxStore` is closing, briefly wait on active transactions to finish. |
| 11 | +* Guard against crashes when `BoxStore` was closed, but database operations do still occur concurrently (transactions are still active). |
| 12 | + |
| 13 | +## 4.0.1 - 2024-06-03 |
| 14 | + |
| 15 | +* Examples: added [Vector Search example](https://github.com/objectbox/objectbox-examples/tree/main/java-main-vector-search) that demonstrates how to perform on-device [approximate nearest neighbor (ANN) search](https://docs.objectbox.io/on-device-vector-search). |
| 16 | +* Revert deprecation of `Box.query()`, it is still useful for queries without any condition. |
| 17 | +* Add note on old query API methods of `QueryBuilder` that they are not recommended for new projects. Use [the new query APIs](https://docs.objectbox.io/queries) instead. |
| 18 | +* Update and expand documentation on `ToOne` and `ToMany`. |
| 19 | + |
| 20 | +## 4.0.0 - Vector Search - 2024-05-16 |
| 21 | + |
| 22 | +**ObjectBox now supports** [**Vector Search**](https://docs.objectbox.io/ann-vector-search) to enable efficient similarity searches. |
| 23 | + |
| 24 | +This is particularly useful for AI/ML/RAG applications, e.g. image, audio, or text similarity. Other use cases include semantic search or recommendation engines. |
| 25 | + |
| 26 | +Create a Vector (HNSW) index for a floating point vector property. For example, a `City` with a location vector: |
| 27 | + |
| 28 | +```java |
| 29 | +@Entity |
| 30 | +public class City { |
| 31 | + |
| 32 | + @HnswIndex(dimensions = 2) |
| 33 | + float[] location; |
| 34 | + |
| 35 | +} |
| 36 | +``` |
| 37 | + |
| 38 | +Perform a nearest neighbor search using the new `nearestNeighbors(queryVector, maxResultCount)` query condition and the new "find with scores" query methods (the score is the distance to the query vector). For example, find the 2 closest cities: |
| 39 | + |
| 40 | +```java |
| 41 | +final float[] madrid = {40.416775F, -3.703790F}; |
| 42 | +final Query<City> query = box |
| 43 | + .query(City_.location.nearestNeighbors(madrid, 2)) |
| 44 | + .build(); |
| 45 | +final City closest = query.findWithScores().get(0).get(); |
| 46 | +``` |
| 47 | + |
| 48 | +For an introduction to Vector Search, more details and other supported languages see the [Vector Search documentation](https://docs.objectbox.io/ann-vector-search). |
| 49 | + |
| 50 | +* BoxStore: deprecated `BoxStore.sizeOnDisk()`. Instead use one of the new APIs to determine the size of a database: |
| 51 | + * `BoxStore.getDbSize()` which for a file-based database returns the file size and for an in-memory database returns the approximately used memory, |
| 52 | + * `BoxStore.getDbSizeOnDisk()` which only returns a non-zero size for a file-based database. |
| 53 | +* Query: add properly named `setParameter(prop, value)` methods that only accept a single parameter value, deprecated the old `setParameters(prop, value)` variants. |
| 54 | +* Sync: add `SyncCredentials.userAndPassword(user, password)`. |
| 55 | +* Gradle plugin: the license of the [Gradle plugin](https://github.com/objectbox/objectbox-java-generator) has changed to the GNU Affero General Public License (AGPL). |
| 56 | + |
| 57 | +## Previous versions |
| 58 | + |
| 59 | +See the [Changelogs in the documentation](https://docs.objectbox.io/changelogs). |
0 commit comments