From 2a6f6f14d39c4bd1ac38059742ee4a5a28398776 Mon Sep 17 00:00:00 2001 From: Mark Robert Miller Date: Sun, 4 Oct 2009 16:24:39 +0000 Subject: [PATCH] SOLR-1319: Upgrade Solr Highlighter classes to new Lucene Highlighter API git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@821555 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 5 +++++ .../apache/solr/highlight/DefaultSolrHighlighter.java | 2 +- src/java/org/apache/solr/util/HighlightingUtils.java | 11 ----------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index a4c7853bbe2..4b24668f9db 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -731,6 +731,11 @@ Other Changes 48. SOLR-1423: Due to LUCENE-1906, Solr's tokenizer should use Tokenizer.correctOffset() instead of CharStream.correctOffset(). (Uwe Schindler via koji) +49. SOLR-1319, SOLR-1345: Upgrade Solr Highlighter classes to new Lucene Highlighter API. This upgrade has + resulted in a back compat break in the DefaultSolrHighlighter class - getQueryScorer is no longer + protected. If you happened to be overriding that method in custom code, overide getHighlighter instead. + Also, HighlightingUtils#getQueryScorer has been removed as it was deprecated and backcompat has been + broken with it anyway. (Mark Miller) Build ---------------------- diff --git a/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java b/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java index 02d8e7c90c1..fc7ed88d34e 100644 --- a/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java +++ b/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java @@ -165,7 +165,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf * @param fieldName The name of the field * @param request The SolrQueryRequest */ - protected QueryTermScorer getQueryScorer(Query query, String fieldName, SolrQueryRequest request) { + private Scorer getQueryScorer(Query query, String fieldName, SolrQueryRequest request) { boolean reqFieldMatch = request.getParams().getFieldBool(fieldName, HighlightParams.FIELD_MATCH, false); if (reqFieldMatch) { return new QueryTermScorer(query, request.getSearcher().getReader(), fieldName); diff --git a/src/java/org/apache/solr/util/HighlightingUtils.java b/src/java/org/apache/solr/util/HighlightingUtils.java index 9fe319bd6f5..af631fcd6d5 100644 --- a/src/java/org/apache/solr/util/HighlightingUtils.java +++ b/src/java/org/apache/solr/util/HighlightingUtils.java @@ -88,14 +88,6 @@ public class HighlightingUtils implements HighlightParams { return HIGHLIGHTER.getHighlighterX(query, fieldName, request); } - /** - * @deprecated use DefaultSolrHighlighter - * @see DefaultSolrHighlighter - */ - public static QueryTermScorer getQueryScorer(Query query, String fieldName, SolrQueryRequest request) { - return HIGHLIGHTER.getQueryScorerX(query, fieldName, request); - } - /** * @deprecated use DefaultSolrHighlighter * @see DefaultSolrHighlighter#getHighlightFields @@ -145,9 +137,6 @@ class SolrHighlighterX extends DefaultSolrHighlighter { Highlighter getHighlighterX(Query query, String fieldName, SolrQueryRequest request) { return getHighlighter(query, fieldName, request); } - QueryTermScorer getQueryScorerX(Query query, String fieldName, SolrQueryRequest request) { - return getQueryScorer(query, fieldName, request); - } int getMaxSnippetsX(String fieldName, SolrQueryRequest request) { return getMaxSnippets(fieldName, HighlightingUtils.getParams(request)); }