You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by cp...@apache.org on 2018/07/31 18:50:44 UTC
[1/3] lucene-solr:branch_7x: SOLR-12402: Factor out
SolrDefaultStreamFactory class.
Repository: lucene-solr
Updated Branches:
refs/heads/branch_7x 1662f6877 -> 4a86e00b7
SOLR-12402: Factor out SolrDefaultStreamFactory class.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/ebb23f00
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/ebb23f00
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/ebb23f00
Branch: refs/heads/branch_7x
Commit: ebb23f0077b9451eecdab395e94eea6fce42faff
Parents: 1662f68
Author: Christine Poerschke <cp...@apache.org>
Authored: Tue Jul 31 18:47:53 2018 +0100
Committer: Christine Poerschke <cp...@apache.org>
Committed: Tue Jul 31 19:31:36 2018 +0100
----------------------------------------------------------------------
solr/CHANGES.txt | 2 +
.../solr/handler/SolrDefaultStreamFactory.java | 53 ++++++++++++++++++++
.../org/apache/solr/handler/StreamHandler.java | 11 +---
3 files changed, 57 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ebb23f00/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 35e2fe1..4d0c226 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -101,6 +101,8 @@ New Features
future cluster operations whether they are invoked manually via the Collection API or by the Autoscaling framework.
(noble, shalin)
+* SOLR-12402: Factor out SolrDefaultStreamFactory class. (Christine Poerschke)
+
Bug Fixes
----------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ebb23f00/solr/core/src/java/org/apache/solr/handler/SolrDefaultStreamFactory.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/SolrDefaultStreamFactory.java b/solr/core/src/java/org/apache/solr/handler/SolrDefaultStreamFactory.java
new file mode 100644
index 0000000..0b375f4
--- /dev/null
+++ b/solr/core/src/java/org/apache/solr/handler/SolrDefaultStreamFactory.java
@@ -0,0 +1,53 @@
+/*
+ * 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.handler;
+
+import org.apache.solr.client.solrj.io.Lang;
+import org.apache.solr.client.solrj.io.stream.expr.DefaultStreamFactory;
+import org.apache.solr.core.SolrResourceLoader;
+
+/**
+ * A default collection of mappings, used to convert strings into stream expressions.
+ * Same as {@link DefaultStreamFactory} plus functions that rely directly on either
+ * Lucene or Solr capabilities that are not part of {@link Lang}.
+ *
+ * @since 7.5
+ */
+public class SolrDefaultStreamFactory extends DefaultStreamFactory {
+
+ private SolrResourceLoader solrResourceLoader;
+
+ public SolrDefaultStreamFactory() {
+ super();
+ this.withFunctionName("analyze", AnalyzeEvaluator.class);
+ this.withFunctionName("classify", ClassifyStream.class);
+ }
+
+ public SolrDefaultStreamFactory withSolrResourceLoader(SolrResourceLoader solrResourceLoader) {
+ this.solrResourceLoader = solrResourceLoader;
+ return this;
+ }
+
+ public void setSolrResourceLoader(SolrResourceLoader solrResourceLoader) {
+ this.solrResourceLoader = solrResourceLoader;
+ }
+
+ public SolrResourceLoader getSolrResourceLoader() {
+ return solrResourceLoader;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ebb23f00/solr/core/src/java/org/apache/solr/handler/StreamHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/StreamHandler.java b/solr/core/src/java/org/apache/solr/handler/StreamHandler.java
index 4e43e1c..e6ebc51 100644
--- a/solr/core/src/java/org/apache/solr/handler/StreamHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/StreamHandler.java
@@ -31,7 +31,6 @@ import org.apache.solr.client.solrj.io.SolrClientCache;
import org.apache.solr.client.solrj.io.Tuple;
import org.apache.solr.client.solrj.io.comp.StreamComparator;
import org.apache.solr.client.solrj.io.stream.*;
-import org.apache.solr.client.solrj.io.stream.expr.DefaultStreamFactory;
import org.apache.solr.client.solrj.io.stream.expr.Explanation;
import org.apache.solr.client.solrj.io.stream.expr.Explanation.ExpressionType;
import org.apache.solr.client.solrj.io.stream.expr.Expressible;
@@ -65,7 +64,7 @@ public class StreamHandler extends RequestHandlerBase implements SolrCoreAware,
static SolrClientCache clientCache = new SolrClientCache();
static ModelCache modelCache = null;
- private StreamFactory streamFactory = new DefaultStreamFactory();
+ private SolrDefaultStreamFactory streamFactory = new SolrDefaultStreamFactory();
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private String coreName;
private Map<String,DaemonStream> daemons = Collections.synchronizedMap(new HashMap());
@@ -105,13 +104,7 @@ public class StreamHandler extends RequestHandlerBase implements SolrCoreAware,
defaultZkhost,
clientCache);
}
-
- /*
- * Add the core functions. These are functions that rely directly on either Lucene or Solr
- * capabilities that are not part of Lang.
- */
- streamFactory.withFunctionName("analyze", AnalyzeEvaluator.class);
- streamFactory.withFunctionName("classify", ClassifyStream.class);
+ streamFactory.withSolrResourceLoader(core.getResourceLoader());
// This pulls all the overrides and additions from the config
List<PluginInfo> pluginInfos = core.getSolrConfig().getPluginInfos(Expressible.class.getName());
[2/3] lucene-solr:branch_7x: SOLR-12609: include actual value in two
MathExpressionTest.testMultiVariateNormalDistribution asserts
Posted by cp...@apache.org.
SOLR-12609: include actual value in two MathExpressionTest.testMultiVariateNormalDistribution asserts
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/d19ac7ce
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/d19ac7ce
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/d19ac7ce
Branch: refs/heads/branch_7x
Commit: d19ac7cebd2c714715bf2d777c0f2d715745a9e1
Parents: ebb23f0
Author: Christine Poerschke <cp...@apache.org>
Authored: Tue Jul 31 18:49:38 2018 +0100
Committer: Christine Poerschke <cp...@apache.org>
Committed: Tue Jul 31 19:31:46 2018 +0100
----------------------------------------------------------------------
.../apache/solr/client/solrj/io/stream/MathExpressionTest.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d19ac7ce/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/MathExpressionTest.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/MathExpressionTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/MathExpressionTest.java
index fe782b2..3806b22 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/MathExpressionTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/MathExpressionTest.java
@@ -3006,8 +3006,8 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertEquals(sample.size(), 2);
Number sample1 = sample.get(0);
Number sample2 = sample.get(1);
- assertTrue(sample1.doubleValue() > -30 && sample1.doubleValue() < 30);
- assertTrue(sample2.doubleValue() > 50 && sample2.doubleValue() < 250);
+ assertTrue(sample.toString(), sample1.doubleValue() > -30 && sample1.doubleValue() < 30);
+ assertTrue(sample.toString(), sample2.doubleValue() > 50 && sample2.doubleValue() < 250);
Number density = (Number)tuples.get(0).get("j");
assertEquals(density.doubleValue(), 0.007852638121596995, .00001);
[3/3] lucene-solr:branch_7x: Fix 'redundant cast to long' warning in
TestTieredMergePolicy.
Posted by cp...@apache.org.
Fix 'redundant cast to long' warning in TestTieredMergePolicy.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/4a86e00b
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/4a86e00b
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/4a86e00b
Branch: refs/heads/branch_7x
Commit: 4a86e00b76c16f1830311e99a1d59c0760be484d
Parents: d19ac7c
Author: Christine Poerschke <cp...@apache.org>
Authored: Tue Jul 31 18:55:34 2018 +0100
Committer: Christine Poerschke <cp...@apache.org>
Committed: Tue Jul 31 19:31:56 2018 +0100
----------------------------------------------------------------------
.../src/test/org/apache/lucene/index/TestTieredMergePolicy.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4a86e00b/lucene/core/src/test/org/apache/lucene/index/TestTieredMergePolicy.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestTieredMergePolicy.java b/lucene/core/src/test/org/apache/lucene/index/TestTieredMergePolicy.java
index a7f2111..b4a7ff5 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestTieredMergePolicy.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestTieredMergePolicy.java
@@ -54,7 +54,7 @@ public class TestTieredMergePolicy extends BaseMergePolicyTestCase {
totalMaxDoc += sci.info.maxDoc();
long byteSize = sci.sizeInBytes();
double liveRatio = 1 - (double) sci.getDelCount() / sci.info.maxDoc();
- long weightedByteSize = (long) Math.round(liveRatio * byteSize);
+ long weightedByteSize = Math.round(liveRatio * byteSize);
totalBytes += weightedByteSize;
minSegmentBytes = Math.min(minSegmentBytes, weightedByteSize);
}