【发布时间】:2016-01-12 01:36:17
【问题描述】:
我正在使用 Neo4j.rb 和 searchkick 作为 ruby on rails 应用程序。
我有以下课程
class NeoUser
include Neo4j::ActiveNode
searchkick
property :first_name, type: String
property :last_name, type: String
property :email, type: String
has_many :out, :neo_users, rel_class: Following
end
在 Rails 控制台中我这样做:
NeoUser.reindex
然后:
result = NeoUser.search "*"
我得到一个空数组:即 result.size 给我 0
我的 Neo4j 数据库中确实有数据在 localhost:7000 上运行
我的 elasticsearch 服务器在 localhost:9200 上启动并运行
NeoUser.find_by() 确实给了我正确的结果,所以我无法弄清楚 searchkick 搜索功能失败的原因。
有什么想法吗?
编辑:
NeoUser.reindex 的输出:
CYPHER 36ms MATCH (n:`NeoUser`) RETURN n ORDER BY n.uuid LIMIT {limit_1000} | {:limit_1000=>1000}
=> true
版本
neo4j (5.2.9)
neo4j-core (5.1.6)
弹性搜索 (1.0.13)
elasticsearch-api (1.0.13)
弹性搜索传输 (1.0.13)
搜索踢 (0.9.1)
这与我在我的 ubuntu 机器上安装了 elasticsearch 1.7.2 版这一事实有关吗?
编辑 2:
我看到当我使用控制台创建数据时,搜索功能能够返回数据。
所以我猜 searchkick 无法访问在我的 localhost:9200 中运行的原始 neo4j 数据库。
但是 NeoUser.all 确实返回了我所有的数据节点,那么我如何告诉 searchkick 使用那个特定的数据库,还是有其他问题?
【问题讨论】:
-
嗯,也许...我正在使用通过 Homebrew 安装的 elasticsearch 1.6.0。去看看能不能更新……
-
刚刚更新到 1.7.2 并且没有任何问题...您可以尝试将它与 ActiveRecord 一起使用,看看它是 searchkick 还是 neo4j.rb 的问题?
标签: ruby-on-rails neo4j searchkick neo4j.rb