2014-02-27 17 views
0

在Liferay的6.2就可以了Indexable選項上動態數據列表定義的字段設置,從而使他們搜索(as explained in the Documentation for Liferay 6.2最佳方式6.1

我想包括DDL記錄在我的搜索中,並且必須使用Liferay 6.1。我想知道,什麼是最好的方式去做這件事。

現在我已經看過customizing the search,但動態數據列表沒有被提及作爲一個選項。

我也看了Creating an Indexer Post-Processor hook,但如果我正確理解這一點,它只能夠改變現有的索引過程。

create Indexers for custom assets似乎是可能的,但我不知道這是否是最好的方法,因爲該過程可能非常耗時,並且我不知道適用於自定義資產的相同過程是否也適用於Dynamic數據列表一般。

有沒有一種更簡單的方法來實現Liferay 6.1中的可搜索動態數據列表(如6.2),我只是沒有看到?

回答

1

我在liferay-portlet.xml的任何動態數據portlet定義中找不到<indexer-class>聲明。因此,您需要創建一個EXT插件,該插件具有1)用於DDL記錄的索引器類和2)用Portlet 169更新爲<indexer-class>的liferay-portlet.xml。成功完成此操作後,您必須更新搜索作爲this page解釋,並在下面的列表中添加com.liferay.portlet.dynamicdatamapping.model.DDMContent Portlet的顯示設置:

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

這是高層次的方法。你需要從這裏連接點。希望這可以幫助!

(如果你想知道爲什麼不使用掛鉤,而不是原因:由於鉤不支持覆蓋的Liferay-portlet.xml中然而,當提到here

0

您可以掛鉤main_search.jspf並添加DDLRecord class到searchContext.getEntryClassNames()數組。通過這種方式,搜索portlet也將開始在DDLRecords上進行搜索。很可能你需要創建一個自定義的DDLRecordIndexPostProcessor,因爲爲DDLRecord提供的Summary不是很好(覆蓋postProcessSummary方法)。