This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch branch_9_0
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9_0 by this push:
new 4d39b56 SOLR-13138: Remove deprecations in highlighting (#555)
4d39b56 is described below
commit 4d39b5673c1139ce959cc23032e12ccd87656c90
Author: David Smiley <[email protected]>
AuthorDate: Fri Jan 28 00:24:29 2022 -0500
SOLR-13138: Remove deprecations in highlighting (#555)
hl.method=postings was marked for deprecation and un-documented a release
or more ago.
---
solr/CHANGES.txt | 2 +
.../solr/handler/component/HighlightComponent.java | 26 +--
.../java/org/apache/solr/util/SolrPluginUtils.java | 6 +-
.../conf/solrconfig-postingshighlight.xml | 36 ----
.../solr/highlight/FastVectorHighlighterTest.java | 11 +-
.../solr/highlight/HighlighterConfigTest.java | 14 +-
.../org/apache/solr/highlight/HighlighterTest.java | 32 ++--
.../highlight/TestPostingsSolrHighlighter.java | 184 ---------------------
.../handler/clustering/ClusteringComponent.java | 5 +-
.../src/major-changes-in-solr-9.adoc | 2 +
10 files changed, 44 insertions(+), 274 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 5bd62c8..c23e073 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -529,6 +529,8 @@ Bug Fixes
* SOLR-15842: Async response for backups now correctly aggregates and returns
information (Houston Putman, Artem Abeleshev, Christine Poerschke)
+* hl.method=postings highlighter, deprecated in 7.0
+
* SOLR-15944: The Tagger's JSON response format now always uses an object/map
to represent each tag instead of an
array, which didn't make sense. (David Smiley)
diff --git
a/solr/core/src/java/org/apache/solr/handler/component/HighlightComponent.java
b/solr/core/src/java/org/apache/solr/handler/component/HighlightComponent.java
index 4f25884..ba42018 100644
---
a/solr/core/src/java/org/apache/solr/handler/component/HighlightComponent.java
+++
b/solr/core/src/java/org/apache/solr/handler/component/HighlightComponent.java
@@ -34,7 +34,6 @@ import org.apache.solr.common.util.SimpleOrderedMap;
import org.apache.solr.core.PluginInfo;
import org.apache.solr.core.SolrCore;
import org.apache.solr.highlight.DefaultSolrHighlighter;
-import org.apache.solr.highlight.PostingsSolrHighlighter;
import org.apache.solr.highlight.SolrHighlighter;
import org.apache.solr.highlight.UnifiedSolrHighlighter;
import org.apache.solr.request.SolrQueryRequest;
@@ -59,7 +58,6 @@ public class HighlightComponent extends SearchComponent
implements PluginInfoIni
public enum HighlightMethod {
UNIFIED("unified"),
FAST_VECTOR("fastVector"),
- POSTINGS("postings"),
ORIGINAL("original");
private static final Map<String, HighlightMethod> METHODS =
Collections.unmodifiableMap(Stream.of(values())
@@ -84,24 +82,9 @@ public class HighlightComponent extends SearchComponent
implements PluginInfoIni
private PluginInfo info = PluginInfo.EMPTY_INFO;
- @Deprecated // DWS: in 7.0 lets restructure the abstractions/relationships
+ // TODO lets restructure the abstractions/relationships
private SolrHighlighter solrConfigHighlighter;
- /**
- * @deprecated instead depend on {@link #process(ResponseBuilder)} to choose
the highlighter based on
- * {@link HighlightParams#METHOD}
- */
- @Deprecated
- public static SolrHighlighter getHighlighter(SolrCore core) {
- HighlightComponent hl = (HighlightComponent)
core.getSearchComponents().get(HighlightComponent.COMPONENT_NAME);
- return hl==null ? null: hl.getHighlighter();
- }
-
- @Deprecated
- public SolrHighlighter getHighlighter() {
- return solrConfigHighlighter;
- }
-
@Override
public void init(PluginInfo info) {
this.info = info;
@@ -182,7 +165,7 @@ public class HighlightComponent extends SearchComponent
implements PluginInfoIni
}
}
- protected SolrHighlighter getHighlighter(SolrParams params) {
+ public SolrHighlighter getHighlighter(SolrParams params) {
HighlightMethod method =
HighlightMethod.parse(params.get(HighlightParams.METHOD));
if (method == null) {
return solrConfigHighlighter;
@@ -194,11 +177,6 @@ public class HighlightComponent extends SearchComponent
implements PluginInfoIni
return solrConfigHighlighter;
}
return new UnifiedSolrHighlighter(); // TODO cache one?
- case POSTINGS:
- if (solrConfigHighlighter instanceof PostingsSolrHighlighter) {
- return solrConfigHighlighter;
- }
- return new PostingsSolrHighlighter(); // TODO cache one?
case FAST_VECTOR: // fall-through
case ORIGINAL:
if (solrConfigHighlighter instanceof DefaultSolrHighlighter) {
diff --git a/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java
b/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java
index 458321d..52d8605 100644
--- a/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java
+++ b/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java
@@ -243,9 +243,9 @@ public class SolrPluginUtils {
fieldFilter = new HashSet<>(fieldFilter);
// add highlight fields
- SolrHighlighter highlighter =
HighlightComponent.getHighlighter(req.getCore());
- for (String field: highlighter.getHighlightFields(query, req, null))
- fieldFilter.add(field);
+ HighlightComponent hl = (HighlightComponent)
req.getCore().getSearchComponents().get(HighlightComponent.COMPONENT_NAME);
+ SolrHighlighter highlighter = hl.getHighlighter(req.getParams());
+ Collections.addAll(fieldFilter, highlighter.getHighlightFields(query,
req, null));
// fetch unique key if one exists.
SchemaField keyField = searcher.getSchema().getUniqueKeyField();
diff --git
a/solr/core/src/test-files/solr/collection1/conf/solrconfig-postingshighlight.xml
b/solr/core/src/test-files/solr/collection1/conf/solrconfig-postingshighlight.xml
deleted file mode 100644
index a578563..0000000
---
a/solr/core/src/test-files/solr/collection1/conf/solrconfig-postingshighlight.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" ?>
-
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- a basic solrconfig for postings highlighter -->
-<config>
- <luceneMatchVersion>${tests.luceneMatchVersion:LATEST}</luceneMatchVersion>
- <dataDir>${solr.data.dir:}</dataDir>
- <xi:include href="solrconfig.snippet.randomindexconfig.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"/>
- <directoryFactory name="DirectoryFactory"
class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
- <schemaFactory class="ClassicIndexSchemaFactory"/>
- <requestHandler name="/select" class="solr.SearchHandler">
- <lst name="defaults">
- <bool name="hl.defaultSummary">false</bool>
- <str name="df">text</str>
- </lst>
- </requestHandler>
- <searchComponent class="solr.HighlightComponent" name="highlight">
- <highlighting class="org.apache.solr.highlight.PostingsSolrHighlighter"/>
- </searchComponent>
-</config>
diff --git
a/solr/core/src/test/org/apache/solr/highlight/FastVectorHighlighterTest.java
b/solr/core/src/test/org/apache/solr/highlight/FastVectorHighlighterTest.java
index 99868a7..5f9b916 100644
---
a/solr/core/src/test/org/apache/solr/highlight/FastVectorHighlighterTest.java
+++
b/solr/core/src/test/org/apache/solr/highlight/FastVectorHighlighterTest.java
@@ -18,7 +18,9 @@ package org.apache.solr.highlight;
import java.util.HashMap;
+import java.util.Map;
import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.common.params.MapSolrParams;
import org.apache.solr.handler.component.HighlightComponent;
import org.apache.solr.util.TestHarness;
import org.junit.BeforeClass;
@@ -30,10 +32,10 @@ public class FastVectorHighlighterTest extends
SolrTestCaseJ4 {
public static void beforeClass() throws Exception {
initCore("solrconfig.xml","schema.xml");
}
-
+
@Test
public void testConfig(){
- DefaultSolrHighlighter highlighter = (DefaultSolrHighlighter)
HighlightComponent.getHighlighter(h.getCore());
+ DefaultSolrHighlighter highlighter = getHighlighter();
// Make sure we loaded one fragListBuilder
SolrFragListBuilder solrFlbNull = highlighter.fragListBuilders.get( null );
@@ -89,4 +91,9 @@ public class FastVectorHighlighterTest extends SolrTestCaseJ4
{
"//lst[@name='1']/arr[@name='tv_text']/str[.='basic fast
<fvpre>vector</em> highlighter test']"
);
}
+
+ private static DefaultSolrHighlighter getHighlighter() {
+ var hl = (HighlightComponent)
h.getCore().getSearchComponents().get(HighlightComponent.COMPONENT_NAME);
+ return (DefaultSolrHighlighter) hl.getHighlighter(new
MapSolrParams(Map.of()));
+ }
}
diff --git
a/solr/core/src/test/org/apache/solr/highlight/HighlighterConfigTest.java
b/solr/core/src/test/org/apache/solr/highlight/HighlighterConfigTest.java
index eb1e2b9..047a67c 100644
--- a/solr/core/src/test/org/apache/solr/highlight/HighlighterConfigTest.java
+++ b/solr/core/src/test/org/apache/solr/highlight/HighlighterConfigTest.java
@@ -19,6 +19,8 @@ package org.apache.solr.highlight;
import java.lang.invoke.MethodHandles;
import java.util.HashMap;
+import java.util.Map;
+import org.apache.solr.common.params.MapSolrParams;
import org.apache.solr.handler.component.HighlightComponent;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.util.TestHarness;
@@ -49,9 +51,8 @@ public class HighlighterConfigTest extends SolrTestCaseJ4 {
super.tearDown();
}
- public void testConfig()
- {
- SolrHighlighter highlighter =
HighlightComponent.getHighlighter(h.getCore());
+ public void testConfig() {
+ SolrHighlighter highlighter = getHighlighter();
log.info( "highlighter" );
assertTrue( highlighter instanceof DummyHighlighter );
@@ -71,7 +72,12 @@ public class HighlighterConfigTest extends SolrTestCaseJ4 {
sumLRF.makeRequest("long"),
"//lst[@name='highlighting']/str[@name='dummy']"
);
- }
+ }
+
+ private static SolrHighlighter getHighlighter() {
+ var hl = (HighlightComponent)
h.getCore().getSearchComponents().get(HighlightComponent.COMPONENT_NAME);
+ return hl.getHighlighter(new MapSolrParams(Map.of()));
+ }
}
diff --git a/solr/core/src/test/org/apache/solr/highlight/HighlighterTest.java
b/solr/core/src/test/org/apache/solr/highlight/HighlighterTest.java
index 0513fd9..9ec2cf9 100644
--- a/solr/core/src/test/org/apache/solr/highlight/HighlighterTest.java
+++ b/solr/core/src/test/org/apache/solr/highlight/HighlighterTest.java
@@ -22,6 +22,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.apache.lucene.analysis.Analyzer;
@@ -34,6 +35,7 @@ import
org.apache.lucene.queries.payloads.SpanPayloadCheckQuery;
import org.apache.lucene.util.BytesRef;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.common.params.HighlightParams;
+import org.apache.solr.common.params.MapSolrParams;
import org.apache.solr.handler.component.HighlightComponent;
import org.apache.solr.handler.component.ResponseBuilder;
import org.apache.solr.handler.component.SearchComponent;
@@ -71,7 +73,7 @@ public class HighlighterTest extends SolrTestCaseJ4 {
@Test
public void testConfig()
{
- DefaultSolrHighlighter highlighter = (DefaultSolrHighlighter)
HighlightComponent.getHighlighter(h.getCore());
+ DefaultSolrHighlighter highlighter = (DefaultSolrHighlighter)
getHighlighter();
// Make sure we loaded the one formatter
SolrFormatter fmt1 = highlighter.formatters.get( null );
@@ -90,21 +92,6 @@ public class HighlighterTest extends SolrTestCaseJ4 {
}
@Test
- public void testMethodPostings() {
- String field = "t_text";
- assertU(adoc(field, LONG_TEXT,
- "id", "1"));
- assertU(commit());
-
- IllegalArgumentException e = expectThrows(IllegalArgumentException.class,
() -> {
- h.query(req("q", "long", "hl.method", "postings", "df", field, "hl",
"true"));
- });
- assertTrue("Should warn no offsets", e.getMessage().contains("indexed
without offsets"));
- // note: the default schema.xml has no offsets in postings to test the
PostingsHighlighter. Leave that for another
- // test class.
- }
-
- @Test
public void testMergeContiguous() throws Exception {
HashMap<String,String> args = new HashMap<>();
args.put(HighlightParams.HIGHLIGHT, "true");
@@ -880,7 +867,7 @@ public class HighlighterTest extends SolrTestCaseJ4 {
10, args);
SolrQueryRequest request = lrf.makeRequest("test");
- SolrHighlighter highlighter =
HighlightComponent.getHighlighter(h.getCore());
+ SolrHighlighter highlighter = getHighlighter();
List<String> highlightFieldNames = Arrays.asList(highlighter
.getHighlightFields(null, request, new String[] {}));
assertTrue("Expected to highlight on field \"title\"", highlightFieldNames
@@ -894,7 +881,7 @@ public class HighlighterTest extends SolrTestCaseJ4 {
args.put("hl.fl", "foo_*");
lrf = h.getRequestFactory("", 0, 10, args);
request = lrf.makeRequest("test");
- highlighter = HighlightComponent.getHighlighter(h.getCore());
+ highlighter = getHighlighter();
highlightFieldNames = Arrays.asList(highlighter.getHighlightFields(null,
request, new String[] {}));
assertEquals("Expected one field to highlight on", 1, highlightFieldNames
@@ -911,7 +898,7 @@ public class HighlighterTest extends SolrTestCaseJ4 {
highlightedSetExpected.add("foo_s");
highlightedSetExpected.add("bar_s");
try (LocalSolrQueryRequest localRequest = lrf.makeRequest("test")) {
- highlighter = HighlightComponent.getHighlighter(h.getCore());
+ highlighter = getHighlighter();
final Set<String> highlightedSetActual = new HashSet<String>(
Arrays.asList(highlighter.getHighlightFields(null,
localRequest, new String[] {})));
@@ -922,7 +909,7 @@ public class HighlighterTest extends SolrTestCaseJ4 {
args.put("hl.fl", "title, text"); // comma then space
lrf = h.getRequestFactory("", 0, 10, args);
request = lrf.makeRequest("test");
- highlighter = HighlightComponent.getHighlighter(h.getCore());
+ highlighter = getHighlighter();
highlightFieldNames = Arrays.asList(highlighter.getHighlightFields(null,
request, new String[] {}));
assertEquals("Expected one field to highlight on", 2, highlightFieldNames
@@ -1261,4 +1248,9 @@ public class HighlighterTest extends SolrTestCaseJ4 {
req.close();
}
}
+
+ private static SolrHighlighter getHighlighter() {
+ var hl = (HighlightComponent)
h.getCore().getSearchComponents().get(HighlightComponent.COMPONENT_NAME);
+ return hl.getHighlighter(new MapSolrParams(Map.of("hl.method",
"original")));
+ }
}
diff --git
a/solr/core/src/test/org/apache/solr/highlight/TestPostingsSolrHighlighter.java
b/solr/core/src/test/org/apache/solr/highlight/TestPostingsSolrHighlighter.java
deleted file mode 100644
index 0275267..0000000
---
a/solr/core/src/test/org/apache/solr/highlight/TestPostingsSolrHighlighter.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.solr.highlight;
-
-import org.apache.solr.SolrTestCaseJ4;
-import org.apache.solr.handler.component.HighlightComponent;
-import org.apache.solr.schema.IndexSchema;
-import org.junit.BeforeClass;
-
-/** simple tests for PostingsSolrHighlighter */
-public class TestPostingsSolrHighlighter extends SolrTestCaseJ4 {
-
- @BeforeClass
- public static void beforeClass() throws Exception {
- initCore("solrconfig-postingshighlight.xml",
"schema-postingshighlight.xml");
-
- // test our config is sane, just to be sure:
-
- // postingshighlighter should be used
- SolrHighlighter highlighter =
HighlightComponent.getHighlighter(h.getCore());
- assertTrue("wrong highlighter: " + highlighter.getClass(), highlighter
instanceof PostingsSolrHighlighter);
-
- // 'text' and 'text3' should have offsets, 'text2' should not
- IndexSchema schema = h.getCore().getLatestSchema();
- assertTrue(schema.getField("text").storeOffsetsWithPositions());
- assertTrue(schema.getField("text3").storeOffsetsWithPositions());
- assertFalse(schema.getField("text2").storeOffsetsWithPositions());
- }
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
- clearIndex();
- assertU(adoc("text", "document one", "text2", "document one", "text3",
"crappy document", "id", "101"));
- assertU(adoc("text", "second document", "text2", "second document",
"text3", "crappier document", "id", "102"));
- assertU(commit());
- }
-
- public void testSimple() {
- assertQ("simplest test",
- req("q", "text:document", "sort", "id asc", "hl", "true", "hl.method",
"postings"), // test hl.method is happy too
- "count(//lst[@name='highlighting']/*)=2",
-
"//lst[@name='highlighting']/lst[@name='101']/arr[@name='text']/str='<em>document</em>
one'",
-
"//lst[@name='highlighting']/lst[@name='102']/arr[@name='text']/str='second
<em>document</em>'");
- }
-
- public void testPagination() {
- assertQ("pagination test",
- req("q", "text:document", "sort", "id asc", "hl", "true", "rows", "1",
"start", "1"),
- "count(//lst[@name='highlighting']/*)=1",
-
"//lst[@name='highlighting']/lst[@name='102']/arr[@name='text']/str='second
<em>document</em>'");
- }
-
- public void testEmptySnippet() {
- assertQ("null snippet test",
- req("q", "text:one OR *:*", "sort", "id asc", "hl", "true"),
- "count(//lst[@name='highlighting']/*)=2",
-
"//lst[@name='highlighting']/lst[@name='101']/arr[@name='text']/str='document
<em>one</em>'",
-
"count(//lst[@name='highlighting']/lst[@name='102']/arr[@name='text']/*)=0");
- }
-
- public void testDefaultSummary() {
- assertQ("null snippet test",
- req("q", "text:one OR *:*", "sort", "id asc", "hl", "true",
"hl.defaultSummary", "true"),
- "count(//lst[@name='highlighting']/*)=2",
-
"//lst[@name='highlighting']/lst[@name='101']/arr[@name='text']/str='document
<em>one</em>'",
-
"//lst[@name='highlighting']/lst[@name='102']/arr[@name='text']/str='second
document'");
- }
-
- public void testDifferentField() {
- assertQ("highlighting text3",
- req("q", "text3:document", "sort", "id asc", "hl", "true", "hl.fl",
"text3"),
- "count(//lst[@name='highlighting']/*)=2",
-
"//lst[@name='highlighting']/lst[@name='101']/arr[@name='text3']/str='crappy
<em>document</em>'",
-
"//lst[@name='highlighting']/lst[@name='102']/arr[@name='text3']/str='crappier
<em>document</em>'");
- }
-
- public void testTwoFields() {
- assertQ("highlighting text and text3",
- req("q", "text:document text3:document", "sort", "id asc", "hl",
"true", "hl.fl", "text,text3"),
- "count(//lst[@name='highlighting']/*)=2",
-
"//lst[@name='highlighting']/lst[@name='101']/arr[@name='text']/str='<em>document</em>
one'",
-
"//lst[@name='highlighting']/lst[@name='101']/arr[@name='text3']/str='crappy
<em>document</em>'",
-
"//lst[@name='highlighting']/lst[@name='102']/arr[@name='text']/str='second
<em>document</em>'",
-
"//lst[@name='highlighting']/lst[@name='102']/arr[@name='text3']/str='crappier
<em>document</em>'");
- }
-
- // SOLR-5127
- public void testMultipleFieldsViaWildcard() {
- assertQ("highlighting text and text3*",
- req("q", (random().nextBoolean() ? "text:document text3:document" :
"text3:document text:document"),
- "sort", "id asc", "hl", "true",
- "hl.fl", (random().nextBoolean() ? "text,text3*" : "text3*,text")),
- "count(//lst[@name='highlighting']/*)=2",
-
"//lst[@name='highlighting']/lst[@name='101']/arr[@name='text']/str='<em>document</em>
one'",
-
"//lst[@name='highlighting']/lst[@name='101']/arr[@name='text3']/str='crappy
<em>document</em>'",
-
"//lst[@name='highlighting']/lst[@name='102']/arr[@name='text']/str='second
<em>document</em>'",
-
"//lst[@name='highlighting']/lst[@name='102']/arr[@name='text3']/str='crappier
<em>document</em>'");
- }
-
- public void testMisconfiguredField() {
- ignoreException("was indexed without offsets");
- expectThrows(Exception.class, () ->
- h.query(req("q", "text2:document", "sort", "id asc", "hl", "true",
"hl.fl", "text2")));
- resetExceptionIgnores();
- }
-
- public void testTags() {
- assertQ("different pre/post tags",
- req("q", "text:document", "sort", "id asc", "hl", "true",
"hl.tag.pre", "[", "hl.tag.post", "]"),
- "count(//lst[@name='highlighting']/*)=2",
-
"//lst[@name='highlighting']/lst[@name='101']/arr[@name='text']/str='[document]
one'",
-
"//lst[@name='highlighting']/lst[@name='102']/arr[@name='text']/str='second
[document]'");
- }
-
- public void testTagsPerField() {
- assertQ("highlighting text and text3",
- req("q", "text:document text3:document", "sort", "id asc", "hl",
"true", "hl.fl", "text,text3", "f.text3.hl.tag.pre", "[",
"f.text3.hl.tag.post", "]"),
- "count(//lst[@name='highlighting']/*)=2",
-
"//lst[@name='highlighting']/lst[@name='101']/arr[@name='text']/str='<em>document</em>
one'",
-
"//lst[@name='highlighting']/lst[@name='101']/arr[@name='text3']/str='crappy
[document]'",
-
"//lst[@name='highlighting']/lst[@name='102']/arr[@name='text']/str='second
<em>document</em>'",
-
"//lst[@name='highlighting']/lst[@name='102']/arr[@name='text3']/str='crappier
[document]'");
- }
-
- public void testBreakIterator() {
- assertQ("different breakiterator",
- req("q", "text:document", "sort", "id asc", "hl", "true",
"hl.bs.type", "WORD"),
- "count(//lst[@name='highlighting']/*)=2",
-
"//lst[@name='highlighting']/lst[@name='101']/arr[@name='text']/str='<em>document</em>'",
-
"//lst[@name='highlighting']/lst[@name='102']/arr[@name='text']/str='<em>document</em>'");
- }
-
- public void testBreakIterator2() {
- assertU(adoc("text", "Document one has a first sentence. Document two has
a second sentence.", "id", "103"));
- assertU(commit());
- assertQ("different breakiterator",
- req("q", "text:document", "sort", "id asc", "hl", "true",
"hl.bs.type", "WHOLE"),
-
"//lst[@name='highlighting']/lst[@name='103']/arr[@name='text']/str='<em>Document</em>
one has a first sentence. <em>Document</em> two has a second sentence.'");
- }
-
- public void testBreakIterator3() {
- assertU(adoc("text", "This document contains # special characters, while
the other document contains the same # special character.", "id", "103"));
- assertU(adoc("text", "While the other document contains the same # special
character.", "id", "104"));
- assertU(commit());
- assertQ("different breakiterator",
- req("q", "text:document", "sort", "id asc", "hl", "true",
"hl.bs.type", "SEPARATOR","hl.bs.separator","#"),
-
"//lst[@name='highlighting']/lst[@name='103']/arr[@name='text']/str='This
<em>document</em> contains #'");
- assertQ("different breakiterator",
- req("q", "text:document", "sort", "id asc", "hl", "true",
"hl.bs.type", "SEPARATOR","hl.bs.separator","#"),
-
"//lst[@name='highlighting']/lst[@name='104']/arr[@name='text']/str='While the
other <em>document</em> contains the same #'");
-
- }
-
- public void testEncoder() {
- assertU(adoc("text", "Document one has a first <i>sentence</i>.", "id",
"103"));
- assertU(commit());
- assertQ("html escaped",
- req("q", "text:document", "sort", "id asc", "hl", "true",
"hl.encoder", "html"),
-
"//lst[@name='highlighting']/lst[@name='103']/arr[@name='text']/str='<em>Document</em>
one has a first <i>sentence</i>.'");
- }
-
- public void testWildcard() {
- assertQ("simplest test",
- req("q", "text:doc*ment", "sort", "id asc", "hl", "true",
"hl.highlightMultiTerm", "true"),
- "count(//lst[@name='highlighting']/*)=2",
-
"//lst[@name='highlighting']/lst[@name='101']/arr[@name='text']/str='<em>document</em>
one'",
-
"//lst[@name='highlighting']/lst[@name='102']/arr[@name='text']/str='second
<em>document</em>'");
- }
-}
diff --git
a/solr/modules/clustering/src/java/org/apache/solr/handler/clustering/ClusteringComponent.java
b/solr/modules/clustering/src/java/org/apache/solr/handler/clustering/ClusteringComponent.java
index e523402..ca058f4 100644
---
a/solr/modules/clustering/src/java/org/apache/solr/handler/clustering/ClusteringComponent.java
+++
b/solr/modules/clustering/src/java/org/apache/solr/handler/clustering/ClusteringComponent.java
@@ -23,6 +23,7 @@ import
org.apache.solr.client.solrj.response.ClusteringResponse;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.solr.common.params.HighlightParams;
+import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.ShardParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SimpleOrderedMap;
@@ -371,7 +372,9 @@ public class ClusteringComponent extends SearchComponent
implements SolrCoreAwar
SolrQueryRequest req = null;
SolrHighlighter highlighter = null;
if (preferQueryContext) {
- highlighter = ((HighlightComponent)
core.getSearchComponents().get(HighlightComponent.COMPONENT_NAME)).getHighlighter();
+ highlighter =
+ ((HighlightComponent)
core.getSearchComponents().get(HighlightComponent.COMPONENT_NAME))
+ .getHighlighter(new ModifiableSolrParams());
if (highlighter != null) {
Map<String, Object> args = new HashMap<>();
args.put(HighlightParams.FIELDS, fieldsToCluster);
diff --git a/solr/solr-ref-guide/src/major-changes-in-solr-9.adoc
b/solr/solr-ref-guide/src/major-changes-in-solr-9.adoc
index 2ef44c1..3bb2800 100644
--- a/solr/solr-ref-guide/src/major-changes-in-solr-9.adoc
+++ b/solr/solr-ref-guide/src/major-changes-in-solr-9.adoc
@@ -293,5 +293,7 @@ Example has been provided in `sample_techproducts_configs`
to override content-t
* `min_rf` deprecated in 7.x
+* hl.method=postings highlighter, deprecated in 7.0
+
* SOLR-15124: Removed three core level admin API endpoints because they are
already registered at the node level
where they really belong: /admin/threads, /admin/properties, /admin/logging