From f1efdf555389f9c520fbdb5b78a6ff0b4c004611 Mon Sep 17 00:00:00 2001 From: Koji Sekiguchi Date: Wed, 14 Sep 2011 13:38:49 +0000 Subject: [PATCH] SOLR-2749: add boundary scanner feature git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1170616 13f79535-47bb-0310-9956-ffa450edef68 --- .../ScoreOrderFragmentsBuilder.java | 8 ++ .../SimpleFragmentsBuilder.java | 8 ++ solr/CHANGES.txt | 6 ++ .../BreakIteratorBoundaryScanner.java | 91 +++++++++++++++++++ .../highlight/DefaultSolrHighlighter.java | 26 +++++- .../highlight/ScoreOrderFragmentsBuilder.java | 5 +- .../solr/highlight/SimpleBoundaryScanner.java | 62 +++++++++++++ .../highlight/SimpleFragmentsBuilder.java | 5 +- .../solr/highlight/SolrBoundaryScanner.java | 38 ++++++++ .../solr/highlight/SolrFragmentsBuilder.java | 8 +- .../solr/highlight/SolrHighlighter.java | 4 + .../src/test-files/solr/conf/solrconfig.xml | 16 +++- .../highlight/FastVectorHighlighterTest.java | 16 +++- solr/example/solr/conf/solrconfig.xml | 21 +++++ .../solr/common/params/HighlightParams.java | 6 ++ 15 files changed, 307 insertions(+), 13 deletions(-) create mode 100644 solr/core/src/java/org/apache/solr/highlight/BreakIteratorBoundaryScanner.java create mode 100644 solr/core/src/java/org/apache/solr/highlight/SimpleBoundaryScanner.java create mode 100644 solr/core/src/java/org/apache/solr/highlight/SolrBoundaryScanner.java diff --git a/lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/ScoreOrderFragmentsBuilder.java b/lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/ScoreOrderFragmentsBuilder.java index aac72e37bb1..a2e6e29f879 100644 --- a/lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/ScoreOrderFragmentsBuilder.java +++ b/lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/ScoreOrderFragmentsBuilder.java @@ -45,6 +45,14 @@ public class ScoreOrderFragmentsBuilder extends BaseFragmentsBuilder { super( preTags, postTags ); } + public ScoreOrderFragmentsBuilder( BoundaryScanner bs ){ + super( bs ); + } + + public ScoreOrderFragmentsBuilder( String[] preTags, String[] postTags, BoundaryScanner bs ){ + super( preTags, postTags, bs ); + } + /** * Sort by score the list of WeightedFragInfo */ diff --git a/lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/SimpleFragmentsBuilder.java b/lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/SimpleFragmentsBuilder.java index 378d692efd2..2822cf36d81 100644 --- a/lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/SimpleFragmentsBuilder.java +++ b/lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/SimpleFragmentsBuilder.java @@ -44,6 +44,14 @@ public class SimpleFragmentsBuilder extends BaseFragmentsBuilder { super( preTags, postTags ); } + public SimpleFragmentsBuilder( BoundaryScanner bs ) { + super( bs ); + } + + public SimpleFragmentsBuilder( String[] preTags, String[] postTags, BoundaryScanner bs ) { + super( preTags, postTags, bs ); + } + /** * do nothing. return the source list. */ diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index fdf0a41d4fd..b7533efbf60 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -327,6 +327,12 @@ Documentation ================== 3.5.0 ================== +New Features +---------------------- +* SOLR-2749: Add boundary scanners for FastVectorHighlighter. + can be specified with a name in solrconfig.xml, and use hl.boundaryScanner=name + parameter to specify the named . (koji) + Bug Fixes ---------------------- * SOLR-2748: The CommitTracker used for commitWith or autoCommit by maxTime diff --git a/solr/core/src/java/org/apache/solr/highlight/BreakIteratorBoundaryScanner.java b/solr/core/src/java/org/apache/solr/highlight/BreakIteratorBoundaryScanner.java new file mode 100644 index 00000000000..b28be0c4a2d --- /dev/null +++ b/solr/core/src/java/org/apache/solr/highlight/BreakIteratorBoundaryScanner.java @@ -0,0 +1,91 @@ +/** + * 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 java.text.BreakIterator; +import java.util.Locale; + +import org.apache.lucene.search.vectorhighlight.BoundaryScanner; +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.SolrParams; + +public class BreakIteratorBoundaryScanner extends SolrBoundaryScanner { + + @Override + protected BoundaryScanner get(String fieldName, SolrParams params) { + // construct Locale + String language = params.getFieldParam(fieldName, HighlightParams.BS_LANGUAGE); + String country = params.getFieldParam(fieldName, HighlightParams.BS_COUNTRY); + if(country != null && language == null){ + throw new SolrException(ErrorCode.BAD_REQUEST, + HighlightParams.BS_LANGUAGE + " parameter cannot be null when you specify " + HighlightParams.BS_COUNTRY); + } + Locale locale = null; + if(language != null){ + locale = country == null ? new Locale(language) : new Locale(language, country); + } + + // construct BreakIterator + String type = params.getFieldParam(fieldName, HighlightParams.BS_TYPE, "WORD").toLowerCase(); + BreakIterator bi = null; + if(type.equals("character")){ + bi = locale == null ? BreakIterator.getCharacterInstance() : BreakIterator.getCharacterInstance(locale); + } + else if(type.equals("word")){ + bi = locale == null ? BreakIterator.getWordInstance() : BreakIterator.getWordInstance(locale); + } + else if(type.equals("line")){ + bi = locale == null ? BreakIterator.getLineInstance() : BreakIterator.getLineInstance(locale); + } + else if(type.equals("sentence")){ + bi = locale == null ? BreakIterator.getSentenceInstance() : BreakIterator.getSentenceInstance(locale); + } + else + throw new SolrException(ErrorCode.BAD_REQUEST, type + " is invalid for parameter " + HighlightParams.BS_TYPE); + + return new org.apache.lucene.search.vectorhighlight.BreakIteratorBoundaryScanner(bi); + } + + + /////////////////////////////////////////////////////////////////////// + //////////////////////// SolrInfoMBeans methods /////////////////////// + /////////////////////////////////////////////////////////////////////// + + @Override + public String getDescription() { + return "BreakIteratorBoundaryScanner"; + } + + @Override + public String getSource() { + return "$URL$"; + } + + @Override + public String getSourceId() { + return "$Id$"; + } + + @Override + public String getVersion() { + return "$Revision$"; + } + +} diff --git a/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java b/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java index eef991e9ce2..2a826989da7 100644 --- a/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java +++ b/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java @@ -36,6 +36,7 @@ import org.apache.lucene.document.Document; import org.apache.lucene.index.IndexableField; import org.apache.lucene.search.Query; import org.apache.lucene.search.highlight.*; +import org.apache.lucene.search.vectorhighlight.BoundaryScanner; import org.apache.lucene.search.vectorhighlight.FastVectorHighlighter; import org.apache.lucene.search.vectorhighlight.FieldQuery; import org.apache.lucene.search.vectorhighlight.FragListBuilder; @@ -83,6 +84,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf fragmenters.clear(); fragListBuilders.clear(); fragmentsBuilders.clear(); + boundaryScanners.clear(); // Load the fragmenters SolrFragmenter frag = solrCore.initPlugins(info.getChildren("fragmenter") , fragmenters,SolrFragmenter.class,null); @@ -115,9 +117,15 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf if( fragsBuilder == null ) fragsBuilder = new ScoreOrderFragmentsBuilder(); fragmentsBuilders.put( "", fragsBuilder ); fragmentsBuilders.put( null, fragsBuilder ); + + // Load the BoundaryScanners + SolrBoundaryScanner boundaryScanner = solrCore.initPlugins(info.getChildren("boundaryScanner"), + boundaryScanners, SolrBoundaryScanner.class, null); + if(boundaryScanner == null) boundaryScanner = new SimpleBoundaryScanner(); + boundaryScanners.put("", boundaryScanner); + boundaryScanners.put(null, boundaryScanner); initialized = true; - } //just for back-compat with the deprecated method private boolean initialized = false; @@ -144,6 +152,10 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf SolrFragmentsBuilder fragsBuilder = new ScoreOrderFragmentsBuilder(); fragmentsBuilders.put( "", fragsBuilder ); fragmentsBuilders.put( null, fragsBuilder ); + + SolrBoundaryScanner boundaryScanner = new SimpleBoundaryScanner(); + boundaryScanners.put("", boundaryScanner); + boundaryScanners.put(null, boundaryScanner); } /** @@ -311,7 +323,8 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf } protected FragmentsBuilder getFragmentsBuilder( String fieldName, SolrParams params ){ - return getSolrFragmentsBuilder( fieldName, params ).getFragmentsBuilder( params ); + BoundaryScanner bs = getBoundaryScanner(fieldName, params); + return getSolrFragmentsBuilder( fieldName, params ).getFragmentsBuilder( params, bs ); } private SolrFragmentsBuilder getSolrFragmentsBuilder( String fieldName, SolrParams params ){ @@ -323,6 +336,15 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf return solrFb; } + private BoundaryScanner getBoundaryScanner(String fieldName, SolrParams params){ + String bs = params.getFieldParam(fieldName, HighlightParams.BOUNDARY_SCANNER); + SolrBoundaryScanner solrBs = boundaryScanners.get(bs); + if(solrBs == null){ + throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unknown boundaryScanner: " + bs); + } + return solrBs.getBoundaryScanner(fieldName, params); + } + /** * Generates a list of Highlighted query fragments for each item in a list * of documents, or returns null if highlighting is disabled. diff --git a/solr/core/src/java/org/apache/solr/highlight/ScoreOrderFragmentsBuilder.java b/solr/core/src/java/org/apache/solr/highlight/ScoreOrderFragmentsBuilder.java index ee9080e59d7..6f177bc809c 100644 --- a/solr/core/src/java/org/apache/solr/highlight/ScoreOrderFragmentsBuilder.java +++ b/solr/core/src/java/org/apache/solr/highlight/ScoreOrderFragmentsBuilder.java @@ -17,6 +17,7 @@ package org.apache.solr.highlight; +import org.apache.lucene.search.vectorhighlight.BoundaryScanner; import org.apache.lucene.search.vectorhighlight.FragmentsBuilder; import org.apache.solr.common.params.SolrParams; @@ -24,9 +25,9 @@ public class ScoreOrderFragmentsBuilder extends SolrFragmentsBuilder { @Override protected FragmentsBuilder getFragmentsBuilder( SolrParams params, - String[] preTags, String[] postTags ) { + String[] preTags, String[] postTags, BoundaryScanner bs ) { org.apache.lucene.search.vectorhighlight.ScoreOrderFragmentsBuilder sofb = - new org.apache.lucene.search.vectorhighlight.ScoreOrderFragmentsBuilder( preTags, postTags ); + new org.apache.lucene.search.vectorhighlight.ScoreOrderFragmentsBuilder( preTags, postTags, bs ); sofb.setMultiValuedSeparator( getMultiValuedSeparatorChar( params ) ); return sofb; } diff --git a/solr/core/src/java/org/apache/solr/highlight/SimpleBoundaryScanner.java b/solr/core/src/java/org/apache/solr/highlight/SimpleBoundaryScanner.java new file mode 100644 index 00000000000..c1171622f9b --- /dev/null +++ b/solr/core/src/java/org/apache/solr/highlight/SimpleBoundaryScanner.java @@ -0,0 +1,62 @@ +/** + * 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.lucene.search.vectorhighlight.BoundaryScanner; +import org.apache.solr.common.params.HighlightParams; +import org.apache.solr.common.params.SolrParams; + +public class SimpleBoundaryScanner extends SolrBoundaryScanner { + + @Override + protected BoundaryScanner get(String fieldName, SolrParams params) { + int maxScan = params.getFieldInt(fieldName, HighlightParams.BS_MAX_SCAN, 10); + String str = params.getFieldParam(fieldName, HighlightParams.BS_CHARS, ".,!? \t\n"); + Character[] chars = new Character[str.length()]; + for(int i = 0; i < str.length(); i++){ + chars[i] = str.charAt(i); + } + return new org.apache.lucene.search.vectorhighlight.SimpleBoundaryScanner(maxScan, chars); + } + + + /////////////////////////////////////////////////////////////////////// + //////////////////////// SolrInfoMBeans methods /////////////////////// + /////////////////////////////////////////////////////////////////////// + + @Override + public String getDescription() { + return "SimpleBoundaryScanner"; + } + + @Override + public String getSource() { + return "$URL$"; + } + + @Override + public String getSourceId() { + return "$Id$"; + } + + @Override + public String getVersion() { + return "$Revision$"; + } + +} diff --git a/solr/core/src/java/org/apache/solr/highlight/SimpleFragmentsBuilder.java b/solr/core/src/java/org/apache/solr/highlight/SimpleFragmentsBuilder.java index 4849089ed27..748e187a661 100644 --- a/solr/core/src/java/org/apache/solr/highlight/SimpleFragmentsBuilder.java +++ b/solr/core/src/java/org/apache/solr/highlight/SimpleFragmentsBuilder.java @@ -17,6 +17,7 @@ package org.apache.solr.highlight; +import org.apache.lucene.search.vectorhighlight.BoundaryScanner; import org.apache.lucene.search.vectorhighlight.FragmentsBuilder; import org.apache.solr.common.params.SolrParams; @@ -24,9 +25,9 @@ public class SimpleFragmentsBuilder extends SolrFragmentsBuilder { @Override protected FragmentsBuilder getFragmentsBuilder( SolrParams params, - String[] preTags, String[] postTags ) { + String[] preTags, String[] postTags, BoundaryScanner bs ) { org.apache.lucene.search.vectorhighlight.SimpleFragmentsBuilder sfb = - new org.apache.lucene.search.vectorhighlight.SimpleFragmentsBuilder( preTags, postTags ); + new org.apache.lucene.search.vectorhighlight.SimpleFragmentsBuilder( preTags, postTags, bs ); sfb.setMultiValuedSeparator( getMultiValuedSeparatorChar( params ) ); return sfb; } diff --git a/solr/core/src/java/org/apache/solr/highlight/SolrBoundaryScanner.java b/solr/core/src/java/org/apache/solr/highlight/SolrBoundaryScanner.java new file mode 100644 index 00000000000..f7ccd165447 --- /dev/null +++ b/solr/core/src/java/org/apache/solr/highlight/SolrBoundaryScanner.java @@ -0,0 +1,38 @@ +/** + * 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.lucene.search.vectorhighlight.BoundaryScanner; +import org.apache.solr.common.params.DefaultSolrParams; +import org.apache.solr.common.params.SolrParams; +import org.apache.solr.core.SolrInfoMBean; +import org.apache.solr.util.plugin.NamedListInitializedPlugin; + +public abstract class SolrBoundaryScanner extends HighlightingPluginBase implements + SolrInfoMBean, NamedListInitializedPlugin { + + public BoundaryScanner getBoundaryScanner(String fieldName, SolrParams params){ + numRequests++; + if( defaults != null ) { + params = new DefaultSolrParams( params, defaults ); + } + return get(fieldName, params); + } + + protected abstract BoundaryScanner get(String fieldName, SolrParams params); +} diff --git a/solr/core/src/java/org/apache/solr/highlight/SolrFragmentsBuilder.java b/solr/core/src/java/org/apache/solr/highlight/SolrFragmentsBuilder.java index e5d00c649a8..2e63067329d 100644 --- a/solr/core/src/java/org/apache/solr/highlight/SolrFragmentsBuilder.java +++ b/solr/core/src/java/org/apache/solr/highlight/SolrFragmentsBuilder.java @@ -17,6 +17,7 @@ package org.apache.solr.highlight; +import org.apache.lucene.search.vectorhighlight.BoundaryScanner; import org.apache.lucene.search.vectorhighlight.FragmentsBuilder; import org.apache.solr.common.SolrException; import org.apache.solr.common.params.DefaultSolrParams; @@ -37,12 +38,12 @@ public abstract class SolrFragmentsBuilder extends HighlightingPluginBase * @param params The params controlling Highlighting * @return An appropriate {@link org.apache.lucene.search.vectorhighlight.FragmentsBuilder}. */ - public FragmentsBuilder getFragmentsBuilder(SolrParams params) { + public FragmentsBuilder getFragmentsBuilder(SolrParams params, BoundaryScanner bs) { numRequests++; if( defaults != null ) { params = new DefaultSolrParams( params, defaults ); } - return getFragmentsBuilder( params, getPreTags( params, null ), getPostTags( params, null ) ); + return getFragmentsBuilder( params, getPreTags( params, null ), getPostTags( params, null ), bs ); } public String[] getPreTags( SolrParams params, String fieldName ){ @@ -69,7 +70,8 @@ public abstract class SolrFragmentsBuilder extends HighlightingPluginBase return tags; } - protected abstract FragmentsBuilder getFragmentsBuilder( SolrParams params, String[] preTags, String[] postTags ); + protected abstract FragmentsBuilder getFragmentsBuilder( SolrParams params, + String[] preTags, String[] postTags, BoundaryScanner bs ); protected char getMultiValuedSeparatorChar( SolrParams params ){ String separator = params.get( HighlightParams.MULTI_VALUED_SEPARATOR, " " ); diff --git a/solr/core/src/java/org/apache/solr/highlight/SolrHighlighter.java b/solr/core/src/java/org/apache/solr/highlight/SolrHighlighter.java index 05be4e69868..6f47f889d2e 100644 --- a/solr/core/src/java/org/apache/solr/highlight/SolrHighlighter.java +++ b/solr/core/src/java/org/apache/solr/highlight/SolrHighlighter.java @@ -58,6 +58,10 @@ public abstract class SolrHighlighter protected final Map fragmentsBuilders = new HashMap() ; + // Thread safe registry + protected final Map boundaryScanners = + new HashMap() ; + @Deprecated public abstract void initalize( SolrConfig config ); diff --git a/solr/core/src/test-files/solr/conf/solrconfig.xml b/solr/core/src/test-files/solr/conf/solrconfig.xml index 1c85ed80c73..e7f764dce26 100644 --- a/solr/core/src/test-files/solr/conf/solrconfig.xml +++ b/solr/core/src/test-files/solr/conf/solrconfig.xml @@ -451,8 +451,22 @@ + - + + + 10 + .,!? + + + + + + WORD + en + US + + 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 4e1451fbd0c..c5cc1a385d5 100644 --- a/solr/core/src/test/org/apache/solr/highlight/FastVectorHighlighterTest.java +++ b/solr/core/src/test/org/apache/solr/highlight/FastVectorHighlighterTest.java @@ -36,7 +36,7 @@ public class FastVectorHighlighterTest extends SolrTestCaseJ4 { public void testConfig(){ SolrHighlighter highlighter = HighlightComponent.getHighlighter(h.getCore()); - // Make sure we loaded the one fragListBuilder + // Make sure we loaded one fragListBuilder SolrFragListBuilder solrFlbNull = highlighter.fragListBuilders.get( null ); SolrFragListBuilder solrFlbEmpty = highlighter.fragListBuilders.get( "" ); SolrFragListBuilder solrFlbSimple = highlighter.fragListBuilders.get( "simple" ); @@ -44,15 +44,25 @@ public class FastVectorHighlighterTest extends SolrTestCaseJ4 { assertTrue( solrFlbNull instanceof SimpleFragListBuilder ); assertTrue( solrFlbSimple instanceof SimpleFragListBuilder ); - // Make sure we loaded the one fragmentsBuilder + // Make sure we loaded two fragmentsBuilders SolrFragmentsBuilder solrFbNull = highlighter.fragmentsBuilders.get( null ); SolrFragmentsBuilder solrFbEmpty = highlighter.fragmentsBuilders.get( "" ); SolrFragmentsBuilder solrFbSimple = highlighter.fragmentsBuilders.get( "simple" ); SolrFragmentsBuilder solrFbSO = highlighter.fragmentsBuilders.get( "scoreOrder" ); assertSame( solrFbNull, solrFbEmpty ); - assertTrue( solrFbNull instanceof ScoreOrderFragmentsBuilder ); + assertTrue( solrFbNull instanceof SimpleFragmentsBuilder ); assertTrue( solrFbSimple instanceof SimpleFragmentsBuilder ); assertTrue( solrFbSO instanceof ScoreOrderFragmentsBuilder ); + + // Make sure we loaded two boundaryScanners + SolrBoundaryScanner solrBsNull = highlighter.boundaryScanners.get(null); + SolrBoundaryScanner solrBsEmpty = highlighter.boundaryScanners.get(""); + SolrBoundaryScanner solrBsSimple = highlighter.boundaryScanners.get("simple"); + SolrBoundaryScanner solrBsBI = highlighter.boundaryScanners.get("breakIterator"); + assertSame(solrBsNull, solrBsEmpty); + assertTrue(solrBsNull instanceof SimpleBoundaryScanner); + assertTrue(solrBsSimple instanceof SimpleBoundaryScanner); + assertTrue(solrBsBI instanceof BreakIteratorBoundaryScanner); } @Test diff --git a/solr/example/solr/conf/solrconfig.xml b/solr/example/solr/conf/solrconfig.xml index b08929c777b..7c5823ae9dd 100755 --- a/solr/example/solr/conf/solrconfig.xml +++ b/solr/example/solr/conf/solrconfig.xml @@ -1472,6 +1472,27 @@ ]]> + + + + 10 + .,!? + + + + + + + WORD + + + en + US + + diff --git a/solr/solrj/src/java/org/apache/solr/common/params/HighlightParams.java b/solr/solrj/src/java/org/apache/solr/common/params/HighlightParams.java index 8d68e2c3efe..90b7c04a3e1 100644 --- a/solr/solrj/src/java/org/apache/solr/common/params/HighlightParams.java +++ b/solr/solrj/src/java/org/apache/solr/common/params/HighlightParams.java @@ -33,6 +33,12 @@ public interface HighlightParams { public static final String FRAGMENTER = HIGHLIGHT+".fragmenter"; public static final String FRAG_LIST_BUILDER = HIGHLIGHT+".fragListBuilder"; public static final String FRAGMENTS_BUILDER = HIGHLIGHT+".fragmentsBuilder"; + public static final String BOUNDARY_SCANNER = HIGHLIGHT+".boundaryScanner"; + public static final String BS_MAX_SCAN = HIGHLIGHT+".bs.maxScan"; + public static final String BS_CHARS = HIGHLIGHT+".bs.chars"; + public static final String BS_TYPE = HIGHLIGHT+".bs.type"; + public static final String BS_LANGUAGE = HIGHLIGHT+".bs.language"; + public static final String BS_COUNTRY = HIGHLIGHT+".bs.country"; public static final String FIELD_MATCH = HIGHLIGHT+".requireFieldMatch"; public static final String ALTERNATE_FIELD = HIGHLIGHT+".alternateField"; public static final String ALTERNATE_FIELD_LENGTH = HIGHLIGHT+".maxAlternateFieldLength";