mirror of https://github.com/apache/lucene.git
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/lucene-solr
This commit is contained in:
commit
2e519ac955
|
@ -68,7 +68,7 @@ public class LowerCaseTokenizerFactory extends TokenizerFactory implements Multi
|
|||
|
||||
@Override
|
||||
public AbstractAnalysisFactory getMultiTermComponent() {
|
||||
Map map = new HashMap<>(getOriginalArgs());
|
||||
Map<String,String> map = new HashMap<>(getOriginalArgs());
|
||||
map.remove("maxTokenLen"); //removing "maxTokenLen" argument for LowerCaseFilterFactory init
|
||||
return new LowerCaseFilterFactory(map);
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ public abstract class GeoBaseCompositeShape<T extends GeoShape> implements GeoSh
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode() * 31 + shapes.hashCode();//TODO cache
|
||||
return shapes.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -116,6 +116,6 @@ public abstract class GeoBaseCompositeShape<T extends GeoShape> implements GeoSh
|
|||
if (!(o instanceof GeoBaseCompositeShape<?>))
|
||||
return false;
|
||||
GeoBaseCompositeShape<?> other = (GeoBaseCompositeShape<?>) o;
|
||||
return super.equals(o) && shapes.equals(other.shapes);
|
||||
return shapes.equals(other.shapes);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.lucene.analysis.CharArraySet;
|
|||
import org.apache.lucene.analysis.MockAnalyzer;
|
||||
import org.apache.lucene.analysis.MockTokenizer;
|
||||
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||
import org.apache.lucene.search.BooleanClause;
|
||||
import org.apache.lucene.search.BooleanQuery;
|
||||
import org.apache.lucene.search.suggest.Input;
|
||||
import org.apache.lucene.search.suggest.InputArrayIterator;
|
||||
|
@ -302,17 +303,17 @@ public class BlendedInfixSuggesterTest extends LuceneTestCase {
|
|||
assertEquals(2, responses.size());
|
||||
|
||||
|
||||
responses = suggester.lookup(term, (Map) null, 1, false, false);
|
||||
responses = suggester.lookup(term, (Map<BytesRef, BooleanClause.Occur>) null, 1, false, false);
|
||||
assertEquals(1, responses.size());
|
||||
|
||||
responses = suggester.lookup(term, (Map) null, 2, false, false);
|
||||
responses = suggester.lookup(term, (Map<BytesRef, BooleanClause.Occur>) null, 2, false, false);
|
||||
assertEquals(2, responses.size());
|
||||
|
||||
|
||||
responses = suggester.lookup(term, (Set) null, 1, false, false);
|
||||
responses = suggester.lookup(term, (Set<BytesRef>) null, 1, false, false);
|
||||
assertEquals(1, responses.size());
|
||||
|
||||
responses = suggester.lookup(term, (Set) null, 2, false, false);
|
||||
responses = suggester.lookup(term, (Set<BytesRef>) null, 2, false, false);
|
||||
assertEquals(2, responses.size());
|
||||
|
||||
|
||||
|
|
|
@ -52,7 +52,11 @@ Detailed Change List
|
|||
Upgrade Notes
|
||||
----------------------
|
||||
|
||||
(No Notes)
|
||||
* SOLR-11195: shard and cluster metric reporter configuration now requires a class attribute.
|
||||
If a reporter configures the group="shard" attribute then please also configure the
|
||||
class="org.apache.solr.metrics.reporters.solr.SolrShardReporter" attribute.
|
||||
If a reporter configures the group="cluster" attribute then please also configure the
|
||||
class="org.apache.solr.metrics.reporters.solr.SolrClusterReporter" attribute.
|
||||
|
||||
New Features
|
||||
----------------------
|
||||
|
@ -91,6 +95,9 @@ Bug Fixes
|
|||
* SOLR-11190: GraphQuery also supports string fields which are indexed=false and docValues=true. Please refer to the
|
||||
Javadocs for DocValuesTermsQuery for it's performance characteristics. (Karthik Ramachandran, Varun Thacker)
|
||||
|
||||
* SOLR-11228: Exclude static html files in the partials directory from authentication and authorization checks. The UI
|
||||
will open correctly with kerberos enabled (Ishan Chattopadhyaya, Varun Thacker)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
||||
|
@ -141,6 +148,8 @@ Other Changes
|
|||
|
||||
* SOLR-11071: Improve TestIntervalFacets.testRandom (Tomás Fernández Löbbe)
|
||||
|
||||
* SOLR-11195: Require class attribute for shard and cluster metric reporter configuration. (Christine Poerschke)
|
||||
|
||||
================== 7.0.0 ==================
|
||||
|
||||
Versions of Major Components
|
||||
|
|
|
@ -91,6 +91,19 @@ public class TestLTROnSolrCloud extends TestRerankBase {
|
|||
assertEquals("2", queryResponse.getResults().get(1).get("id").toString());
|
||||
assertEquals("3", queryResponse.getResults().get(2).get("id").toString());
|
||||
assertEquals("4", queryResponse.getResults().get(3).get("id").toString());
|
||||
assertEquals("5", queryResponse.getResults().get(4).get("id").toString());
|
||||
assertEquals("6", queryResponse.getResults().get(5).get("id").toString());
|
||||
assertEquals("7", queryResponse.getResults().get(6).get("id").toString());
|
||||
assertEquals("8", queryResponse.getResults().get(7).get("id").toString());
|
||||
|
||||
final Float original_result0_score = (Float)queryResponse.getResults().get(0).get("score");
|
||||
final Float original_result1_score = (Float)queryResponse.getResults().get(1).get("score");
|
||||
final Float original_result2_score = (Float)queryResponse.getResults().get(2).get("score");
|
||||
final Float original_result3_score = (Float)queryResponse.getResults().get(3).get("score");
|
||||
final Float original_result4_score = (Float)queryResponse.getResults().get(4).get("score");
|
||||
final Float original_result5_score = (Float)queryResponse.getResults().get(5).get("score");
|
||||
final Float original_result6_score = (Float)queryResponse.getResults().get(6).get("score");
|
||||
final Float original_result7_score = (Float)queryResponse.getResults().get(7).get("score");
|
||||
|
||||
final String result0_features= FeatureLoggerTestUtils.toFeatureVector(
|
||||
"powpularityS","64.0", "c3","2.0");
|
||||
|
@ -100,9 +113,40 @@ public class TestLTROnSolrCloud extends TestRerankBase {
|
|||
"powpularityS","36.0", "c3","2.0");
|
||||
final String result3_features= FeatureLoggerTestUtils.toFeatureVector(
|
||||
"powpularityS","25.0", "c3","2.0");
|
||||
final String result4_features= FeatureLoggerTestUtils.toFeatureVector(
|
||||
"powpularityS","16.0", "c3","2.0");
|
||||
final String result5_features= FeatureLoggerTestUtils.toFeatureVector(
|
||||
"powpularityS", "9.0", "c3","2.0");
|
||||
final String result6_features= FeatureLoggerTestUtils.toFeatureVector(
|
||||
"powpularityS", "4.0", "c3","2.0");
|
||||
final String result7_features= FeatureLoggerTestUtils.toFeatureVector(
|
||||
"powpularityS", "1.0", "c3","2.0");
|
||||
|
||||
// Test re-rank and feature vectors returned
|
||||
|
||||
// Test feature vectors returned (without re-ranking)
|
||||
query.setFields("*,score,features:[fv]");
|
||||
queryResponse =
|
||||
solrCluster.getSolrClient().query(COLLECTION,query);
|
||||
assertEquals(8, queryResponse.getResults().getNumFound());
|
||||
assertEquals("1", queryResponse.getResults().get(0).get("id").toString());
|
||||
assertEquals("2", queryResponse.getResults().get(1).get("id").toString());
|
||||
assertEquals("3", queryResponse.getResults().get(2).get("id").toString());
|
||||
assertEquals("4", queryResponse.getResults().get(3).get("id").toString());
|
||||
assertEquals("5", queryResponse.getResults().get(4).get("id").toString());
|
||||
assertEquals("6", queryResponse.getResults().get(5).get("id").toString());
|
||||
assertEquals("7", queryResponse.getResults().get(6).get("id").toString());
|
||||
assertEquals("8", queryResponse.getResults().get(7).get("id").toString());
|
||||
|
||||
assertEquals(original_result0_score, queryResponse.getResults().get(0).get("score"));
|
||||
assertEquals(original_result1_score, queryResponse.getResults().get(1).get("score"));
|
||||
assertEquals(original_result2_score, queryResponse.getResults().get(2).get("score"));
|
||||
assertEquals(original_result3_score, queryResponse.getResults().get(3).get("score"));
|
||||
assertEquals(original_result4_score, queryResponse.getResults().get(4).get("score"));
|
||||
assertEquals(original_result5_score, queryResponse.getResults().get(5).get("score"));
|
||||
assertEquals(original_result6_score, queryResponse.getResults().get(6).get("score"));
|
||||
assertEquals(original_result7_score, queryResponse.getResults().get(7).get("score"));
|
||||
|
||||
// Test feature vectors returned (with re-ranking)
|
||||
query.add("rq", "{!ltr model=powpularityS-model reRankDocs=8}");
|
||||
queryResponse =
|
||||
solrCluster.getSolrClient().query(COLLECTION,query);
|
||||
|
@ -119,6 +163,18 @@ public class TestLTROnSolrCloud extends TestRerankBase {
|
|||
assertEquals("5", queryResponse.getResults().get(3).get("id").toString());
|
||||
assertEquals(result3_features,
|
||||
queryResponse.getResults().get(3).get("features").toString());
|
||||
assertEquals("4", queryResponse.getResults().get(4).get("id").toString());
|
||||
assertEquals(result4_features,
|
||||
queryResponse.getResults().get(4).get("features").toString());
|
||||
assertEquals("3", queryResponse.getResults().get(5).get("id").toString());
|
||||
assertEquals(result5_features,
|
||||
queryResponse.getResults().get(5).get("features").toString());
|
||||
assertEquals("2", queryResponse.getResults().get(6).get("id").toString());
|
||||
assertEquals(result6_features,
|
||||
queryResponse.getResults().get(6).get("features").toString());
|
||||
assertEquals("1", queryResponse.getResults().get(7).get("id").toString());
|
||||
assertEquals(result7_features,
|
||||
queryResponse.getResults().get(7).get("features").toString());
|
||||
}
|
||||
|
||||
private void setupSolrCluster(int numShards, int numReplicas, int numServers, int maxShardsPerNode) throws Exception {
|
||||
|
|
|
@ -224,6 +224,7 @@ public class StreamHandler extends RequestHandlerBase implements SolrCoreAware,
|
|||
.withFunctionName("kolmogorovSmirnov", KolmogorovSmirnovEvaluator.class)
|
||||
.withFunctionName("ks", KolmogorovSmirnovEvaluator.class)
|
||||
.withFunctionName("asc", AscEvaluator.class)
|
||||
.withFunctionName("cumulativeProbability", CumulativeProbabilityEvaluator.class)
|
||||
|
||||
// Boolean Stream Evaluators
|
||||
.withFunctionName("and", AndEvaluator.class)
|
||||
|
|
|
@ -1003,7 +1003,7 @@ public class SolrMetricManager {
|
|||
}
|
||||
}
|
||||
|
||||
private List<PluginInfo> prepareCloudPlugins(PluginInfo[] pluginInfos, String group, String className,
|
||||
private List<PluginInfo> prepareCloudPlugins(PluginInfo[] pluginInfos, String group,
|
||||
Map<String, String> defaultAttributes,
|
||||
Map<String, Object> defaultInitArgs) {
|
||||
List<PluginInfo> result = new ArrayList<>();
|
||||
|
@ -1015,7 +1015,7 @@ public class SolrMetricManager {
|
|||
if (!group.equals(groupAttr)) {
|
||||
continue;
|
||||
}
|
||||
info = preparePlugin(info, className, defaultAttributes, defaultInitArgs);
|
||||
info = preparePlugin(info, defaultAttributes, defaultInitArgs);
|
||||
if (info != null) {
|
||||
result.add(info);
|
||||
}
|
||||
|
@ -1023,18 +1023,12 @@ public class SolrMetricManager {
|
|||
return result;
|
||||
}
|
||||
|
||||
private PluginInfo preparePlugin(PluginInfo info, String className, Map<String, String> defaultAttributes,
|
||||
private PluginInfo preparePlugin(PluginInfo info, Map<String, String> defaultAttributes,
|
||||
Map<String, Object> defaultInitArgs) {
|
||||
if (info == null) {
|
||||
return null;
|
||||
}
|
||||
String classNameAttr = info.attributes.get("class");
|
||||
if (className != null) {
|
||||
if (classNameAttr != null && !className.equals(classNameAttr)) {
|
||||
log.warn("Conflicting class name attributes, expected " + className + " but was " + classNameAttr + ", skipping " + info);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, String> attrs = new HashMap<>(info.attributes);
|
||||
defaultAttributes.forEach((k, v) -> {
|
||||
|
@ -1042,7 +1036,7 @@ public class SolrMetricManager {
|
|||
attrs.put(k, v);
|
||||
}
|
||||
});
|
||||
attrs.put("class", className);
|
||||
attrs.put("class", classNameAttr);
|
||||
Map<String, Object> initArgs = new HashMap<>();
|
||||
if (info.initArgs != null) {
|
||||
initArgs.putAll(info.initArgs.asMap(10));
|
||||
|
@ -1069,7 +1063,7 @@ public class SolrMetricManager {
|
|||
|
||||
String registryName = core.getCoreMetricManager().getRegistryName();
|
||||
// collect infos and normalize
|
||||
List<PluginInfo> infos = prepareCloudPlugins(pluginInfos, SolrInfoBean.Group.shard.toString(), SolrShardReporter.class.getName(),
|
||||
List<PluginInfo> infos = prepareCloudPlugins(pluginInfos, SolrInfoBean.Group.shard.toString(),
|
||||
attrs, initArgs);
|
||||
for (PluginInfo info : infos) {
|
||||
try {
|
||||
|
@ -1092,7 +1086,7 @@ public class SolrMetricManager {
|
|||
attrs.put("group", SolrInfoBean.Group.cluster.toString());
|
||||
Map<String, Object> initArgs = new HashMap<>();
|
||||
initArgs.put("period", DEFAULT_CLOUD_REPORTER_PERIOD);
|
||||
List<PluginInfo> infos = prepareCloudPlugins(pluginInfos, SolrInfoBean.Group.cluster.toString(), SolrClusterReporter.class.getName(),
|
||||
List<PluginInfo> infos = prepareCloudPlugins(pluginInfos, SolrInfoBean.Group.cluster.toString(),
|
||||
attrs, initArgs);
|
||||
String registryName = getRegistryName(SolrInfoBean.Group.cluster);
|
||||
for (PluginInfo info : infos) {
|
||||
|
|
|
@ -42,12 +42,12 @@
|
|||
<reporter name="defaultJmx" class="org.apache.solr.metrics.reporters.SolrJmxReporter">
|
||||
<bool name="enabled">false</bool>
|
||||
</reporter>
|
||||
<reporter name="test" group="shard">
|
||||
<reporter name="test" group="shard" class="org.apache.solr.metrics.reporters.solr.SolrShardReporter">
|
||||
<int name="period">5</int>
|
||||
<str name="filter">UPDATE\./update/.*requests</str>
|
||||
<str name="filter">QUERY\./select.*requests</str>
|
||||
</reporter>
|
||||
<reporter name="test" group="cluster">
|
||||
<reporter name="test" group="cluster" class="org.apache.solr.metrics.reporters.solr.SolrClusterReporter">
|
||||
<str name="handler">/admin/metrics/collector</str>
|
||||
<int name="period">5</int>
|
||||
<lst name="report">
|
||||
|
|
|
@ -16,10 +16,13 @@
|
|||
*/
|
||||
package org.apache.solr.security.hadoop;
|
||||
|
||||
import static org.apache.solr.common.cloud.VMParamsAllAndReadonlyDigestZkACLProvider.DEFAULT_DIGEST_READONLY_PASSWORD_VM_PARAM_NAME;
|
||||
import static org.apache.solr.common.cloud.VMParamsAllAndReadonlyDigestZkACLProvider.DEFAULT_DIGEST_READONLY_USERNAME_VM_PARAM_NAME;
|
||||
import static org.apache.solr.common.cloud.VMParamsSingleSetCredentialsDigestZkCredentialsProvider.DEFAULT_DIGEST_PASSWORD_VM_PARAM_NAME;
|
||||
import static org.apache.solr.common.cloud.VMParamsSingleSetCredentialsDigestZkCredentialsProvider.DEFAULT_DIGEST_USERNAME_VM_PARAM_NAME;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -28,10 +31,10 @@ import org.apache.lucene.util.Constants;
|
|||
import org.apache.solr.cloud.MiniSolrCloudCluster;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.common.cloud.SecurityAwareZkACLProvider;
|
||||
import org.apache.solr.common.cloud.ZkCredentialsProvider;
|
||||
import org.apache.solr.common.cloud.SolrZkClient;
|
||||
import org.apache.solr.common.cloud.VMParamsAllAndReadonlyDigestZkACLProvider;
|
||||
import org.apache.solr.common.cloud.VMParamsSingleSetCredentialsDigestZkCredentialsProvider;
|
||||
import org.apache.solr.common.cloud.ZkStateReader;
|
||||
import org.apache.zookeeper.KeeperException;
|
||||
import org.apache.zookeeper.KeeperException.Code;
|
||||
import org.apache.zookeeper.WatchedEvent;
|
||||
import org.apache.zookeeper.Watcher;
|
||||
import org.apache.zookeeper.ZooDefs;
|
||||
|
@ -39,30 +42,33 @@ import org.apache.zookeeper.ZooKeeper;
|
|||
import org.apache.zookeeper.data.ACL;
|
||||
import org.apache.zookeeper.data.Id;
|
||||
import org.apache.zookeeper.data.Stat;
|
||||
import org.apache.zookeeper.server.ServerCnxn;
|
||||
import org.apache.zookeeper.server.auth.AuthenticationProvider;
|
||||
import org.apache.zookeeper.server.auth.ProviderRegistry;
|
||||
import org.apache.zookeeper.server.auth.DigestAuthenticationProvider;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
@Ignore
|
||||
public class TestZkAclsWithHadoopAuth extends SolrCloudTestCase {
|
||||
protected static final int NUM_SERVERS = 1;
|
||||
protected static final int NUM_SHARDS = 1;
|
||||
protected static final int REPLICATION_FACTOR = 1;
|
||||
private static final String SOLR_PASSWD = "solr";
|
||||
private static final String FOO_PASSWD = "foo";
|
||||
private static final Id SOLR_ZK_ID = new Id("digest", digest ("solr", SOLR_PASSWD));
|
||||
private static final Id FOO_ZK_ID = new Id("digest", digest ("foo", FOO_PASSWD));
|
||||
|
||||
@BeforeClass
|
||||
public static void setupClass() throws Exception {
|
||||
assumeFalse("Hadoop does not work on Windows", Constants.WINDOWS);
|
||||
assumeFalse("FIXME: SOLR-8182: This test fails under Java 9", Constants.JRE_IS_MINIMUM_JAVA9);
|
||||
|
||||
System.setProperty("zookeeper.authProvider.1", DummyZKAuthProvider.class.getName());
|
||||
System.setProperty("zkCredentialsProvider", DummyZkCredentialsProvider.class.getName());
|
||||
System.setProperty("zkACLProvider", DummyZkAclProvider.class.getName());
|
||||
|
||||
ProviderRegistry.initialize();
|
||||
System.setProperty(SolrZkClient.ZK_ACL_PROVIDER_CLASS_NAME_VM_PARAM_NAME,
|
||||
VMParamsAllAndReadonlyDigestZkACLProvider.class.getName());
|
||||
System.setProperty(SolrZkClient.ZK_CRED_PROVIDER_CLASS_NAME_VM_PARAM_NAME,
|
||||
VMParamsSingleSetCredentialsDigestZkCredentialsProvider.class.getName());
|
||||
System.setProperty(DEFAULT_DIGEST_USERNAME_VM_PARAM_NAME, "solr");
|
||||
System.setProperty(DEFAULT_DIGEST_PASSWORD_VM_PARAM_NAME, SOLR_PASSWD);
|
||||
System.setProperty(DEFAULT_DIGEST_READONLY_USERNAME_VM_PARAM_NAME, "foo");
|
||||
System.setProperty(DEFAULT_DIGEST_READONLY_PASSWORD_VM_PARAM_NAME, FOO_PASSWD);
|
||||
|
||||
configureCluster(NUM_SERVERS)// nodes
|
||||
.withSolrXml(MiniSolrCloudCluster.DEFAULT_CLOUD_SOLR_XML)
|
||||
|
@ -73,9 +79,12 @@ public class TestZkAclsWithHadoopAuth extends SolrCloudTestCase {
|
|||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
System.clearProperty("zookeeper.authProvider.1");
|
||||
System.clearProperty("zkCredentialsProvider");
|
||||
System.clearProperty("zkACLProvider");
|
||||
System.clearProperty(SolrZkClient.ZK_ACL_PROVIDER_CLASS_NAME_VM_PARAM_NAME);
|
||||
System.clearProperty(SolrZkClient.ZK_CRED_PROVIDER_CLASS_NAME_VM_PARAM_NAME);
|
||||
System.clearProperty(DEFAULT_DIGEST_USERNAME_VM_PARAM_NAME);
|
||||
System.clearProperty(DEFAULT_DIGEST_PASSWORD_VM_PARAM_NAME);
|
||||
System.clearProperty(DEFAULT_DIGEST_READONLY_USERNAME_VM_PARAM_NAME);
|
||||
System.clearProperty(DEFAULT_DIGEST_READONLY_PASSWORD_VM_PARAM_NAME);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -89,7 +98,7 @@ public class TestZkAclsWithHadoopAuth extends SolrCloudTestCase {
|
|||
}
|
||||
});
|
||||
|
||||
keeper.addAuthInfo("dummyauth", "solr".getBytes(StandardCharsets.UTF_8));
|
||||
keeper.addAuthInfo("digest", ("solr:"+SOLR_PASSWD).getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
// Test well known paths.
|
||||
checkNonSecurityACLs(keeper, "/solr.xml");
|
||||
|
@ -135,84 +144,22 @@ public class TestZkAclsWithHadoopAuth extends SolrCloudTestCase {
|
|||
List<ACL> acls = keeper.getACL(path, new Stat());
|
||||
String message = String.format(Locale.ROOT, "Path %s ACLs found %s", path, acls);
|
||||
assertEquals(message, 1, acls.size());
|
||||
assertTrue(message, acls.contains(new ACL(ZooDefs.Perms.ALL, new Id("dummyauth", "solr"))));
|
||||
assertTrue(message, acls.contains(new ACL(ZooDefs.Perms.ALL, SOLR_ZK_ID)));
|
||||
}
|
||||
|
||||
private void checkNonSecurityACLs(ZooKeeper keeper, String path) throws Exception {
|
||||
List<ACL> acls = keeper.getACL(path, new Stat());
|
||||
String message = String.format(Locale.ROOT, "Path %s ACLs found %s", path, acls);
|
||||
assertEquals(message, 2, acls.size());
|
||||
assertTrue(message, acls.contains(new ACL(ZooDefs.Perms.ALL, new Id("dummyauth", "solr"))));
|
||||
assertTrue(message, acls.contains(new ACL(ZooDefs.Perms.READ, new Id("world", "anyone"))));
|
||||
assertTrue(message, acls.contains(new ACL(ZooDefs.Perms.ALL, SOLR_ZK_ID)));
|
||||
assertTrue(message, acls.contains(new ACL(ZooDefs.Perms.READ, FOO_ZK_ID)));
|
||||
}
|
||||
|
||||
public static class DummyZKAuthProvider implements AuthenticationProvider {
|
||||
public static final String zkSuperUser = "zookeeper";
|
||||
public static final Collection<String> validUsers = Arrays.asList(zkSuperUser, "solr", "foo");
|
||||
|
||||
@Override
|
||||
public String getScheme() {
|
||||
return "dummyauth";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Code handleAuthentication(ServerCnxn arg0, byte[] arg1) {
|
||||
String userName = new String(arg1, StandardCharsets.UTF_8);
|
||||
|
||||
if (validUsers.contains(userName)) {
|
||||
if (zkSuperUser.equals(userName)) {
|
||||
arg0.addAuthInfo(new Id("super", ""));
|
||||
}
|
||||
arg0.addAuthInfo(new Id(getScheme(), userName));
|
||||
return KeeperException.Code.OK;
|
||||
}
|
||||
|
||||
return KeeperException.Code.AUTHFAILED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAuthenticated() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(String arg0) {
|
||||
return (arg0 != null) && validUsers.contains(arg0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(String arg0, String arg1) {
|
||||
return arg0.equals(arg1);
|
||||
private static String digest (String userName, String passwd) {
|
||||
try {
|
||||
return DigestAuthenticationProvider.generateDigest(userName+":"+passwd);
|
||||
} catch (NoSuchAlgorithmException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static class DummyZkCredentialsProvider implements ZkCredentialsProvider {
|
||||
public static final Collection<ZkCredentials> solrCreds =
|
||||
Arrays.asList(new ZkCredentials("dummyauth", "solr".getBytes(StandardCharsets.UTF_8)));
|
||||
|
||||
@Override
|
||||
public Collection<ZkCredentials> getCredentials() {
|
||||
return solrCreds;
|
||||
}
|
||||
}
|
||||
|
||||
public static class DummyZkAclProvider extends SecurityAwareZkACLProvider {
|
||||
|
||||
@Override
|
||||
protected List<ACL> createNonSecurityACLsToAdd() {
|
||||
List<ACL> result = new ArrayList<>(2);
|
||||
result.add(new ACL(ZooDefs.Perms.ALL, new Id("dummyauth", "solr")));
|
||||
result.add(new ACL(ZooDefs.Perms.READ, ZooDefs.Ids.ANYONE_ID_UNSAFE));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<ACL> createSecurityACLsToAdd() {
|
||||
List<ACL> ret = new ArrayList<ACL>();
|
||||
ret.add(new ACL(ZooDefs.Perms.ALL, new Id("dummyauth", "solr")));
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -146,3 +146,8 @@ For example, to use a blob named test, you would configure `solrconfig.xml` like
|
|||
----
|
||||
|
||||
If there are parameters available in the custom handler, you can define them in the same way as any other request handler definition.
|
||||
|
||||
[NOTE]
|
||||
====
|
||||
|
||||
Blob store can only be used to dynamically load components configured in `solrconfig.xml`. Components specified in `schema.xml` cannot be loaded from blob store
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* 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.client.solrj.io.eval;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.math3.distribution.RealDistribution;
|
||||
import org.apache.solr.client.solrj.io.Tuple;
|
||||
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;
|
||||
import org.apache.solr.client.solrj.io.stream.expr.StreamExpression;
|
||||
import org.apache.solr.client.solrj.io.stream.expr.StreamExpressionParameter;
|
||||
import org.apache.solr.client.solrj.io.stream.expr.StreamFactory;
|
||||
|
||||
public class CumulativeProbabilityEvaluator extends ComplexEvaluator implements Expressible {
|
||||
|
||||
private static final long serialVersionUID = 1;
|
||||
|
||||
public CumulativeProbabilityEvaluator(StreamExpression expression, StreamFactory factory) throws IOException {
|
||||
super(expression, factory);
|
||||
|
||||
if(2 != subEvaluators.size()){
|
||||
throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - expecting two values (regression result and a number) but found %d",expression,subEvaluators.size()));
|
||||
}
|
||||
}
|
||||
|
||||
public Number evaluate(Tuple tuple) throws IOException {
|
||||
StreamEvaluator a = subEvaluators.get(0);
|
||||
StreamEvaluator b = subEvaluators.get(1);
|
||||
Number number1 = (Number)b.evaluate(tuple);
|
||||
RealDistribution rd= (RealDistribution)a.evaluate(tuple);
|
||||
|
||||
return rd.cumulativeProbability(number1.doubleValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public StreamExpressionParameter toExpression(StreamFactory factory) throws IOException {
|
||||
StreamExpression expression = new StreamExpression(factory.getFunctionName(getClass()));
|
||||
return expression;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Explanation toExplanation(StreamFactory factory) throws IOException {
|
||||
return new Explanation(nodeId.toString())
|
||||
.withExpressionType(ExpressionType.EVALUATOR)
|
||||
.withFunctionName(factory.getFunctionName(getClass()))
|
||||
.withImplementingClass(getClass().getName())
|
||||
.withExpression(toExpression(factory).toString());
|
||||
}
|
||||
}
|
|
@ -14,9 +14,6 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.apache.solr.client.solrj.io.eval;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"documentation": "TODO NOCOMMIT",
|
||||
"documentation": "https://lucene.apache.org/solr/guide/solrcloud-autoscaling-api.html",
|
||||
"description": "The Scaling API provides API for adding cluster level scaling rules, triggers and event listeners",
|
||||
"methods": [
|
||||
"GET",
|
||||
|
|
|
@ -5287,6 +5287,23 @@ public class StreamExpressionTest extends SolrCloudTestCase {
|
|||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testCumulativeProbability() throws Exception {
|
||||
String expr = "cumulativeProbability(normalDistribution(500, 40), 500)";
|
||||
ModifiableSolrParams paramsLoc = new ModifiableSolrParams();
|
||||
paramsLoc.set("expr", expr);
|
||||
paramsLoc.set("qt", "/stream");
|
||||
|
||||
String url = cluster.getJettySolrRunners().get(0).getBaseUrl().toString()+"/"+COLLECTIONORALIAS;
|
||||
TupleStream solrStream = new SolrStream(url, paramsLoc);
|
||||
|
||||
StreamContext context = new StreamContext();
|
||||
solrStream.setStreamContext(context);
|
||||
List<Tuple> tuples = getTuples(solrStream);
|
||||
assertTrue(tuples.size() == 1);
|
||||
Number number = (Number)tuples.get(0).get("return-value");
|
||||
assertTrue(number.doubleValue() == .5D);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
-->
|
||||
<init-param>
|
||||
<param-name>excludePatterns</param-name>
|
||||
<param-value>/libs/.+,/css/.+,/js/.+,/img/.+,/tpl/.+</param-value>
|
||||
<param-value>/partials/.+,/libs/.+,/css/.+,/js/.+,/img/.+,/tpl/.+</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
|
||||
|
|
Loading…
Reference in New Issue