SOLR-3060: SurroundQParserPlugin highlighting tests

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1448863 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2013-02-22 00:05:58 +00:00
parent 5d1770a6e3
commit 32c4a80577
2 changed files with 23 additions and 2 deletions

View File

@ -181,6 +181,8 @@ Other Changes
* SOLR-4394: Tests and example configs demonstrating SSL with both server * SOLR-4394: Tests and example configs demonstrating SSL with both server
and client certs (hossman) and client certs (hossman)
* SOLR-3060: SurroundQParserPlugin highlighting tests
(Ahmet Arslan via hossman)
================== 4.1.0 ================== ================== 4.1.0 ==================

View File

@ -1,4 +1,3 @@
package org.apache.solr.search; package org.apache.solr.search;
/* /*
@ -45,7 +44,7 @@ public class TestSurroundQueryParser extends AbstractSolrTestCase {
public void testQueryParser() { 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"; 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 "; v="abc abxy cde efg ef e ";
assertU(adoc("id","2", "text",v, "text_np",v)); 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"; t1 = localP + "(1003 2n 1001) 3N 1006";
assertQ(req("q", t1, "indent","true") assertQ(req("q", t1, "indent","true")
,"//*[@numFound='1']"); ,"//*[@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 <em>k</em> <em>l</em> 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 <em>k</em> <em>l</em> m <em>l</em> <em>k</em> j z z z']");
} }
} }