Apache Lucene open-source search software
SOLR-3542: add WeightedFragListBuilder
Koji Sekiguchidd01aad660d6
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 0e726eb27ca..4eb25e50ff0 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -363,6 +363,9 @@ New Featuresto schema.xml's <copyField/> declaration but as an update processor that canbe combined with other processors in any order. (Jan Høydahl & hossman)+* SOLR-3542: Add WeightedFragListBuilder for FVH and set it to default fragListBuilder+ in example solrconfig.xml. (Sebastian Lutze, koji)+Optimizations----------------------diff --git a/solr/core/src/java/org/apache/solr/highlight/WeightedFragListBuilder.java b/solr/core/src/java/org/apache/solr/highlight/WeightedFragListBuilder.javanew file mode 100644index 00000000000..a63092eb269--- /dev/null+++ b/solr/core/src/java/org/apache/solr/highlight/WeightedFragListBuilder.java@@ -0,0 +1,50 @@+/**+ * 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.FragListBuilder;+import org.apache.solr.common.params.SolrParams;++public class WeightedFragListBuilder extends HighlightingPluginBase implements+ SolrFragListBuilder {++ @Override+ public FragListBuilder getFragListBuilder(SolrParams params) {+ // NOTE: This class (currently) makes no use of params+ // If that ever changes, it should wrap them with defaults...+ // params = SolrParams.wrapDefaults(params, defaults)++ numRequests++;++ return new org.apache.lucene.search.vectorhighlight.WeightedFragListBuilder();+ }++ ///////////////////////////////////////////////////////////////////////+ //////////////////////// SolrInfoMBeans methods ///////////////////////+ ///////////////////////////////////////////////////////////////////////++ @Override+ public String getDescription() {+ return "WeightedFragListBuilder";+ }++ @Override+ public String getSource() {+ return "$URL: http://svn.apache.org/repos/asf/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/highlight/WeightedFragListBuilder.java $";+ }+}diff --git a/solr/example/solr/conf/solrconfig.xml b/solr/example/solr/conf/solrconfig.xmlindex c69d25c0757..5e586157cc7 100755--- a/solr/example/solr/conf/solrconfig.xml+++ b/solr/example/solr/conf/solrconfig.xml@@ -1486,13 +1486,17 @@<!-- Configure the standard fragListBuilder --><fragListBuilder name="simple"- default="true"class="solr.highlight.SimpleFragListBuilder"/>-+<!-- Configure the single fragListBuilder --><fragListBuilder name="single"class="solr.highlight.SingleFragListBuilder"/>-++ <!-- Configure the weighted fragListBuilder -->+ <fragListBuilder name="weighted"+ default="true"+ class="solr.highlight.WeightedFragListBuilder"/>+<!-- default tag FragmentsBuilder --><fragmentsBuilder name="default"default="true"