Skip to content

Instantly share code, notes, and snippets.

@rotty3000
Created October 23, 2011 15:47
Show Gist options
  • Save rotty3000/1307492 to your computer and use it in GitHub Desktop.
Save rotty3000/1307492 to your computer and use it in GitHub Desktop.
original facets JSON with some docs
{
/*
* You can have any number of facet objects in the facet array, including 0.
*/
facets: [
/*
* Each object has required fields:
*
* className: the classname of the entity (used for finding the
* indexer, etc.)
* data: an object that defines the facet type specific settings
* (this is flexible so that developers can add their own
* settings and pass those from configuration to display)
* displayStyle: the keyword referencing the template used to
* render this facet type (each facet type could have
* any number of display types, and since these are just
* keywords referencing a jsp or template file so that
* developers can create their own display types)
* fieldName: is the name of the facet in the index
* label: the label used for localize naming of the facet in the
* list of facets
* order: this is the ordering in which the facet results will be
* returned, there are only two possible values
* - 'OrderHitsDesc', highest frequency at the top
* - 'OrderValueAsc', ordered by term alphabetically
* static: whether the configuration is set with static settings
* and if so indicates that the facet not be rendered (this
* allows for predefined custom searches that have unchangeable
* presets)
* weight: when the facet is not static, the weight indicates
* the order in which to list the facets
*/
{
className: 'com.liferay.portal.kernel.search.facet.AssetEntriesFacet',
data: {
/*
* The AssetEntriesFacet facet type has two settings:
*
* frequencyThreshold: indicates the minimum frequency at
* which a facet term should be displayed
* values: an array of the asset types that are allowed to
* be searched
*/
frequencyThreshold: 1,
values: [
'com.liferay.portlet.bookmarks.model.BookmarksEntry',
'com.liferay.portlet.blogs.model.BlogsEntry',
'com.liferay.portlet.calendar.model.CalEvent',
'com.liferay.portlet.journal.model.JournalArticle',
'com.liferay.portlet.messageboards.model.MBMessage',
'com.liferay.portlet.wiki.model.WikiPage',
]
},
displayStyle: 'asset_entries',
fieldName: 'entryClassName',
label: 'asset-type',
order: 'OrderHitsDesc',
static: false,
weight: 1.5
},
{
className: 'com.liferay.portal.kernel.search.facet.MultiValueFacet',
data: {
/*
* The MultiValueFacet facet type has four settings:
*
* displayStyle: 'list' shows the facet results as a center
* justified list or 'cloud' which shows the frequency
* as larger text
* frequencyThreshold: indicates the minimum frequency at
* which a facet term should be displayed
* maxTerms: only show this many terms (the first
* 'maxTerms' facet results based on the 'order'
* setting)
* showAssetCount: whether or not to show the frequency in
* parenthesis
*/
displayStyle: 'list',
frequencyThreshold: 1,
maxTerms: 10,
showAssetCount: true
},
displayStyle: 'asset_tags',
fieldName: 'assetTagNames',
label: "tags",
order: 'OrderValueAsc',
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: "categories",
order: 'OrderValueAsc',
static: false,
weight: 1.3
},
{
className: 'com.liferay.portal.kernel.search.facet.RangeFacet',
fieldName: 'modified',
data: {
/*
* The RangeFacet facet type has two settings:
*
* frequencyThreshold: indicates the minimum frequency at
* which a facet term should be displayed
* ranges: and array of preset ranges to choose from, each
* defined by a label and range definition. the range
* definitions must be valid lucene range syntax and
* must match the type of the field (when this type
* config is 'static' only the first range entry will
* be used, in the case of using the 'calendar'
* displayType, only a single range should be applied,
* and if the upper bound value is '*' then a current
* date function will be used for that value)
*/
frequencyThreshold: 1,
ranges: [
{label:'modified', range:'[19700101000000 TO *]'}
]
},
displayStyle: 'calendar',
label: 'modified',
order: 'OrderHitsDesc',
static: false,
weight: 1.1
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment