CrafterCMS:如何输出由 solr 索引的 html 主体?
CrafterCMS: How to output html body indexed by solr?
我在我的 RTE 中使用后缀 _html 来实现 solr 的索引功能。
但是,当我显示我的搜索结果时,我需要 html 标签而不是纯文本。有解决办法吗?
编辑:我使用地图 matches = [:]
来存储我的 solr 查询结果。我需要从每个文档结果中获取 content_html
并显示它们。这是我目前的进度:
Groovy:
def contents = [:]
def index = 0
// solr search results are stored in matches.faqs
for (item in matches.faqs) {
// with a solr result document
def aResult = executedQuery.response.documents[index]
// look up the item
def myContentItem = siteItemService.getSiteItem(aResult.localId)
// get the markup you want
contents.put('contentHtml', myContentItem.queryValue("content_html"))
index++
}
一种方法是使用 siteItemService:
从结果中简单地查找您需要的 HTML
Groovy:
// with a solr result document
def aResult = executedQuery.response.documents[0]
// look up the item
def myContentItem = siteItemService.getSiteItem(aResult.localId)
// get the markup you want
def rteHtml = myContentItem.queryValue("theRTEField_html")
我在我的 RTE 中使用后缀 _html 来实现 solr 的索引功能。 但是,当我显示我的搜索结果时,我需要 html 标签而不是纯文本。有解决办法吗?
编辑:我使用地图 matches = [:]
来存储我的 solr 查询结果。我需要从每个文档结果中获取 content_html
并显示它们。这是我目前的进度:
Groovy:
def contents = [:]
def index = 0
// solr search results are stored in matches.faqs
for (item in matches.faqs) {
// with a solr result document
def aResult = executedQuery.response.documents[index]
// look up the item
def myContentItem = siteItemService.getSiteItem(aResult.localId)
// get the markup you want
contents.put('contentHtml', myContentItem.queryValue("content_html"))
index++
}
一种方法是使用 siteItemService:
从结果中简单地查找您需要的 HTMLGroovy:
// with a solr result document
def aResult = executedQuery.response.documents[0]
// look up the item
def myContentItem = siteItemService.getSiteItem(aResult.localId)
// get the markup you want
def rteHtml = myContentItem.queryValue("theRTEField_html")