Best way to include Dynamic Data List Records in search in Liferay 6.1

百般思念 提交于 2019-12-08 09:31:46

问题


In Liferay 6.2 it is possible to set the Indexable option on fields of Dynamic Data List Definitions, thereby making them searchable (as explained in the Documentation for Liferay 6.2)

I want to include DDL records in my search and have to use Liferay 6.1. I am wondering, what would be the best way to go about this.

Right now I have looked into customizing the search, but Dynamic Data Lists are not being mentioned there as an option.

I also looked at Creating an Indexer Post-Processor hook, but if I understand this correctly, it is only able to alter existing indexing processes.

It does seem possible to create Indexers for custom assets, but I wonder if this is the best way to go as the process is probably very time consuming and I don't know if the same process that is applicable to custom assets also works for Dynamic Data Lists in general.

Is there an easier way to achieve searchable Dynamic Data Lists in Liferay 6.1 (like in 6.2) that I am just not seeing?


回答1:


I could not find <indexer-class> declaration in any Dynamic Data portlet definitions in liferay-portlet.xml. So, you will need to create an EXT plugin that has 1) an Indexer class for DDL record through and 2) liferay-portlet.xml updated with <indexer-class> for Portlet 169. After you have successfully achieved this, you will have to update your Search portlet's display settings as explained on this page, and add com.liferay.portlet.dynamicdatamapping.model.DDMContent in the below list:

{"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",
        "com.liferay.portlet.dynamicdatamapping.model.DDMContent"
        ]
    },
...
...

This is high-level approach. You'll need to connect the dots from here. Hope this helps!

(If you're wondering why not use hook instead? Reason: Because hooks don't support overriding liferay-portlet.xml yet, as mentioned here)




回答2:


You can hook main_search.jspf and add the DDLRecord class to the searchContext.getEntryClassNames() array. In this way the search portlet will start searching on DDLRecords too. Very likely you will need to create a custom DDLRecordIndexPostProcessor, because the Summary provided for DDLRecord is not really good (override the postProcessSummary method).



来源:https://stackoverflow.com/questions/22074587/best-way-to-include-dynamic-data-list-records-in-search-in-liferay-6-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!