سؤال

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?

هل كانت مفيدة؟

المحلول

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)

نصائح أخرى

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).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top