title: Alfresco 4.2b Search doesn't work with Solr
body: <p>I've some troubles with the search in alfresco, it doesn't work (for administrator or users)</p>
  
  <p>The server version was initially 4.0d community edition. I tryied to upgrade it to 4.2b community edition (the default installer which embed all the component) on my dev virtual machine.</p>
  
  <p>I had some problems with the certificate (I cannot access to <a href="https://example.com:8443/solr" rel="nofollow">https://example.com:8443/solr</a>) so I upgraded the certifiate in alf_data with that procedure <a href="http://wiki.alfresco.com/wiki/Replacing_Default_Certificate" rel="nofollow">http://wiki.alfresco.com/wiki/Replacing_Default_Certificate</a> and it worked well</p>
  
  <p>And I rebuilded all the index
  <a href="http://deepak-keswani.blogspot.fr/2012/07/how-to-rebuild-solr-indexes-in-alfresco.html" rel="nofollow">http://deepak-keswani.blogspot.fr/2012/07/how-to-rebuild-solr-indexes-in-alfresco.html</a>
  (The folder have the same size so I think the data are indexed, if someone understand how I can make a custom search with solr folder, I would appreciate)</p>
  
  <p>I activated the log in tomcat/webapps/alfresco/WEB-INF/classes/log4j.properties and tomcat/webapps/share/WEB-INF/classes/log4j.properties
  log4j.logger.org.alfresco.repo.search.impl.solr.SolrQueryHTTPClient=debug
  but nothing appared in the log file.</p>
  
  <p>I activated another log : I added a file dev-log4j.properties in shared/classes/alfresco/extension/ with that content :</p>
  
  <pre><code>log4j.logger.org.alfresco.web.scripts=debug
  log4j.logger.org.alfresco.repo.web.scripts=debug
  log4j.logger.org.alfresco.repo.jscript=debug
  log4j.logger.org.alfresco.repo.jscript.ScriptLogger=debug
  </code></pre>
  
  <p>and I have a log result</p>
  
  <pre><code>21:42:39,375 DEBUG [org.alfresco.repo.jscript.Search] Failed to execute search: ((PATH:"/app:company_home/st:sites/*/*//*" AND (testours  AND (+TYPE:"cm:content" +TYPE:"cm:folder"))) AND -TYPE:"cm:thumbnail" AND -TYPE:"cm:failedThumbnail" AND -TYPE:"cm:rating") AND NOT ASPECT:"sys:hidden"
  org.alfresco.repo.search.impl.lucene.LuceneQueryParserException: 11300004 Request failed 500 /solr/alfresco/afts?wt=json&amp;fl=DBID%2Cscore&amp;rows=502&amp;df=keywords&amp;start=0&amp;locale=fr&amp;fq=%7B%21afts%7DAUTHORITY_FILTER_FROM_JSON&amp;fq=%7B%21afts%7DTENANT_FILTER_FROM_JSON
      at org.alfresco.repo.search.impl.solr.SolrQueryHTTPClient.executeQuery(SolrQueryHTTPClient.java:398)
      at org.alfresco.repo.search.impl.solr.SolrQueryLanguage.executeQuery(SolrQueryLanguage.java:49)
      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.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:601)
      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 $Proxy12.query(Unknown Source)
      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:601)
      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:159)
      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 $Proxy12.query(Unknown Source)
      at org.alfresco.repo.jscript.Search.query(Search.java:803)
      at org.alfresco.repo.jscript.Search.query(Search.java:686)
      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:601)
      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.c3._c20(file:/home/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.js:1013)
      at org.mozilla.javascript.gen.c3.call(file:/home/alfresco-4.0.d/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.c3._c22(file:/home/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.js:1057)
      at org.mozilla.javascript.gen.c3.call(file:/home/alfresco-4.0.d/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.c3._c0(file:/home/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.js:1060)
      at org.mozilla.javascript.gen.c3.call(file:/home/alfresco-4.0.d/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.c3.call(file:/home/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.js)
      at org.mozilla.javascript.gen.c3.exec(file:/home/alfresco-4.0.d/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:492)
      at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:198)
      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:433)
      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:345)
      at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:377)
      at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
      at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
      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:472)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
      at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:1771)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      at java.lang.Thread.run(Thread.java:722)
  </code></pre>
  
  <p>When I tryied the url :</p>
  
  <blockquote>
    <p><a href="https://example.com:8443/solr/alfresco/afts?wt=json&amp;fl=DBID%2Cscore&amp;rows=502&amp;df=keywords&amp;start=0&amp;locale=fr&amp;fq=" rel="nofollow">https://example.com:8443/solr/alfresco/afts?wt=json&amp;fl=DBID%2Cscore&amp;rows=502&amp;df=keywords&amp;start=0&amp;locale=fr&amp;fq=</a>{!afts}AUTHORITY_FILTER_FROM_JSON&amp;fq={!afts}TENANT_FILTER_FROM_JSON</p>
  </blockquote>
  
  <p>I had a 500 page issued from tomcat :</p>
  
  <blockquote>
    <p>Etat HTTP 500 - null java.lang.NullPointerException at
    org.antlr.runtime.ANTLRStringStream.(ANTLRStringStream.java:75)
    at
    org.alfresco.repo.search.impl.parsers.FTSQueryParser.buildFTS(FTSQueryParser.java:108)
    at
    org.alfresco.solr.AlfrescoSolrDataModel.getFTSQuery(AlfrescoSolrDataModel.java:986)
    at
    org.alfresco.solr.query.AlfrescoFTSQParserPlugin$AlfrescoFTSQParser.parse(AlfrescoFTSQParserPlugin.java:80)
    at org.apache.solr.search.QParser.getQuery(QParser.java:131) at
    org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:89)
    at
    org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:174)
    at
    org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:1316) at
    org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:338)
    at
    org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:241)
    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:581)
    at
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
    at
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at
    org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
    at
    org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
    at
    org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
    at
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)</p>
  </blockquote>
  
  <p>Then with my new log parameters, I tryied to rebuild it.</p>
  
  <p>I've a lot of message <a href="http://depositfiles.com/files/4w85yegap" rel="nofollow">http://depositfiles.com/files/4w85yegap</a> but I din't see any elements</p>
  
  <p>I tryied to open it with Luke (Lucene Index Toolbox) but I don't know how to use it ... But it says that I have 40k documents which can be true (but i can't check if they are well indexed)</p>
  
  <p><strong>Update</strong></p>
  
  <p>I retryied with alfresco 4.0d and it works. (I will a problem with the new version but it solves a part of my problem). My quick procedure for upgrade was to shutdown, backup and move 4.0d to another directory then copy alf_data, correct the certificate. Any clue ?</p>
  
  <p>Does someone has a solution or a tips to continue ?</p>
  
  <p>Regards</p>