我正在尝试使用inputsearch字段检索节点但它不起作用。我认为密码查询中存在错误。有人可以帮助我吗?
var inputsearch= document.getElementById('inputsearch').value;
var buttonSearch=document.getElementById('buttonsearch');
buttonSearch.addEventListener('click', drawGraph(inputsearch));
function drawGraph(inputsearch){
sigma.neo4j.cypher(
{
url: 'http://localhost:7474', user: 'neo4j', password: 'neo4j' },
'match (n)-[r]->(m) where n.data.node.label =~ ".*(?i)'+inputsearch+'.*" return r,m,n;',s
,function(s) {
console.log('Number of nodes :'+ s.graph.nodes().length);
console.log('Number of edges :'+ s.graph.edges().length);
for(var i =0;i < s.graph.nodes().length; i++){
node = s.graph.nodes()[i];
s.settings('touchEnabled', true);
s.settings('mouseEnabled', true);
}})};
答案 0 :(得分:1)
这不是一个西格玛问题,而是一个Neo4j问题。
如果你想这样做,你应该:
Node
_search
小写所有要编制索引的字段_search
的属性Node
上创建索引:CREATE INDEX ON :Node(_search)
随着您的查询变为:
MATCH (n:Node)-[r]->(m) WHERE n._search CONTAINS $inputsearch RETURN n LIMIT 1
我已更新我的jsfiddle:https://jsfiddle.net/sim51/qkc0g58o/69/