SOLR-1826: Add tests for highlighting with termOffsets=true and overlapping tokens

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1063702 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2011-01-26 13:00:41 +00:00
parent e76ad0990d
commit 20621a4e72
3 changed files with 30 additions and 0 deletions

View File

@ -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
----------------------

View File

@ -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"/>

View File

@ -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'");
}
}