【问题标题】:Best way to include Dynamic Data List Records in search in Liferay 6.1在 Liferay 6.1 的搜索中包含动态数据列表记录的最佳方式
【发布时间】:2014-02-27 16:32:42
【问题描述】:

在 Liferay 6.2 中,可以在动态数据列表定义的字段上设置 Indexable 选项,从而使它们可搜索 (as explained in the Documentation for Liferay 6.2)

我想在我的搜索中包含 DDL 记录并且必须使用 Liferay 6.1。我想知道,最好的方法是什么。

现在我已经查看了customizing the search,但没有提到动态数据列表作为选项。

我还查看了Creating an Indexer Post-Processor hook,但如果我理解正确,它只能更改现有的索引进程。

create Indexers for custom assets 似乎确实可行,但我想知道这是否是最好的方法,因为该过程可能非常耗时,而且我不知道适用于自定义资产的相同过程是否也适用于一般的动态数据列表。

是否有一种更简单的方法可以在 Liferay 6.1(如 6.2 中)中实现可搜索的动态数据列表,而我只是没有看到?

【问题讨论】:

    标签: indexing liferay liferay-6 wcm


    【解决方案1】:

    我在 liferay-portlet.xml 的任何动态数据 portlet 定义中都找不到 <indexer-class> 声明。因此,您需要创建一个 EXT 插件,该插件具有 1) 用于 DDL 记录的 Indexer 类和 2) 使用 <indexer-class> 更新 Portlet 169 的 liferay-portlet.xml。成功实现此目的后,您必须更新您的搜索 portlet 的显示设置如 this page 中所述,并在以下列表中添加 com.liferay.portlet.dynamicdatamapping.model.DDMContent

    {"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"
            ]
        },
    ...
    ...
    

    这是高级方法。您需要从这里连接点。希望这会有所帮助!

    (如果你想知道为什么不使用 hook 来代替?原因:因为 hooks 还不支持覆盖 liferay-portlet.xml,正如提到的 here

    【讨论】:

      【解决方案2】:

      您可以挂钩 main_search.jspf 并将 DDLRecord 类添加到 searchContext.getEntryClassNames() 数组。这样,搜索 Portlet 也将开始在 DDLRecords 上进行搜索。您很可能需要创建一个自定义 DDLRecordIndexPostProcessor,因为为 DDLRecord 提供的摘要并不是很好(覆盖 postProcessSummary 方法)。

      【讨论】:

        猜你喜欢
        • 2012-07-22
        • 1970-01-01
        • 1970-01-01
        • 2010-11-02
        • 1970-01-01
        • 2013-03-13
        • 1970-01-01
        • 2020-07-12
        • 1970-01-01
        相关资源
        最近更新 更多