【问题标题】:How can I search content in liferay using tags only(not when keyword is available within content)?如何仅使用标签在 liferay 中搜索内容(当关键字在内容中可用时除外)?
【发布时间】:2012-12-08 21:09:49
【问题描述】:

我正在使用 Liferay 6.1.1。如何仅使用标签在 Liferay 中搜索内容(当关键字在内容中可用时除外)。当我搜索关键字时,搜索会在标题、内容中查找关键字作为所有资产类型的标签。我想要的只是在所有资产类型的标签内搜索关键字。 提前致谢。

【问题讨论】:

    标签: search tags liferay


    【解决方案1】:

    最简单的方法是创建一个您自己的搜索 portlet,它从关键字中获取标签 ID 列表,如果您想要完全匹配,则使用 AssetTagLocalServiceUtil.getTags 或带有“like”限制的 dynamicQuery。 那么:

    AssetEntryQuery query = new AssetEntryQuery(); 
    long[] tagIds = {array of tag ids obtained};  
    query.setAnyTagIds(tagIds);
    //OR: query.setAllTagIds(atagIds);
    List<AssetEntry> results = AssetEntryLocalServiceUtil.getEntries(query);
    

    否则,您可以尝试使用分面搜索,如下所述: http://www.liferay.com/web/raymond.auge/blog/-/blogs/12917352#h.itt7gsmb81v4

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-12
      • 1970-01-01
      • 1970-01-01
      • 2012-01-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多