采集向量数据接口调试

This commit is contained in:
2026-01-06 18:49:33 +08:00
parent fc04db9268
commit 378e6088e7
20 changed files with 468 additions and 241 deletions
@@ -8,8 +8,11 @@ import io.objectbox.annotation.VectorDistanceType
@Entity
data class Food(
@Id var id: Long = 0,
var name: String? = null,
var foodIdx: Int = 0,
var collectId: String? = null,
var foodId: String? = null,
var foodName: String? = null,
var version: String? = null,
var otherField: String? = null,
@HnswIndex(dimensions = 512, distanceType = VectorDistanceType.DOT_PRODUCT)
var foodVector: FloatArray? = null
) {
@@ -20,8 +23,11 @@ data class Food(
other as Food
if (id != other.id) return false
if (foodIdx != other.foodIdx) return false
if (name != other.name) return false
if (collectId != other.collectId) return false
if (foodId != other.foodId) return false
if (foodName != other.foodName) return false
if (version != other.version) return false
if (otherField != other.otherField) return false
if (!foodVector.contentEquals(other.foodVector)) return false
return true
@@ -29,9 +35,14 @@ data class Food(
override fun hashCode(): Int {
var result = id.hashCode()
result = 31 * result + foodIdx
result = 31 * result + (name?.hashCode() ?: 0)
result = 31 * result + (collectId?.hashCode() ?: 0)
result = 31 * result + (foodId?.hashCode() ?: 0)
result = 31 * result + (foodName?.hashCode() ?: 0)
result = 31 * result + (version?.hashCode() ?: 0)
result = 31 * result + (otherField?.hashCode() ?: 0)
result = 31 * result + (foodVector?.contentHashCode() ?: 0)
return result
}
}