Skip to content

Apache Lucene open-source search software

Improve example/files /browse highlight escaping

Erik Hatcherac60a0f8eb8b
diff --git a/solr/example/files/conf/params.json b/solr/example/files/conf/params.json
index fb1ab6721b0..e1af6792f7c 100644
--- a/solr/example/files/conf/params.json
+++ b/solr/example/files/conf/params.json
@@ -21,6 +21,8 @@
"hl.fl":"content",
"v.locale":"${locale}",
"debug":"true",
+ "hl.simple.pre":"HL_START",
+ "hl.simple.post":"HL_END",
"":{"v":0}},
"velocity":{
"wt":"velocity",
diff --git a/solr/example/files/conf/velocity/hit.vm b/solr/example/files/conf/velocity/hit.vm
index f00daeea39d..3ce470d1267 100644
--- a/solr/example/files/conf/velocity/hit.vm
+++ b/solr/example/files/conf/velocity/hit.vm
@@ -46,7 +46,7 @@
#set($pad = "")
#foreach($v in $response.response.highlighting.get($docId).get("content"))
- $pad$v
+ $pad$esc.html($v).replace("HL_START","<em>").replace("HL_END","</em>")
#set($pad = " ... ")
#end