cancel
Showing results for 
Search instead for 
Did you mean: 

Minimal form required to search tag:taggable?

jharrop
Champ in-the-making
Champ in-the-making
Hi

I've got my server configured to use the TaggingSample, and I can search the tag:taggable aspect via advanced search, having added:

<config evaluator="string-compare" condition="Advanced Search">
   <advanced-search>
      <custom-properties>
         <meta-data aspect="tag:taggable" property="tag:tags" />
      </custom-properties>
   </advanced-search>
</config>

to the web-client-config.custom.xsml

I'd now like to add a search box to each page in the web client so I can easily search by tag value, without having to navigate into advanced search to do so.

What's the easiest way to do this, please? 

thanks

Jason
5 REPLIES 5

gavinc
Champ in-the-making
Champ in-the-making
The easiest way would be to add your search field to one of the pages that is included in every page in the app i.e. shelf.jsp or titlebar.jsp, this will avoid the need to change more or less every page in the app!

However, neither of these pages are overridable at the moment so you would have to change the originals and remember to re-apply your changes when you upgrade.

jharrop
Champ in-the-making
Champ in-the-making
Hi Gavin

To try to get this working, I've created a simple page named search-tags.html (based on advanced-search.jsp) with form action:

    <form id="advsearch" name="advsearch" method="post" action="http://localhost:8080/alfresco/faces/jsp/dialog/advanced-search.jsp" accept-charset="UTF-8" enctype="application/x-www-form-urlencoded">

However, the form only works if the last page I opened in the browser was advanced-search.jsp.  In this case, it will display search results as expect, and in the logs I see:

20:23:24,593 DEBUG [web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=#{AdvancedSearchBean.search}, outcom
e=browse)
20:23:24,593 DEBUG [web.app.AlfrescoNavigationHandler] Current view id: /jsp/dialog/advanced-search.jsp
20:23:24,593 DEBUG [web.app.AlfrescoNavigationHandler] No dispatch context found
20:23:24,593 DEBUG [web.app.AlfrescoNavigationHandler] Passing outcome 'browse' to original navigation handler
20:23:24,593 DEBUG [application.jsp.JspViewHandlerImpl] Created view /jsp/browse/browse.jsp
20:23:24,593 DEBUG [web.app.AlfrescoNavigationHandler] view stack: []
20:23:24,593 DEBUG [application.jsp.JspViewHandlerImpl] Dispatching to /jsp/browse/browse.jsp
20:23:24,703 DEBUG [web.bean.SearchContext] Query:  +@\{extension.tags\}tags:testtag1* AND (( TYPE:"{http://www.alfresco
.org/model/content/1.0}content"  OR  TYPE:"{http://www.alfresco.org/model/content/1.0}folder" ))
20:23:25,562 DEBUG [web.bean.BrowseBean] Search results returned: 1

If however the last page I looked at (before opening my search-tags.html form) was some other page, then when I submit the form, I see advanced-search.jsp, and the logs merely show:

20:30:37,015 DEBUG [application.jsp.JspViewHandlerImpl] Created view /jsp/dialog/advanced-search.jsp
20:30:37,015 DEBUG [application.jsp.JspViewHandlerImpl] Dispatching to /jsp/dialog/advanced-search.jsp

Any hints?

thanks

Jason

gavinc
Champ in-the-making
Champ in-the-making
I presume from what you say your <form> tag has been added directly to the page yourself?

If so, this is not going to work properly, you need to use the JSF form tag to properly invoke the JSF lifecycle i.e. your page needs to have:

<h:form id="tag-search-form">
….

Furthermore, you need to be using JSP pages to include the JSF forms, it is not going to work from static HTML pages.

jharrop
Champ in-the-making
Champ in-the-making
ok thanks, must confess I've not used JSF before.

I used the JSF form tag as you suggested, in shelf.jsp.

The form displayed as expected, but then I submitted it …

.. and since submitting it, all I have been able to get is:

javax.faces.FacesException: Could not get property size of component browse:tag-search-form:txtTitle

caused by:
org.apache.jasper.JasperException: Could not get property size of component browse:tag-search-form:txtTitle

caused by:
javax.faces.FacesException: Could not get property size of component browse:tag-search-form:txtTitle

caused by:
java.lang.reflect.InvocationTargetException

caused by:
javax.faces.el.PropertyNotFoundException: Bean: org.alfresco.web.bean.generator.TextFieldGenerator, property: size

That is, any attempt to view say browse.jsp will display the error page with the above message.

Any thoughts?

thanks

Jason

jharrop
Champ in-the-making
Champ in-the-making
bump .. thanks