大規模なデータベース(約2,000万ノード)のノードで整数フィールドにインデックスを付けたい。私が期待する動作は次のとおりです。
HashMap<String, Object> properties = new HashMap<String, Object>();
// Add node to graph (inserter is an instance of BatchInserter)
properties.put("id", 1000);
long node = inserter.createNode(properties);
// Add index
index.add(node, properties);
// Retrieve node by index. RETURNS NULL!
IndexHits<Node> hits = index.query("id", 1000);
キーと値のペアをインデックスに追加し、それによってクエリを実行します。悲しいことに、これは機能しません。
私の現在のハックの回避策は、Luceneオブジェクトを使用し、範囲ごとにクエリを実行することです。
// Add index
properties.put("id", ValueContext.numeric(1000).indexNumeric());
index.add(node, properties);
// Retrieve node by index. This still returns null
IndexHits<Node> hits = index.query("id", 1000);
// However, this version works
hits = index.query(QueryContext.numericRange("id", 1000, 1000, true, true));
これは完全に機能しますが、範囲クエリは本当にばかげています。QueryContext.numericRange
この混乱なしに正確な整数クエリを実行する方法はありますか?