Advanced search
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2011 05:39 AM
Anyone knows if there is an easy way to create an advanced search for a Web Quick Start website?
I would like to have a search form where I could search documents using custom metadata fields.
I suppose that this should be done using a webscript, but I don't know how to launch a search query in the .js file.
Any help will be appreciated.
Thanks,
Jordi.
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2011 03:53 AM
I'm using Alfresco 3.4.d.
If it helps someone, it seems that you can't perform a search to the Alfresco respository directly in a Share webscript. So I've tried creating a Webscript in the Alfresco repository that returns a JSON object, and then I've called it from the WQS webscript by doing:
var connector = remote.connect("alfresco");var data = connector.call("/url/to/webscript");
But it seems that no data is returned. If I access the Alfresco webscript directly using a browser I get the JSON response.Don't know if this is the right way.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2011 10:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2011 03:23 AM
So I should do it using a Java Backed webscript instead of normal webscripts using Javascript?
I've taken a look at these classes, but I don't know how to use them from my webscript.
You know where I can find the Web Quick Start API JAR file to import into my Java project? I can't find it in the Alfresco 3.4.d SDK
I should build it from source?
Thanks a lot.
Edit: I've managed to build the WQS API from source as described in the wiki page. It can also be found at the <alfresco.base>/tomcat/webapps/wcmqs/WEB-INF/lib/ directory.
Now I'm trying to create the Java backed webscript and use it in my WQS site.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2011 04:29 AM
Once you have deployed the sample WQS webapp (wcmqs.jar), you can find the WQS API JAR in the folder "wcmqs/WEB-INF/lib" in your web container's webapps folder ($TOMCAT_HOME/webapps, for instance). It's named "alfresco-wcmqs-clientapi-3.4.X.jar" (with the X replaced with the build number/letter)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2011 04:54 AM
The Javascript code that I tried is:
var nodes = search.luceneSearch("TEXT:alfresco");var results = search.query({query: "TEXT:alfresco"});
Full stacktrace:
ERROR: org.springframework.extensions.webscripts.AbstractRuntime - Exception from executeScript - redirecting to status template error: 04100005 Failed to load script 'org.springframework.extensions.webscripts.ResourceStore$WebApplicationStoreScriptContent@ad643f': 04100004 ReferenceError: "search" is not defined. (/WEB-INF/webscripts/semicalpicat/csearch.get.js#3)org.springframework.extensions.webscripts.WebScriptException: 04100005 Failed to load script 'org.springframework.extensions.webscripts.ResourceStore$WebApplicationStoreScriptContent@ad643f': 04100004 ReferenceError: "search" is not defined. (/WEB-INF/webscripts/semicalpicat/csearch.get.js#3) at org.springframework.extensions.webscripts.processor.JSScriptProcessor.executeScript(JSScriptProcessor.java:195) at org.springframework.extensions.webscripts.AbstractWebScript.executeScript(AbstractWebScript.java:982) at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:86) at org.springframework.extensions.webscripts.PresentationContainer.executeScript(PresentationContainer.java:69) at org.springframework.extensions.webscripts.LocalWebScriptRuntimeContainer.executeScript(LocalWebScriptRuntimeContainer.java:203) at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:333) at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189) at org.springframework.extensions.webscripts.WebScriptProcessor.executeBody(WebScriptProcessor.java:296) at org.springframework.extensions.surf.render.AbstractProcessor.execute(AbstractProcessor.java:79) at org.springframework.extensions.surf.render.RenderService.processComponent(RenderService.java:467) at org.springframework.extensions.surf.render.RenderService.renderRawComponent(RenderService.java:939) at org.springframework.extensions.surf.render.RenderService.renderRawComponent(RenderService.java:926) at org.springframework.extensions.surf.taglib.IncludeTag.doStartTag(IncludeTag.java:64) at org.springframework.extensions.surf.render.TagService.execute(TagService.java:213) at org.springframework.extensions.surf.render.TagService.execute(TagService.java:148) at org.springframework.extensions.webscripts.FreemarkerTagSupportDirective.executeTag(FreemarkerTagSupportDirective.java:92) at org.springframework.extensions.webscripts.GenericFreemarkerTagDirective.execute(GenericFreemarkerTagDirective.java:121) at freemarker.core.Environment.visit(Environment.java:263) at freemarker.core.UnifiedCall.accept(UnifiedCall.java:126) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.Environment.process(Environment.java:190) at freemarker.template.Template.process(Template.java:237) at org.springframework.extensions.webscripts.processor.FTLTemplateProcessor.process(FTLTemplateProcessor.java:156) at org.springframework.extensions.webscripts.WebTemplateProcessor.executeBody(WebTemplateProcessor.java:338) at org.springframework.extensions.surf.render.AbstractProcessor.execute(AbstractProcessor.java:79) at org.springframework.extensions.surf.render.RenderService.processRenderable(RenderService.java:389) at org.springframework.extensions.surf.render.bean.ChromeRenderer.body(ChromeRenderer.java:96) at org.springframework.extensions.surf.render.AbstractRenderer.render(AbstractRenderer.java:135) at org.springframework.extensions.surf.render.bean.ChromeRenderer.render(ChromeRenderer.java:79) at org.springframework.extensions.surf.render.bean.ComponentRenderer.body(ComponentRenderer.java:107) at org.springframework.extensions.surf.render.AbstractRenderer.render(AbstractRenderer.java:135) at org.springframework.extensions.surf.render.RenderService.renderRegionComponents(RenderService.java:796) at org.springframework.extensions.surf.render.bean.RegionRenderer.body(RegionRenderer.java:120) at org.springframework.extensions.surf.render.AbstractRenderer.render(AbstractRenderer.java:135) at org.springframework.extensions.surf.render.RenderService.startRegionRenderer(RenderService.java:748) at org.springframework.extensions.surf.render.RenderService.renderRegion(RenderService.java:692) at org.springframework.extensions.surf.render.PresentationUtil.renderRegion(PresentationUtil.java:113) at org.springframework.extensions.surf.taglib.RegionTag.doStartTag(RegionTag.java:102) at org.springframework.extensions.surf.render.TagService.execute(TagService.java:213) at org.springframework.extensions.surf.render.TagService.execute(TagService.java:148) at org.springframework.extensions.webscripts.FreemarkerTagSupportDirective.executeTag(FreemarkerTagSupportDirective.java:92) at org.springframework.extensions.webscripts.RegionFreemarkerTagDirective.execute(RegionFreemarkerTagDirective.java:122) at freemarker.core.Environment.visit(Environment.java:263) at freemarker.core.UnifiedCall.accept(UnifiedCall.java:126) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.Environment.visit(Environment.java:395) at freemarker.core.BodyInstruction.accept(BodyInstruction.java:93) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.Macro$Context.runMacro(Macro.java:172) at freemarker.core.Environment.visit(Environment.java:603) at freemarker.core.UnifiedCall.accept(UnifiedCall.java:106) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.Environment.process(Environment.java:190) at freemarker.template.Template.process(Template.java:237) at org.springframework.extensions.webscripts.processor.FTLTemplateProcessor.process(FTLTemplateProcessor.java:156) at org.springframework.extensions.webscripts.WebTemplateProcessor.executeBody(WebTemplateProcessor.java:338) at org.springframework.extensions.surf.render.AbstractProcessor.execute(AbstractProcessor.java:79) at org.springframework.extensions.surf.render.RenderService.processTemplate(RenderService.java:581) at org.springframework.extensions.surf.render.bean.TemplateInstanceRenderer.body(TemplateInstanceRenderer.java:134) at org.springframework.extensions.surf.render.AbstractRenderer.render(AbstractRenderer.java:135) at org.springframework.extensions.surf.render.bean.PageRenderer.body(PageRenderer.java:70) at org.springframework.extensions.surf.render.AbstractRenderer.render(AbstractRenderer.java:135) at org.springframework.extensions.surf.render.RenderService.startPageRenderer(RenderService.java:633) at org.springframework.extensions.surf.render.RenderService.renderPage(RenderService.java:610) at org.springframework.extensions.surf.render.PresentationUtil.renderPage(PresentationUtil.java:74) at org.springframework.extensions.surf.mvc.PageView.dispatchPage(PageView.java:358) at org.springframework.extensions.surf.mvc.PageView.renderView(PageView.java:299) at org.springframework.extensions.surf.mvc.AbstractWebFrameworkView.renderMergedOutputModel(AbstractWebFrameworkView.java:167) at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250) at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1060) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:798) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302) at org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:213) at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171) at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:619)Caused by: org.springframework.extensions.webscripts.WebScriptException: 04100004 ReferenceError: "search" is not defined. (/WEB-INF/webscripts/semicalpicat/csearch.get.js#3) at org.springframework.extensions.webscripts.processor.JSScriptProcessor.executeScriptImpl(JSScriptProcessor.java:323) at org.springframework.extensions.webscripts.processor.JSScriptProcessor.executeScript(JSScriptProcessor.java:191) … 104 moreCaused by: org.mozilla.javascript.EcmaError: ReferenceError: "search" is not defined. (/WEB-INF/webscripts/semicalpicat/csearch.get.js#3) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3350) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3340) at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3413) at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1612) at org.mozilla.javascript.gen.c9._c0(/WEB-INF/webscripts/semicalpicat/csearch.get.js:3) at org.mozilla.javascript.gen.c9.call(/WEB-INF/webscripts/semicalpicat/csearch.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.c9.call(/WEB-INF/webscripts/semicalpicat/csearch.get.js) at org.mozilla.javascript.gen.c9.exec(/WEB-INF/webscripts/semicalpicat/csearch.get.js) at org.springframework.extensions.webscripts.processor.JSScriptProcessor.executeScriptImpl(JSScriptProcessor.java:313) … 105 more12:51:19,449 User:admin DEBUG [repo.jscript.RhinoScriptProcessor] Time to execute script: 1.1336msERROR: org.springframework.extensions.webscripts.AbstractRuntime - Exception from executeScript - redirecting to status template error: 04100007 Failed to load script 'org.springframework.extensions.webscripts.ResourceStore$WebApplicationStoreScriptContent@ad643f': 04100006 ReferenceError: "search" is not defined. (/WEB-INF/webscripts/semicalpicat/csearch.get.js#3)org.springframework.extensions.webscripts.WebScriptException: 04100007 Failed to load script 'org.springframework.extensions.webscripts.ResourceStore$WebApplicationStoreScriptContent@ad643f': 04100006 ReferenceError: "search" is not defined. (/WEB-INF/webscripts/semicalpicat/csearch.get.js#3) at org.springframework.extensions.webscripts.processor.JSScriptProcessor.executeScript(JSScriptProcessor.java:195) at org.springframework.extensions.webscripts.AbstractWebScript.executeScript(AbstractWebScript.java:982) at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:86) at org.springframework.extensions.webscripts.PresentationContainer.executeScript(PresentationContainer.java:69) at org.springframework.extensions.webscripts.LocalWebScriptRuntimeContainer.executeScript(LocalWebScriptRuntimeContainer.java:203) at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:333) at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189) at org.springframework.extensions.webscripts.WebScriptProcessor.executeBody(WebScriptProcessor.java:296) at org.springframework.extensions.surf.render.AbstractProcessor.execute(AbstractProcessor.java:79) at org.springframework.extensions.surf.render.RenderService.processComponent(RenderService.java:467) at org.springframework.extensions.surf.render.RenderService.renderRawComponent(RenderService.java:939) at org.springframework.extensions.surf.render.RenderService.renderRawComponent(RenderService.java:926) at org.springframework.extensions.surf.taglib.IncludeTag.doStartTag(IncludeTag.java:64) at org.springframework.extensions.surf.render.TagService.execute(TagService.java:213) at org.springframework.extensions.surf.render.TagService.execute(TagService.java:148) at org.springframework.extensions.webscripts.FreemarkerTagSupportDirective.executeTag(FreemarkerTagSupportDirective.java:92) at org.springframework.extensions.webscripts.GenericFreemarkerTagDirective.execute(GenericFreemarkerTagDirective.java:121) at freemarker.core.Environment.visit(Environment.java:263) at freemarker.core.UnifiedCall.accept(UnifiedCall.java:126) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.Environment.process(Environment.java:190) at freemarker.template.Template.process(Template.java:237) at org.springframework.extensions.webscripts.processor.FTLTemplateProcessor.process(FTLTemplateProcessor.java:156) at org.springframework.extensions.webscripts.WebTemplateProcessor.executeBody(WebTemplateProcessor.java:338) at org.springframework.extensions.surf.render.AbstractProcessor.execute(AbstractProcessor.java:79) at org.springframework.extensions.surf.render.RenderService.processRenderable(RenderService.java:389) at org.springframework.extensions.surf.render.bean.ChromeRenderer.body(ChromeRenderer.java:96) at org.springframework.extensions.surf.render.AbstractRenderer.render(AbstractRenderer.java:135) at org.springframework.extensions.surf.render.bean.ChromeRenderer.render(ChromeRenderer.java:79) at org.springframework.extensions.surf.render.bean.ComponentRenderer.body(ComponentRenderer.java:107) at org.springframework.extensions.surf.render.AbstractRenderer.render(AbstractRenderer.java:135) at org.springframework.extensions.surf.render.RenderService.renderRegionComponents(RenderService.java:796) at org.springframework.extensions.surf.render.bean.RegionRenderer.body(RegionRenderer.java:120) at org.springframework.extensions.surf.render.AbstractRenderer.render(AbstractRenderer.java:135) at org.springframework.extensions.surf.render.RenderService.startRegionRenderer(RenderService.java:748) at org.springframework.extensions.surf.render.RenderService.renderRegion(RenderService.java:692) at org.springframework.extensions.surf.render.PresentationUtil.renderRegion(PresentationUtil.java:113) at org.springframework.extensions.surf.taglib.RegionTag.doStartTag(RegionTag.java:102) at org.springframework.extensions.surf.render.TagService.execute(TagService.java:213) at org.springframework.extensions.surf.render.TagService.execute(TagService.java:148) at org.springframework.extensions.webscripts.FreemarkerTagSupportDirective.executeTag(FreemarkerTagSupportDirective.java:92) at org.springframework.extensions.webscripts.RegionFreemarkerTagDirective.execute(RegionFreemarkerTagDirective.java:122) at freemarker.core.Environment.visit(Environment.java:263) at freemarker.core.UnifiedCall.accept(UnifiedCall.java:126) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.Environment.visit(Environment.java:395) at freemarker.core.BodyInstruction.accept(BodyInstruction.java:93) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.Macro$Context.runMacro(Macro.java:172) at freemarker.core.Environment.visit(Environment.java:603) at freemarker.core.UnifiedCall.accept(UnifiedCall.java:106) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.Environment.process(Environment.java:190) at freemarker.template.Template.process(Template.java:237) at org.springframework.extensions.webscripts.processor.FTLTemplateProcessor.process(FTLTemplateProcessor.java:156) at org.springframework.extensions.webscripts.WebTemplateProcessor.executeBody(WebTemplateProcessor.java:338) at org.springframework.extensions.surf.render.AbstractProcessor.execute(AbstractProcessor.java:79) at org.springframework.extensions.surf.render.RenderService.processTemplate(RenderService.java:581) at org.springframework.extensions.surf.render.bean.TemplateInstanceRenderer.body(TemplateInstanceRenderer.java:134) at org.springframework.extensions.surf.render.AbstractRenderer.render(AbstractRenderer.java:135) at org.springframework.extensions.surf.render.bean.PageRenderer.body(PageRenderer.java:70) at org.springframework.extensions.surf.render.AbstractRenderer.render(AbstractRenderer.java:135) at org.springframework.extensions.surf.render.RenderService.startPageRenderer(RenderService.java:633) at org.springframework.extensions.surf.render.RenderService.renderPage(RenderService.java:610) at org.springframework.extensions.surf.render.PresentationUtil.renderPage(PresentationUtil.java:74) at org.springframework.extensions.surf.mvc.PageView.dispatchPage(PageView.java:358) at org.springframework.extensions.surf.mvc.PageView.renderView(PageView.java:299) at org.springframework.extensions.surf.mvc.AbstractWebFrameworkView.renderMergedOutputModel(AbstractWebFrameworkView.java:167) at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250) at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1060) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:798) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302) at org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:213) at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171) at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:619)Caused by: org.springframework.extensions.webscripts.WebScriptException: 04100006 ReferenceError: "search" is not defined. (/WEB-INF/webscripts/semicalpicat/csearch.get.js#3) at org.springframework.extensions.webscripts.processor.JSScriptProcessor.executeScriptImpl(JSScriptProcessor.java:323) at org.springframework.extensions.webscripts.processor.JSScriptProcessor.executeScript(JSScriptProcessor.java:191) … 104 moreCaused by: org.mozilla.javascript.EcmaError: ReferenceError: "search" is not defined. (/WEB-INF/webscripts/semicalpicat/csearch.get.js#3) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3350) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3340) at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3413) at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1612) at org.mozilla.javascript.gen.c11._c0(/WEB-INF/webscripts/semicalpicat/csearch.get.js:3) at org.mozilla.javascript.gen.c11.call(/WEB-INF/webscripts/semicalpicat/csearch.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.c11.call(/WEB-INF/webscripts/semicalpicat/csearch.get.js) at org.mozilla.javascript.gen.c11.exec(/WEB-INF/webscripts/semicalpicat/csearch.get.js) at org.springframework.extensions.webscripts.processor.JSScriptProcessor.executeScriptImpl(JSScriptProcessor.java:313) … 105 more
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2011 05:19 AM
You will need a similar mechanism, but you will want to pass more parameters into your repo-tier webscript to support the advanced search capabilities that you want.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2011 06:07 AM
So I should have a webscript in "Company Home > Data Dictionary > Web Scripts" that performs the search, and then a webscript placed in "<alfresco_base>/tomcat/webapps/wcmqs/WEB-INF/webscripts/" that calls the previous one?
I tried that once but It didn't worked. If this is the right way I'll try again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2011 06:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2011 07:18 AM
What else could I use? I've seen the AssetFactoryWebscriptImpl class but I'm not sure of how I could make something similar and use it in my wqs site.
I tried to do it using webscripts but I haven't managed to make it work.
By now I have done the following:
I created a new folder inside the "root" folder in the WQS site named "csearch".
I've edited the "Template Mapping" of the folder and set it to: ws:article=csearchpage
I've created a new file inside that folder named "csearch.html".
I've created a new XML file inside "<alfresco_base>/tomcat/webapps/wcmqs/WEB-INF/pages/" named "csearch.xml" with the following content:
<?xml version="1.0" encoding="UTF-8"?><page> <id>csearchpage</id> <description>page with 1 main configurable block</description> <template-instance>one-block</template-instance> <authentication>none</authentication> <components> <component> <region-id>main1</region-id> <url>/advsearch/csearch</url> </component> </components></page>
I've created a new webscript inside "<alfresco_base>/tomcat/webapps/wcmqs/WEB-INF/webscripts/advsearch/":
csearch.get.desc.xml:
<webscript> <shortname>Csearch</shortname> <description>Custom Search</description> <url>/advsearch/csearch</url></webscript>
csearch.get.js:
if (url.args['phrase'] != null) { var connector = remote.connect("alfresco"); var data = connector.call("/mysearch/advsearch?q=" + url.args['phrase']); model.response = data; model.phrase = url.args['phrase'];}else { model.phrase = null;}
csearch.get.html.ftl:
<p>Custom Search</p><form action="${url.context}/csearch/csearch.html" method="get"> <fieldset> <input type="hidden" value="${webSite.rootSection.id}" name="sectionId" /> <input type="text" value="${phrase!''}" name="phrase" id="search-phrase" maxlength="100"/> <input type="submit" value="Search" /> </fieldset></form><p>Response: ${response!'no response'}</p>
Then I have created the webscript "advsearch" in Alfresco in the "Company Home > Data Dictionary > Web Scripts > org > alfresco > sample".
advsearch.desc.xml:
<webscript> <shortname>Advanced Search</shortname> <description>Cerca avancada</description> <url>/mysearch/advsearch?q={searchTerm}</url> <format default="json">extension</format> <authentication>guest</authentication> <transaction>required</transaction></webscript>
advsearch.get.json.ftl:{"results" : [<#list nodes as child>{ "name" : "${child.properties.name}" , "creator" : "${child.properties.creator}", "CreatedDate" : "${child.properties.created?datetime}"}<#if child_has_next> , </#if></#list>]}
advsearch.get.js:nodes = search.luceneSearch("TEXT:"+args['q']+"*");var start = 0;var limit = 100;pagedResults = new Array();for (i=0; i < nodes.length && i < limit; i++ ) { var node = nodes[(+start + i)]; if (node != undefined) { pagedResults.push(node); }}model.nodes = pagedResults;model.total = nodes.length;
Then I go to http://<server>:<port>/wcmqs/csearch/csearch.html
And I have the page with my webscript form, but it seems that I get no data from the repo webscript.
If this is a valid approach I will keep trying. I don't know if the way of calling the repo webscript is correct, or the way the JSON data is returned, or something else