neighbor 0.6.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f4fa263cadd7a89f4f99faef6238db1f355597ce1510a84c722563a669c62d8
4
- data.tar.gz: b3876b14c21276b0e2bfefa87d98265a3c766ae2b1b32459e085bcedfde8afcb
3
+ metadata.gz: 5caf112992a87ac93ef7d05094b9d5beb71470fef6d5dc07da8f4ba74787c381
4
+ data.tar.gz: 85d47b002533704a0098e41fb2e752405ea8ae50ca3cdb7d5984e0cd93016ab0
5
5
  SHA512:
6
- metadata.gz: f90e43582600d41411c3a9e129ca03b606d08ece9bfc39227aab97e2c2af77950eb885cfa4900bef94eb8524d121af1b25823e495b99756ea8f04398d2497c8f
7
- data.tar.gz: 17cb10ce768c76f1a0e273c887486f1e0a9a2b73f3d5d8758ebaada7aa12366e4d9e061b6a125b81cb36167013bf2a6f07dba786a5c0de4af99543e70421d961
6
+ metadata.gz: af55fbcbe28352582379e84b0e831aae677411cf4a45432cd9a1caff7e33857d38362c6bc484a479e9c4e99f634cb094efa4ea10e02e789b4cbd552c72578b6c
7
+ data.tar.gz: b896e3edda9fc58a7e8aeb8aa71cf409ae5d0f8b30a785642e8380b071a0bff3e6504bc5123711405504ab7f54fb4ac856a2a26f5088bcd8bc4c963b2f4cab10
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.0.0 (2026-04-04)
2
+
3
+ - Dropped support for Ruby < 3.3 and Active Record < 7.2
4
+
1
5
  ## 0.6.0 (2025-06-12)
2
6
 
3
7
  - Added support for MariaDB 11.8
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2021-2025 Andrew Kane
3
+ Copyright (c) 2021-2026 Andrew Kane
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -9,6 +9,8 @@ Supports:
9
9
  - MySQL 9 (searching requires HeatWave) - experimental
10
10
  - SQLite (sqlite-vec) - experimental
11
11
 
12
+ Also available for [Redis](https://github.com/ankane/neighbor-redis) and [S3 Vectors](https://github.com/ankane/neighbor-s3)
13
+
12
14
  [![Build Status](https://github.com/ankane/neighbor/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/neighbor/actions)
13
15
 
14
16
  ## Installation
@@ -56,7 +58,7 @@ rails generate neighbor:sqlite
56
58
  Create a migration
57
59
 
58
60
  ```ruby
59
- class AddEmbeddingToItems < ActiveRecord::Migration[8.0]
61
+ class AddEmbeddingToItems < ActiveRecord::Migration[8.1]
60
62
  def change
61
63
  # cube
62
64
  add_column :items, :embedding, :cube
@@ -174,7 +176,7 @@ The `sparsevec` type can have up to 16,000 non-zero elements, and sparse vectors
174
176
  Add an approximate index to speed up queries. Create a migration with:
175
177
 
176
178
  ```ruby
177
- class AddIndexToItemsEmbedding < ActiveRecord::Migration[8.0]
179
+ class AddIndexToItemsEmbedding < ActiveRecord::Migration[8.1]
178
180
  def change
179
181
  add_index :items, :embedding, using: :hnsw, opclass: :vector_l2_ops
180
182
  # or
@@ -202,7 +204,7 @@ Item.connection.execute("SET ivfflat.probes = 3")
202
204
  Use the `halfvec` type to store half-precision vectors
203
205
 
204
206
  ```ruby
205
- class AddEmbeddingToItems < ActiveRecord::Migration[8.0]
207
+ class AddEmbeddingToItems < ActiveRecord::Migration[8.1]
206
208
  def change
207
209
  add_column :items, :embedding, :halfvec, limit: 3 # dimensions
208
210
  end
@@ -214,7 +216,7 @@ end
214
216
  Index vectors at half precision for smaller indexes
215
217
 
216
218
  ```ruby
217
- class AddIndexToItemsEmbedding < ActiveRecord::Migration[8.0]
219
+ class AddIndexToItemsEmbedding < ActiveRecord::Migration[8.1]
218
220
  def change
219
221
  add_index :items, "(embedding::halfvec(3)) halfvec_l2_ops", using: :hnsw
220
222
  end
@@ -232,7 +234,7 @@ Item.nearest_neighbors(:embedding, [0.9, 1.3, 1.1], distance: "euclidean", preci
232
234
  Use the `bit` type to store binary vectors
233
235
 
234
236
  ```ruby
235
- class AddEmbeddingToItems < ActiveRecord::Migration[8.0]
237
+ class AddEmbeddingToItems < ActiveRecord::Migration[8.1]
236
238
  def change
237
239
  add_column :items, :embedding, :bit, limit: 3 # dimensions
238
240
  end
@@ -250,7 +252,7 @@ Item.nearest_neighbors(:embedding, "101", distance: "hamming").first(5)
250
252
  Use expression indexing for binary quantization
251
253
 
252
254
  ```ruby
253
- class AddIndexToItemsEmbedding < ActiveRecord::Migration[8.0]
255
+ class AddIndexToItemsEmbedding < ActiveRecord::Migration[8.1]
254
256
  def change
255
257
  add_index :items, "(binary_quantize(embedding)::bit(3)) bit_hamming_ops", using: :hnsw
256
258
  end
@@ -262,7 +264,7 @@ end
262
264
  Use the `sparsevec` type to store sparse vectors
263
265
 
264
266
  ```ruby
265
- class AddEmbeddingToItems < ActiveRecord::Migration[8.0]
267
+ class AddEmbeddingToItems < ActiveRecord::Migration[8.1]
266
268
  def change
267
269
  add_column :items, :embedding, :sparsevec, limit: 3 # dimensions
268
270
  end
@@ -291,7 +293,7 @@ Supported values are:
291
293
  Vector columns must use `null: false` to add a vector index
292
294
 
293
295
  ```ruby
294
- class CreateItems < ActiveRecord::Migration[8.0]
296
+ class CreateItems < ActiveRecord::Migration[8.1]
295
297
  def change
296
298
  create_table :items do |t|
297
299
  t.vector :embedding, limit: 3, null: false
@@ -306,7 +308,7 @@ end
306
308
  Use the `bigint` type to store binary vectors
307
309
 
308
310
  ```ruby
309
- class AddEmbeddingToItems < ActiveRecord::Migration[8.0]
311
+ class AddEmbeddingToItems < ActiveRecord::Migration[8.1]
310
312
  def change
311
313
  add_column :items, :embedding, :bigint
312
314
  end
@@ -338,7 +340,7 @@ Note: The `DISTANCE()` function is [only available on HeatWave](https://dev.mysq
338
340
  Use the `binary` type to store binary vectors
339
341
 
340
342
  ```ruby
341
- class AddEmbeddingToItems < ActiveRecord::Migration[8.0]
343
+ class AddEmbeddingToItems < ActiveRecord::Migration[8.1]
342
344
  def change
343
345
  add_column :items, :embedding, :binary
344
346
  end
@@ -377,7 +379,7 @@ end
377
379
  You can also use [virtual tables](https://alexgarcia.xyz/sqlite-vec/features/knn.html)
378
380
 
379
381
  ```ruby
380
- class AddEmbeddingToItems < ActiveRecord::Migration[8.0]
382
+ class AddEmbeddingToItems < ActiveRecord::Migration[8.1]
381
383
  def change
382
384
  # Rails 8+
383
385
  create_virtual_table :items, :vec0, [
@@ -27,16 +27,8 @@ module Neighbor
27
27
  @neighbor_attributes[attribute_name] = {dimensions: dimensions, normalize: normalize, type: type&.to_sym}
28
28
  end
29
29
 
30
- if ActiveRecord::VERSION::STRING.to_f >= 7.2
31
- decorate_attributes(attribute_names) do |name, cast_type|
32
- Neighbor::Attribute.new(cast_type: cast_type, model: self, type: type, attribute_name: name)
33
- end
34
- else
35
- attribute_names.each do |attribute_name|
36
- attribute attribute_name do |cast_type|
37
- Neighbor::Attribute.new(cast_type: cast_type, model: self, type: type, attribute_name: attribute_name)
38
- end
39
- end
30
+ decorate_attributes(attribute_names) do |name, cast_type|
31
+ Neighbor::Attribute.new(cast_type: cast_type, model: self, type: type, attribute_name: name)
40
32
  end
41
33
 
42
34
  if normalize
@@ -1,3 +1,3 @@
1
1
  module Neighbor
2
- VERSION = "0.6.0"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neighbor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '7.1'
18
+ version: '7.2'
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: '7.1'
25
+ version: '7.2'
26
26
  email: andrew@ankane.org
27
27
  executables: []
28
28
  extensions: []
@@ -67,14 +67,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - ">="
69
69
  - !ruby/object:Gem::Version
70
- version: '3.2'
70
+ version: '3.3'
71
71
  required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  requirements: []
77
- rubygems_version: 3.6.7
77
+ rubygems_version: 4.0.3
78
78
  specification_version: 4
79
79
  summary: Nearest neighbor search for Rails
80
80
  test_files: []