-
Notifications
You must be signed in to change notification settings - Fork 36
Adding Support for New Asset Types
Which asset types you search for is configurable from GSearch Asset Type configuration. Which you can retrieve back to the user interface, is however dependent on compatible (ResultItemBuilder)[https://github.com/peerkar/liferay-gsearch/blob/master/gsearch-core-api/src/main/java/fi/soveltia/liferay/gsearch/core/api/results/item/ResultItemBuilder.java]. By default, Liferay GSearch supports the following asset types:
- Web Content
- File Entry
- Blogs Entry
- Wiki Page
- Knowledge base article
- Message Board message
Additionally, there's a default result item builder for any new configured asset. If that's not sufficient for displaying your asset properly you have to implement a new ResultItemBuilder component for that asset type.
You can also configure non Liferay assets (in same index) to be searched for and retrieved. With this feature you can introduce external documents in your Liferay search results. There is a sample configuration and ResultItemBuilder for this scenario.
To add support for a new asset type:
- Create a new module
- Create a service component implementing ResultItemBuilder interface (see samples in core-impl module)
- Add localizations in the web module
- Add your new type to the asset type selection menu in the Configuration. For example:
[
{
"key": "my-new-asset-type",
"entryClassName": "com.example.model.MyNewAssetType"
}
]
- Deploy the module and refresh the core-impl bundle in case of problems