我试图获取搜索查询并在搜索查询中传递参数(使用like运算符进行密码查询)并传递动态参数但我得到了错误。这是正则表达式问题的neo4j问题。
Map<String, Object> map = new HashMap<String, Object>();
map.put(parameter, groupIdAfterSubstituet(collabVo));//
map.put("{display_name}",input);//input="S"
Result<Map<String, Object>> result = neoOperation.query(
collabVo.getSearchQuery(), map);//MATCH (n:OrganizationUnit {id:{class}})-[r:PART]-(c)-[r1:STUDENTROLE]-(f) where f.firstName =~"{display_name}.*" RETURN f
Result<Student> std = result.to(Student.class);
for (Student st : std) {
students.add(st);
错误
[STDERR] javax.el.ELException: /sections/content/postAlertContent.xhtml @28,38 completeMethod="# {autocompleteBeanController.completeUserProfile}": java.util.regex.PatternSyntaxException: Illegal repetition
[STDERR] {display_name}.*
[STDERR] at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:111)
[STDERR] at org.primefaces.component.autocomplete.AutoComplete.broadcast(AutoComplete.java:337)
[STDERR] at javax.faces.component.UIData.broadcast(UIData.java:1093)
[STDERR] at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
[STDERR] at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:935)
[STDERR] at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
[STDERR] at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
[STDERR] at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
[STDERR] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
[STDERR] at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:652)
[STDERR] at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1329)
[STDERR] at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:98)
[STDERR] at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1300)
[STDERR] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
[STDERR] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
[STDERR] at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1300)
[STDERR] at com.ramselabs.education.filter.LoginFilter.doFilter(LoginFilter.java:52)
[STDERR] at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1300)
[STDERR] at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:445)
[STDERR] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
[STDERR] at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:556)
[STDERR] at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
[STDERR] at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1038)
[STDERR] at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:374)
[STDERR] at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189)
[STDERR] at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:972)
[STDERR] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
[STDERR] at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
[STDERR] at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
[STDERR] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
[STDERR] at org.eclipse.jetty.server.Server.handle(Server.java:363)
[STDERR] at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:483)
[STDERR] at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:931)
[STDERR] at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:992)
[STDERR] at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856)
[STDERR] at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
[STDERR] at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
[STDERR] at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
[STDERR] at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
[STDERR] at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
[STDERR] at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
[STDERR] at java.lang.Thread.run(Thread.java:745)
[STDERR] Caused by: java.util.regex.PatternSyntaxException: Illegal repetition
[STDERR] {display_name}.*
[STDERR] at java.util.regex.Pattern.error(Pattern.java:1924)
[STDERR] at java.util.regex.Pattern.closure(Pattern.java:3104)
[STDERR] at java.util.regex.Pattern.sequence(Pattern.java:2101)
[STDERR] at java.util.regex.Pattern.expr(Pattern.java:1964)
[STDERR] at java.util.regex.Pattern.compile(Pattern.java:1665)
[STDERR] at java.util.regex.Pattern.<init>(Pattern.java:1337)
[STDERR] at java.util.regex.Pattern.compile(Pattern.java:1022)
[STDERR] at scala.util.matching.Regex.<init>(Regex.scala:153)
答案 0 :(得分:1)
这不是模式的问题。问题出在我的密码查询中。密码查询应该是这样的:
MATCH (n:OrganizationUnit {id:{class}})-[r:PART]-(c)-[r1:STUDENTROLE]-(f)
where f.firstName =~{display_name} RETURN f
添加参数应该是这样的:
map.put("display_name", input);
其中input
包含完整模式(如"nameToMatch.*"
)。这应该有用。