Apache Lucene open-source search software
SOLR-1826: Add tests for highlighting with termOffsets=true and overlapping tokens
Robert Muir20621a4e7257
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 1235a429653..683a722329b 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -733,6 +733,9 @@ Other Changes* SOLR-2213: Upgrade to jQuery 1.4.3 (Erick Erickson via ryan)+* SOLR-1826: Add unit tests for highlighting with termOffsets=true+ and overlapping tokens. (Stefan Oestreicher via rmuir)+Build----------------------diff --git a/solr/src/test-files/solr/conf/schema.xml b/solr/src/test-files/solr/conf/schema.xmlindex 05fa45e7196..6590e20cc95 100644--- a/solr/src/test-files/solr/conf/schema.xml+++ b/solr/src/test-files/solr/conf/schema.xml@@ -483,6 +483,7 @@<field name="nullfirst" type="string" indexed="true" stored="true" sortMissingFirst="true"/><field name="subword" type="subword" indexed="true" stored="true"/>+ <field name="subword_offsets" type="subword" indexed="true" stored="true" termOffsets="true"/><field name="numericsubword" type="numericsubword" indexed="true" stored="true"/><field name="protectedsubword" type="protectedsubword" indexed="true" stored="true"/>diff --git a/solr/src/test/org/apache/solr/highlight/HighlighterTest.java b/solr/src/test/org/apache/solr/highlight/HighlighterTest.javaindex dba81809474..46050f9e39b 100755--- a/solr/src/test/org/apache/solr/highlight/HighlighterTest.java+++ b/solr/src/test/org/apache/solr/highlight/HighlighterTest.java@@ -769,4 +769,30 @@ public class HighlighterTest extends SolrTestCaseJ4 {);}++ public void testSubwordWildcardHighlight() {+ assertU(adoc("subword", "lorem PowerShot.com ipsum", "id", "1"));+ assertU(commit());+ assertQ("subword wildcard highlighting",+ req("q", "subword:pow*", "hl", "true", "hl.fl", "subword"),+ "//lst[@name='highlighting']/lst[@name='1']" ++ "/arr[@name='subword']/str='lorem <em>PowerShot.com</em> ipsum'");+ }++ public void testSubwordWildcardHighlightWithTermOffsets() {+ assertU(adoc("subword_offsets", "lorem PowerShot.com ipsum", "id", "1"));+ assertU(commit());+ assertQ("subword wildcard highlighting",+ req("q", "subword_offsets:pow*", "hl", "true", "hl.fl", "subword_offsets"),+ "//lst[@name='highlighting']/lst[@name='1']" ++ "/arr[@name='subword_offsets']/str='lorem <em>PowerShot.com</em> ipsum'");+ }+ public void testSubwordWildcardHighlightWithTermOffsets2() {+ assertU(adoc("subword_offsets", "lorem PowerShot ipsum", "id", "1"));+ assertU(commit());+ assertQ("subword wildcard highlighting",+ req("q", "subword_offsets:pow*", "hl", "true", "hl.fl", "subword_offsets"),+ "//lst[@name='highlighting']/lst[@name='1']" ++ "/arr[@name='subword_offsets']/str='lorem <em>PowerShot</em> ipsum'");+ }}