0
대규모 데이터베이스 (2,000 만 노드)의 노드에서 정수 필드를 인덱싱하려고합니다. 다음과 같이 내가 일을 기대할 수있는 동작은 다음과 같습니다 neo4j + lucene의 정수 인덱스 동작
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);
내가 인덱스에 키 - 값 쌍을 추가 한 다음 그것에 의해 쿼리합니다. 슬프게도, 이것은 작동하지 않습니다.
이
// 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));
이 완벽하게 작동하지만, 범위 쿼리는 정말 바보입니다 :
나의 현재 hackish 해결 방법은 범위에 의해 루씬 개체 및 쿼리를 사용하는 것입니다. 이 QueryContext.numericRange
엉망이없이 정확한 정수 쿼리를 실행할 수있는 방법이 있습니까?
와
index.query("id", 1000)
교체. 범위를 기준으로 쿼리 할 수있는 능력을 잃어 버리지 만 내 경우에는 관련성이 없습니다. 감사합니다. – PattimusPrime