BLOG: Web Content Management

Welcome to Oshyn’s Web Content Management Blog where our experts discuss the latest developments and best practices in the Content Management industry with a focus on several leading platforms: Drupal, EPiServer, Jahia, Open Text and Sitecore.

Jahia Search in the Enterprise

Jahia Search in the Enterprise

Juan Pablo Albuja... - Thursday, January 14, 2010

Jahia has an embedded search engine that can be used by a Tag Library. This library offers components to build forms, field elements, components to display search results, and components to implement the pagination. I want to share a way of how to use the Jahia Search Tag Library to do full text searches.


Configuring Search Results Page Template

I am assuming that you have some experience with template development. If not, you can find a quick review of template development here. When you create a template set, you need to configure the file templates.xml to declare the templates that are going to be part of the template, but also you can use this file to configure which page is going to handle search results. You need to add the following configuration to the file templates.xml.


<common-pages>
<search-results>SearchResult.jsp</search-results>
</common-pages>


SearchResults.jsp is the page that is going to display the search results executed by the Jahia Search Taglib.


Search Form

To build search forms, first you need to include the Jahia Search Taglib in the .jsp file that is going to contain the form


<%@ taglib uri="http://www.jahia.org/tags/search" prefix="s" %>


Then you need to use the tags and to build the form. Following is an example form:


<s:form name="fulltextsearch">
<table>
<tr>
<td class="title" style="width: 150px;">Search</td>
<td style="width: 350px;"><s:term class="text1"/></td>
<td><input type="submit" value="search" class="button"/></td>
</tr>
</table>
</s:form>


Search Results Page

The search results page is the page configured in the file template.xml to display the results. This page is called every time that a submit is performed in the s:form. You need to use the libraries:

<%@ taglib uri="http://www.jahia.org/tags/search" prefix="s" %>
<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg" %>


And the tags <s:results>, <pg:pager>, <s:resultIterator>,  <pg:item> to display the results.

The tag <s:results> is in charge to execute the search  and expose the results to be displayed, and <s:resultIterator> is in charge to iterate over the results.  The tag <s:results>  has the important method getCount(), to obtain the number of results, and can be accessed by the EL (Expression Language) ${count}.

The tag <pg:pager> is in charge of implement the pagination of large data sets and <pg:item> represents each page returned by the search.


Following is an example of how to use the above elements in action:

<s:results>
<table>
<pg:pager maxPageItems="10" url="${jahia.page.url}" export="currentPageNumber=pageNumber">
<s:resultIterator>
<pg:item>
<tr>
<td><a href="${hit.link}">${fn:escapeXml(hit.title)}</a></td>
<td>${hit.summary}</td>
</tr>
</pg:item>
</s:resultIterator>
</pg:pager>
</table>
</s:results>


Notice that the element <pg:pager> is used to define the number of results displayed per page. The <s:results> tag returns a java.util.List<org.jahia.engines.search.Hit> List, so for that reason you can use the EL ${hit.link}, ${hit.title} and ${hit.summary}.

Also you can include more pagination elements to handle the navigation. You can use the tags <pg:prev> and <pg:next> inside the tag <pg:index> like the following example:


<pg:index export="itemCount">
<pg:prev ifnull="true">
<c:if test="${not empty pageUrl}">
<a href="${pageUrl}">previous</a>
</c:if>
<c:if test="${empty pageUrl}">
previous
</c:if>
</pg:prev>        |
<pg:next ifnull="true">
<c:if test="${not empty pageUrl}">
<a> <a href="${pageUrl}">next</a></c:if>
<c:if test="${empty pageUrl}">
next
</c:if>
</pg:next>
</pg:index>


The following screenshot shows a search result page with pagination. Each page has the size of one, and notice that at the bottom of the page are the next and previous arrows to navigate through pages.


ajax rotator
Recent Posts

RSS feeds
Tag cloud
LDAP reddot higher education Sharepoint new sites drools web marketing theming Delivery Server cluster IT Investment website design los angeles Navigation content mangement Sitecore open text web solutions cms los angeles, content management los angeles, web development los angeles, website design los angeles, web design los angeles, sitecore meetup, sitecore user group OO Development iphone design patterns portlets Live Server licencing web development los angeles Visual Studio sitecore meetup php templating EPiServer Active Directory deployment configuration management google maps jahia wcm Actionscript 3 CMS usability twitter lucene plugin command line facebook developers html sitecore online marketing suite, online marketing suite keyword selection social network frontend optimization webcomponent web3.0 content authors search engine content management whitepaper IIS industry challenges location VB Drupal thoughts code design Solr mashups mashup mashware ASP.NET MVC foursquare ajax push social media Marketing Automation asp memcache web evolution facebook reddot cms higher education web marketing for dummies E-commerce jsp marketing online marketing development reddot whitepaper lead management scalability VS2010 .net template design target dynament sitecore layout sitecore ECM Ubuntu Server missing images presentation layer portal liferay linux opentext ui mysql ipc Database google appEngine web2.0 patterns enterprise cms white paper Flash open text management server profile box LS lead generation web design los angeles content authoring tuning cloud facebook app, OS 3.0, three20 fbml Business Users javascript higher education dynament reddot multilingual CMS Training google geo editing content icefaces project management MVC Acquia LiveServer reddot white paper inbound marketing oshyn concrete5 java wcm Web development friendly url Maven cloud computing management content management systems multisite Velocity Sitecore Active Directory jquery, jquery plugin geographical jquery sitecore user group css call to action HubSpot google analytics cms los angeles open-source redundant database structure optimization SMM jahia cms boost sitecore email campaign manager GIS open text liveserver release management architecture VPP CMS google search appliance sitecore oms open text delivery server print EPiServer reddot cms WCM Design Patterns rdbs content management los angeles software design cookie-free domain cms whitepaper spatial modules web services sales 2.0 campaigns web design mobile profile tab keywords RFP communicating data access oms url open text cms ASP.NET Visual Basic open source ubuntu Ubercart CRM performance content management white paper social 2.0 tools CTA sitecore devices SEO design php5 ajax consulting APC GSA Jahia integration Active Directory open text tuckey AS3 web content management search suggest drush Dynamic Data postgis JSR-168
2010 Copyright Oshyn. All rights reserved.