【文件属性】:
文件名称:邻居:最近的邻居搜索Rails和Postgres
文件大小:13KB
文件格式:ZIP
更新时间:2021-03-04 07:43:07
nearest-neighbor-search Ruby
邻居
最近的邻居搜索Rails和Postgres
安装
将此行添加到您的应用程序的Gemfile中:
gem 'neighbor'
并运行:
bundle install
rails generate neighbor:install
rails db:migrate
这将启用Postgres中的
入门
创建迁移
class AddNeighborVectorToItems < ActiveRecord :: Migration [ 6.1 ]
def change
add_column :items , :neighbor_vector , :cube
end
end
添加到您的模型
class Item < ApplicationRecord
has_neighbors dimensions : 3
end
更新向量
item . update ( ne
【文件预览】:
neighbor-master
----Rakefile(177B)
----.github()
--------workflows()
----test()
--------test_helper.rb(1KB)
--------neighbor_test.rb(5KB)
----gemfiles()
--------activerecord60.gemfile(125B)
--------activerecord52.gemfile(125B)
----neighbor.gemspec(559B)
----Gemfile(123B)
----examples()
--------disco_user_recs.rb(1KB)
--------disco_item_recs.rb(738B)
----.gitignore(80B)
----CHANGELOG.md(327B)
----lib()
--------neighbor.rb(1KB)
--------generators()
--------neighbor()
----README.md(3KB)
----LICENSE.txt(1KB)