mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
Add a test that the typename isn't highlighted
This commit is contained in:
parent
e0599bfb66
commit
646d24ebdc
@ -19,6 +19,7 @@
|
||||
package org.elasticsearch.search.highlight;
|
||||
|
||||
import com.carrotsearch.randomizedtesting.generators.RandomPicks;
|
||||
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.search.SearchRequestBuilder;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
@ -2533,6 +2534,24 @@ public class HighlighterSearchIT extends ESIntegTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testDoesNotHighlightTypeName() throws Exception {
|
||||
XContentBuilder mapping = XContentFactory.jsonBuilder().startObject().startObject("typename").startObject("properties")
|
||||
.startObject("foo").field("type", "string")
|
||||
.field("index_options", "offsets")
|
||||
.field("term_vector", "with_positions_offsets")
|
||||
.endObject().endObject().endObject().endObject();
|
||||
assertAcked(prepareCreate("test").addMapping("typename", mapping));
|
||||
ensureGreen();
|
||||
|
||||
indexRandom(true, client().prepareIndex("test", "typename").setSource("foo", "test typename"));
|
||||
|
||||
for (String highlighter: new String[] {"plain", "fvh", "postings"}) {
|
||||
SearchResponse response = client().prepareSearch("test").setTypes("typename").setQuery(matchQuery("foo", "test"))
|
||||
.highlighter(new HighlightBuilder().field("foo").highlighterType(highlighter).requireFieldMatch(false)).get();
|
||||
assertHighlight(response, 0, "foo", 0, 1, equalTo("<em>test</em> typename"));
|
||||
}
|
||||
}
|
||||
|
||||
@AwaitsFix(bugUrl="Broken now that BoostingQuery does not extend BooleanQuery anymore")
|
||||
public void testFastVectorHighlighterPhraseBoost() throws Exception {
|
||||
assertAcked(prepareCreate("test").addMapping("type1", type1TermVectorMapping()));
|
||||
|
Loading…
x
Reference in New Issue
Block a user