1

Jruby を使用し、neo4j データベースを埋め込んだ Rails アプリケーションがあります。Jruby 1.7.4 (JDK 1.7.0) を使用して MacOS 10.8.5 で開発しているときに、インデックス クエリを発行して、キーと値のペア「名前: 弁当 && タイプ: サービス」を持つノードを取得しました。ノードは存在します。

CentOS 6.4 で同じシーケンスを実行すると、インデックス クエリは結果を返しません。

私の質問は、インデックス クエリが MacOS 10.8.5 では機能するのに、CentOS 6.4 では機能しないのはなぜですか?

以下は、MacOS のコンソール セッションのトランスクリプトであり、その後に CentOS のトランスクリプトが続きます。

================================================== ==

[On MacOS 10.8.5, using Jruby 1.7.4 (JDK 1.7.0), using Neo4j Community 1.9.1]

irb(main):001:0> # verify that node with name: bento && type: services exists

irb(main):002:0> Vertex.all.select{|v| v.name == "bento" && v.type=="services"}[0].name
=> "bento"
irb(main):003:0> Vertex.all.select{|v| v.name == "bento" && v.type=="services"}[0].type
=> "services"

irb(main):004:0> # Attempt to retrieve that same node using Neo4j Lucene Index Manager

irb(main):005:0> thisgraph =  Neo4j.db.graph
=> #<Java::OrgNeo4jKernel::EmbeddedGraphDatabase:0x662a6d5b>
irb(main):006:0> index_manager = thisgraph.index
=> #<Java::OrgNeo4jKernel::IndexManagerImpl:0x77a89d44>
irb(main):007:0> node_exact_index_manager = index_manager.for_nodes("Node_Exact")
=> #<Java::OrgNeo4jIndexImplLucene::NodeIndex:0xb55bed2>
irb(main):008:0> service = node_exact_index_manager.query("name: bento && type: services").getSingle()
=> #<Java::OrgNeo4jKernelImplCore::NodeProxy:0x2666829a>
irb(main):009:0> service[:name]
=> "bento"
irb(main):010:0> service[:type]
=> "services"

===========================
[On CentOS 6.4, using Jruby 1.7.4 (JDK 1.7.0), using Neo4j Community 1.9.1 ]
# verify that node with name: bento && type: services exists
irb(main):008:0> Vertex.all.select{|v| v.name == "bento" && v.type=="services"}[0].name
=> "bento"
irb(main):009:0> Vertex.all.select{|v| v.name == "bento" && v.type=="services"}[0].type
=> "services"

# Attempt to retrieve that same node using Neo4j Lucene Index Manager

irb(main):011:0> thisgraph =  Neo4j.db.graph
=> #<Java::OrgNeo4jKernel::EmbeddedGraphDatabase:0x1acf245f>
irb(main):012:0> index_manager = thisgraph.index
=> #<Java::OrgNeo4jKernel::IndexManagerImpl:0x55fcebbe>
irb(main):013:0> node_exact_index_manager = index_manager.for_nodes("Node_Exact")
=> #<Java::OrgNeo4jIndexImplLucene::NodeIndex:0x20bcb45a>
irb(main):014:0> service = node_exact_index_manager.query("name: bento && type: services").getSingle()
=> nil

=========================

MacOS と CentOS の 2 つのデータベースとインデックスは同一です。参考までに、Luke を使用して両方のインデックス (MacOS のインデックスと CentOS のインデックス) を表示し、クエリ文字列 "name: bento && type: services" を使用して、クエリ対象のノードを実際に取得できることを確認しました。

[ RedHat で CentOS と同じ動作が見られることが確認されました ]

CentOS でのクエリで結果が得られない理由について、回答をいただければ幸いです。ありがとうございました。

4

1 に答える 1

0

ノード インデックスを取得するステートメントは、インデックス名パラメーターとして「Node_Exact」を使用しています。

node_exact_index_manager = index_manager.for_nodes("Node_Exact")

実際のインデックスは Node_exact という名前で、小文字の e が付きます。OsX はインデックス名を大文字と小文字を区別しないように扱っているようですが、これは Linux (CentOS と RedHat の両方) には当てはまりません。

インデックス名パラメーターが「Node_exact」に修正されると、結果は正しく表示されました。

node_exact_index_manager = index_manager.for_nodes("Node_exact")
于 2013-11-01T18:14:53.470 に答える