Skip to content

Commit

Permalink
Deprecate postings highlighter
Browse files Browse the repository at this point in the history
This change adds a deprecation warning for removal in 6.0.

Relates elastic#25028
  • Loading branch information
jimczi committed Jun 9, 2017
1 parent a457c46 commit 195395b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import org.apache.lucene.search.highlight.Snippet;
import org.apache.lucene.util.CollectionUtil;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.text.Text;
import org.elasticsearch.index.mapper.FieldMapper;
import org.elasticsearch.search.fetch.FetchPhaseExecutionException;
Expand All @@ -44,13 +46,15 @@
import java.util.Locale;
import java.util.Map;

@Deprecated
public class PostingsHighlighter implements Highlighter {
private static DeprecationLogger deprecationLogger = new DeprecationLogger(Loggers.getLogger(PostingsHighlighter.class));

private static final String CACHE_KEY = "highlight-postings";

@Override
public HighlightField highlight(HighlighterContext highlighterContext) {

deprecationLogger.deprecated("[postings] highlighter is deprecated, please use [unified] instead");
FieldMapper fieldMapper = highlighterContext.mapper;
SearchContextHighlight.Field field = highlighterContext.field;
if (canHighlight(fieldMapper) == false) {
Expand Down
7 changes: 6 additions & 1 deletion docs/reference/search/request/highlighting.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,13 @@ This is repeated for every field and every document that needs highlighting. If
[[postings-highlighter]]
==== Postings highlighter

deprecated[5.5.0,This highlighter type is deprecated and will be removed. Please use the `unified` highlighter instead. ]


If `index_options` is set to `offsets` in the mapping the postings highlighter
will be used instead of the plain highlighter. The postings highlighter:
will be used instead of the plain highlighter.

The postings highlighter:

* Is faster since it doesn't require to reanalyze the text to be highlighted:
the larger the documents the better the performance gain should be
Expand Down

0 comments on commit 195395b

Please sign in to comment.