cancel
Showing results for 
Search instead for 
Did you mean: 

Advanced Search in share throwing errors and not working

mrmike
Champ in-the-making
Champ in-the-making
When executing an advanced search in Share for a date it is generating the search:

((TYPE:"testing2:documentOne" AND (testing\2:documentOnedDocumentDate:\"2014-05-06T00:00:00.000-04:00\"))
AND -TYPE:"cm:thumbnail"
AND -TYPE:"cm:failedThumbnail"
AND -TYPE:"cm:rating")
AND NOT ASPECT:"sys:hidden"

This causes the error shown below to occur…. When trying this query in the node browser, I get the same error…. but if I remove the three '\' characters from the query, everything works properly. Does anyone know what is happening in share that it is having these '\' characters added and how to stop it?

This query works:
((TYPE:"testing2:documentOne" AND (testing2:documentOnedDocumentDate:"2014-05-06T00:00:00.000-04:00"))
AND -TYPE:"cm:thumbnail"
AND -TYPE:"cm:failedThumbnail"
AND -TYPE:"cm:rating")
AND NOT ASPECT:"sys:hidden"



15:54:13,486 DEBUG [org.alfresco.repo.jscript.ScriptLogger] Query:
((TYPE:"testing2:documentOne" AND (testing\2:documentOnedDocumentDate:\"2014-05-06T00:00:00.000-04:00\")) AND -TYPE:"cm:thumbnail" AND -TYPE:"cm:failedThumbnail" AND -TYPE:"cm:rating") AND NOT ASPECT:"sys:hidden"
Sortby:
15:54:13,487 DEBUG [org.alfresco.repo.jscript.Search] query=((TYPE:"testing2:documentOne" AND (testing\2:documentOnedDocumentDate:\"2014-05-06T00:00:00.000-04:00\")) AND -TYPE:"cm:thumbnail" AND -TYPE:"cm:failedThumbnail" AND -TYPE:"cm:rating") AND NOT ASPECT:"sys:hidden" limit=502
15:54:13,492 DEBUG [org.alfresco.repo.jscript.Search] Failed to execute search: ((TYPE:"testing2:documentOne" AND (testing\2:documentOnedDocumentDate:\"2014-05-06T00:00:00.000-04:00\")) AND -TYPE:"cm:thumbnail" AND -TYPE:"cm:failedThumbnail" AND -TYPE:"cm:rating") AND NOT ASPECT:"sys:hidden"
org.alfresco.repo.search.impl.parsers.FTSQueryException: 03210041 line 1:79
no viable alternative at input ':'
    (decision=17 state 78) decision=<<455:1: ftsTest : ( ( ftsFieldGroupProximity )=> ftsFieldGroupProximity -> ^( PROXIMITY ftsFieldGroupProximity ) | ftsTermOrPhrase | ftsExactTermOrPhrase | ftsTokenisedTermOrPhrase | ftsRange -> ^( RANGE ftsRange ) | ftsFieldGroup -> ftsFieldGroup | LPAREN ftsDisjunction RPAREN -> ftsDisjunction | template -> template );>>
   [ftsQuery, ftsDisjunction, ftsImplicitDisjunction, ftsExplicitConjunction, ftsPrefixed, ftsTest, ftsDisjunction, ftsImplicitDisjunction, ftsExplicitConjunction, ftsPrefixed, ftsTest, ftsDisjunction, ftsImplicitDisjunction, ftsExplicitConjunction, ftsPrefixed, ftsTest, ftsDisjunction, ftsImplicitDisjunction, ftsExplicitConjunction, ftsPrefixed, ftsTest]
   at org.alfresco.repo.search.impl.parsers.FTSQueryParser.buildFTS(FTSQueryParser.java:124)
   at org.alfresco.repo.search.impl.lucene.AbstractAlfrescoFtsQueryLanguage.executeQuery(AbstractAlfrescoFtsQueryLanguage.java:98)
   at org.alfresco.repo.search.impl.solr.DbAftsQueryLanguage.executeQuery(DbAftsQueryLanguage.java:99)
   at org.alfresco.repo.search.impl.solr.DbOrIndexSwitchingQueryLanguage.executeQuery(DbOrIndexSwitchingQueryLanguage.java:122)
   at org.alfresco.repo.search.impl.solr.SolrSearchService.query(SolrSearchService.java:348)
   at org.alfresco.repo.search.SearcherComponent.query(SearcherComponent.java:78)
   at sun.reflect.GeneratedMethodAccessor1063.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.alfresco.repo.management.subsystems.SubsystemProxyFactory$1.invoke(SubsystemProxyFactory.java:72)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at com.sun.proxy.$Proxy33.query(Unknown Source)
   at sun.reflect.GeneratedMethodAccessor1063.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
   at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:80)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:46)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:161)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at com.sun.proxy.$Proxy33.query(Unknown Source)
   at org.alfresco.repo.jscript.Search.query(Search.java:807)
   at org.alfresco.repo.jscript.Search.query(Search.java:690)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
   at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
   at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
   at org.mozilla.javascript.gen.c17._c20(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.js:1068)
   at org.mozilla.javascript.gen.c17.call(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.js)
   at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
   at org.mozilla.javascript.gen.c17._c22(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.js:1115)
   at org.mozilla.javascript.gen.c17.call(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.js)
   at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:108)
   at org.mozilla.javascript.gen.c17._c0(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.js:1118)
   at org.mozilla.javascript.gen.c17.call(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.js)
   at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
   at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
   at org.mozilla.javascript.gen.c17.call(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.js)
   at org.mozilla.javascript.gen.c17.exec(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.js)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:502)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:200)
   at org.alfresco.repo.processor.ScriptServiceImpl.execute(ScriptServiceImpl.java:212)
   at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:174)
   at org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:102)
   at org.springframework.extensions.webscripts.AbstractWebScript.executeScript(AbstractWebScript.java:1305)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:86)
   at org.alfresco.repo.web.scripts.RepositoryContainer$3.execute(RepositoryContainer.java:422)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:452)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:491)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:529)
   at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:341)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:378)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
   at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:132)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
   at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
   at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
   at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
   at java.lang.Thread.run(Thread.java:724)
Caused by: NoViableAltException(10@[455:1: ftsTest : ( ( ftsFieldGroupProximity )=> ftsFieldGroupProximity -> ^( PROXIMITY ftsFieldGroupProximity ) | ftsTermOrPhrase | ftsExactTermOrPhrase | ftsTokenisedTermOrPhrase | ftsRange -> ^( RANGE ftsRange ) | ftsFieldGroup -> ftsFieldGroup | LPAREN ftsDisjunction RPAREN -> ftsDisjunction | template -> template );])
   at org.antlr.runtime.DFA.noViableAlt(DFA.java:158)
   at org.antlr.runtime.DFA.predict(DFA.java:116)
   at org.alfresco.repo.search.impl.parsers.FTSParser.ftsTest(FTSParser.java:2963)
   at org.alfresco.repo.search.impl.parsers.FTSParser.ftsPrefixed(FTSParser.java:2393)
   at org.alfresco.repo.search.impl.parsers.FTSParser.ftsExplicitConjunction(FTSParser.java:1524)
   at org.alfresco.repo.search.impl.parsers.FTSParser.ftsImplicitDisjunction(FTSParser.java:1410)
   at org.alfresco.repo.search.impl.parsers.FTSParser.ftsDisjunction(FTSParser.java:930)
   at org.alfresco.repo.search.impl.parsers.FTSParser.ftsTest(FTSParser.java:3143)
   at org.alfresco.repo.search.impl.parsers.FTSParser.ftsPrefixed(FTSParser.java:2393)
   at org.alfresco.repo.search.impl.parsers.FTSParser.ftsExplicitConjunction(FTSParser.java:1670)
   at org.alfresco.repo.search.impl.parsers.FTSParser.ftsImplicitDisjunction(FTSParser.java:1410)
   at org.alfresco.repo.search.impl.parsers.FTSParser.ftsDisjunction(FTSParser.java:930)
   at org.alfresco.repo.search.impl.parsers.FTSParser.ftsTest(FTSParser.java:3143)
   at org.alfresco.repo.search.impl.parsers.FTSParser.ftsPrefixed(FTSParser.java:2393)
   at org.alfresco.repo.search.impl.parsers.FTSParser.ftsExplicitConjunction(FTSParser.java:1524)
   at org.alfresco.repo.search.impl.parsers.FTSParser.ftsImplicitDisjunction(FTSParser.java:1410)
   at org.alfresco.repo.search.impl.parsers.FTSParser.ftsDisjunction(FTSParser.java:930)
   at org.alfresco.repo.search.impl.parsers.FTSParser.ftsTest(FTSParser.java:3143)
   at org.alfresco.repo.search.impl.parsers.FTSParser.ftsPrefixed(FTSParser.java:2393)
   at org.alfresco.repo.search.impl.parsers.FTSParser.ftsExplicitConjunction(FTSParser.java:1524)
   at org.alfresco.repo.search.impl.parsers.FTSParser.ftsImplicitDisjunction(FTSParser.java:1410)
   at org.alfresco.repo.search.impl.parsers.FTSParser.ftsDisjunction(FTSParser.java:930)
   at org.alfresco.repo.search.impl.parsers.FTSParser.ftsQuery(FTSParser.java:328)
   at org.alfresco.repo.search.impl.parsers.FTSQueryParser.buildFTS(FTSQueryParser.java:114)
   … 84 more
2 REPLIES 2

mrmike
Champ in-the-making
Champ in-the-making
The query works just removing the two '\' surrounding the date piece….you can leave the \ infront of 'testing\2'

i.e. instead of:

((TYPE:"testing2:documentOne" AND (testing\2:documentOnedDocumentDate:\"2014-05-06T00:00:00.000-04:00\"))
AND -TYPE:"cm:thumbnail"
AND -TYPE:"cm:failedThumbnail"
AND -TYPE:"cm:rating")
AND NOT ASPECT:"sys:hidden"

This works:

((TYPE:"testing2:documentOne" AND (testing\2:documentOnedDocumentDate:"2014-05-06T00:00:00.000-04:00"))
AND -TYPE:"cm:thumbnail"
AND -TYPE:"cm:failedThumbnail"
AND -TYPE:"cm:rating")
AND NOT ASPECT:"sys:hidden"

But I am still unsure why the share advanced search is causing adding the '\' characters into the query.

mrmike
Champ in-the-making
Champ in-the-making
The strangest thing… I changed in 'share-custom-config.xml' the search type of the field from control template="/org/alfresco/components/form/controls/date.ftl"  to control template="/org/alfresco/components/form/controls/daterange.ftl" and it is now working without issue.

I'm not sure why this is the case… I can leave it with a date range search… but if anyone knows what the issue with share's advanced search with control template="/org/alfresco/components/form/controls/date.ftl"  please let me know

Thanks!