diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 874eba2ccec..34fc6e7fbe9 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -181,6 +181,8 @@ Other Changes * SOLR-4394: Tests and example configs demonstrating SSL with both server and client certs (hossman) +* SOLR-3060: SurroundQParserPlugin highlighting tests + (Ahmet Arslan via hossman) ================== 4.1.0 ================== diff --git a/solr/core/src/test/org/apache/solr/search/TestSurroundQueryParser.java b/solr/core/src/test/org/apache/solr/search/TestSurroundQueryParser.java index bce3f6c8c0f..196880896be 100644 --- a/solr/core/src/test/org/apache/solr/search/TestSurroundQueryParser.java +++ b/solr/core/src/test/org/apache/solr/search/TestSurroundQueryParser.java @@ -1,4 +1,3 @@ - package org.apache.solr.search; /* @@ -45,7 +44,7 @@ public class TestSurroundQueryParser extends AbstractSolrTestCase { public void testQueryParser() { String v = "a b c d e a b c f g h i j k l m l k j z z z"; - assertU(adoc("id","1", "text",v, "text_np",v)); + assertU(adoc("id","1", "text",v, "text_np",v, "name",v)); v="abc abxy cde efg ef e "; assertU(adoc("id","2", "text",v, "text_np",v)); @@ -84,6 +83,26 @@ public class TestSurroundQueryParser extends AbstractSolrTestCase { t1 = localP + "(1003 2n 1001) 3N 1006"; assertQ(req("q", t1, "indent","true") ,"//*[@numFound='1']"); + + // test highlighted response with ordered query and hl.usePhraseHighlighter=true + assertQ(req("q", "{!surround df=name}k w l", + "hl", "true", + "hl.fl", "name", + "hl.usePhraseHighlighter", "true") + ,"//*[@numFound='1']" + ,"//lst[@name='highlighting']/lst[@name='1']" + ,"//lst[@name='1']/arr[@name='name']/str[.='a b c d e a b c f g h i j k l m l k j z z z']"); + + // test highlighted response with ordered query and hl.usePhraseHighlighter=false + assertQ(req("q", "{!surround df=name}k w l", + "hl", "true", + "hl.fl", "name", + "hl.usePhraseHighlighter", "false") + ,"//*[@numFound='1']" + ,"//lst[@name='highlighting']/lst[@name='1']" + ,"//lst[@name='1']/arr[@name='name']/str[.='a b c d e a b c f g h i j k l m l k j z z z']"); } + + }