I used the suffix _html in my RTEs for solr's indexing functionality. However, when I display my search result, I need the html tags rather than the plain text. Is there a work around to do this?
Edit: I use a map, matches = [:]
, to store the results of my solr query. I need to get the content_html
from each document results and display them. Here's my progress so far:
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++
}
One approach is to simply lookup the HTML you need from your result using the siteItemService:
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")