« Back to Search

Faceted Search

[work in progress]

The Search Portlet #

Starting in version 6.1 the Search Portlet provides faceted search features. When a search is performed facet information will appear based on the results of the search. The number of each asset type, the most frequently occuring tags and categories as well as their frequency will all appear in the left hand column of the portlet. The terms that appear here can also be used to further refine the search results by selecting them. Once you select a term from each set search will be refreshed including the newly selected term in the query and showing results that match. Combinging several terms can produce considerably more accurate results very quickly.

The default Facets that appear are:

  • Asset Type (Bookmarks, Blogs Entries, Web Content Articles, Document Library Files, Users, etc.)
  • Asset Tags (or simply tags)
  • Asset Categories (or simply categories)
  • A Date range selector for the "modified" date field of entries is also provided (but doesn't provide facet data relative the the ranges)

Configuration Options #

In addition to these UI changes there are several options in the Search Portlet's configuration that allow altering the behavior of the facet information.

The Configuration settings are broken down into two sections:

Display Settings #

These settings are further broken down into Basic and Advanced groups of options.

Basic #

The basic options allow you to simply enable or disable the four preconfigured facets listed above:

  • Display Asset Type Facet
  • Display Asset Tags Facet
  • Display Asset Categories Facet
  • Display Modified Range Facet
Advanced #

When in Advanced mode, you are presented with a text area that is used for pasting a JSON configuration string. More on this below when discussing the Faceted Search API.

Other Settings #

This section provides a few less used but importan settings.

  • Display Results in Document Form (This is for use in testing search behavior.)
  • View in Context
  • Display Main Query (This is for use in testing search behavior.)
  • Display Open Search Results (This will show results from third party Open Search plugins.) 

Facet Search API #

The UI changes are not the only new feature to the search portlet. A new API was introduced which allows for simple creation of new facet configurations and searches. This API uses a JSON based configuration to define the details of facets used for the search.

As an example, here is the JSON string for the default configuration which define the four facets discussed above.

{
	facets: [
		{
			className: 'com.liferay.portal.kernel.search.facet.AssetEntriesFacet',
			data: {
				frequencyThreshold: 1,
				values: [
					'com.liferay.portlet.bookmarks.model.BookmarksEntry',
					'com.liferay.portlet.blogs.model.BlogsEntry',
					'com.liferay.portlet.calendar.model.CalEvent',
					'com.liferay.portlet.documentlibrary.model.DLFileEntry',
					'com.liferay.portlet.journal.model.JournalArticle',
					'com.liferay.portlet.messageboards.model.MBMessage',
					'com.liferay.portlet.wiki.model.WikiPage',
					'com.liferay.portal.model.User'
				]
			},
			displayStyle: 'asset_entries',
			fieldName: 'entryClassName',
			label: 'asset-type',
			order: 'OrderHitsDesc',
			static: false,
			weight: 1.5
		},
		{
			className: 'com.liferay.portal.kernel.search.facet.MultiValueFacet',
			data: {
				displayStyle: 'list',
				frequencyThreshold: 1,
				maxTerms: 10,
				showAssetCount: true
			},
			displayStyle: 'asset_tags',
			fieldName: 'assetTagNames',
			label: 'tag',
			order: 'OrderHitsDesc',
			static: false,
			weight: 1.4
		},
		{
			className: 'com.liferay.portal.kernel.search.facet.MultiValueFacet',
			data: {
				displayStyle: 'list',
				frequencyThreshold: 1,
				maxTerms: 10,
				showAssetCount: true
			},
			displayStyle: 'asset_tags',
			fieldName: 'assetCategoryNames',
			label: 'category',
			order: 'OrderHitsDesc',
			static: false,
			weight: 1.3
		},
		{
			className: 'com.liferay.portal.kernel.search.facet.RangeFacet',
			data: {
				frequencyThreshold: 1,
				ranges: [
					{label:'modified', range:'[19700101000000 TO *]'}
				]
			},
			displayStyle: 'modified',
			fieldName: 'modified',
			label: 'modified',
			order: 'OrderHitsDesc',
			static: false,
			weight: 1.1
		}
	]
}
0 Attachments
16544 Views
Average (3 Votes)
The average rating is 2.0 stars out of 5.
Comments
Threaded Replies Author Date
How to implement it in working manner i follow... himanshu jain January 1, 2012 11:41 PM
Nice introduction on Faceted Search. Could you... Gwowen Fu September 10, 2012 7:14 AM

How to implement it in working manner i follow all the steps but no result is der.Can anyone help me in this issue
Posted on 1/1/12 11:41 PM.
Nice introduction on Faceted Search. Could you put up a simple example on using Facet Search API.
Posted on 9/10/12 7:14 AM.