v4.0.0
ObjectBox now supports Vector Search to enable efficient similarity searches.
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.
Create a Vector (HNSW) index for a floating point vector property. For example, a City
with a location vector:
// objectbox: entity
class City {
// objectbox:hnswIndex: dimensions=2
var location: [Float]?
}
Perform a nearest neighbor search using the new nearestNeighbors(queryVector, maxCount)
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:
let madrid = [40.416775, -3.703790]
let query = try box
.query { City.coordinates.nearestNeighbors(queryVector: madrid, maxCount: 2) }
.build()
let closest = query.findWithScores()[0].object
For an introduction to Vector Search, more details and other supported languages see the Vector Search documentation.
- Built with Xcode 15.0.1 and Swift 5.9.
- The generator now displays an error when using an index on a property type that can not be indexed.
- Update to ObjectBox C API 4.0.1.