lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [24/50] lucene-solr:jira/solr-9858: Merge branch 'apache-https-master' into jira/solr-8593
Date Thu, 16 Feb 2017 13:47:14 GMT
Merge branch 'apache-https-master' into jira/solr-8593


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/3793eb5e
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/3793eb5e
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/3793eb5e

Branch: refs/heads/jira/solr-9858
Commit: 3793eb5ec637f110e1be2acb94169be16ef549cc
Parents: 5f65487 cd4f908
Author: Kevin Risden <krisden@apache.org>
Authored: Fri Jan 6 15:47:02 2017 -0600
Committer: Kevin Risden <krisden@apache.org>
Committed: Fri Jan 6 15:47:02 2017 -0600

----------------------------------------------------------------------
 solr/CHANGES.txt                                |  40 +-
 solr/contrib/ltr/README.md                      | 390 +------------------
 solr/contrib/ltr/example/README.md              |  60 +++
 solr/contrib/ltr/example/config.json            |  13 +-
 solr/contrib/ltr/example/exampleFeatures.json   |  26 ++
 solr/contrib/ltr/example/libsvm_formatter.py    |  12 +-
 .../ltr/example/techproducts-features.json      |  26 --
 .../contrib/ltr/example/techproducts-model.json |  18 -
 .../ltr/example/train_and_upload_demo_model.py  | 143 ++++---
 .../ltr/store/rest/ManagedFeatureStore.java     |   3 -
 .../solr/ltr/store/rest/ManagedModelStore.java  |   6 +-
 .../multipleadditivetreesmodel.json             |   2 +-
 .../org/apache/solr/ltr/TestRerankBase.java     |   9 +-
 .../model/TestMultipleAdditiveTreesModel.java   |   9 +-
 .../solr/ltr/store/rest/TestModelManager.java   |  47 ++-
 .../store/rest/TestModelManagerPersistence.java |   4 +-
 .../apache/solr/cloud/rule/ReplicaAssigner.java |  31 +-
 .../java/org/apache/solr/cloud/rule/Rule.java   |   4 +-
 .../org/apache/solr/core/CoreContainer.java     |   5 +-
 .../solr/core/MetricsDirectoryFactory.java      |   6 +-
 .../src/java/org/apache/solr/core/SolrCore.java |  20 +
 .../org/apache/solr/core/SolrInfoMBean.java     |   4 +-
 .../org/apache/solr/handler/GraphHandler.java   |   3 +-
 .../apache/solr/handler/ReplicationHandler.java |  20 +-
 .../apache/solr/handler/RequestHandlerBase.java |   5 +-
 .../org/apache/solr/handler/StreamHandler.java  |   1 +
 .../solr/handler/admin/CoreAdminHandler.java    |   6 +-
 .../solr/handler/admin/MetricsHandler.java      |  16 +-
 .../component/HttpShardHandlerFactory.java      |  50 +--
 .../org/apache/solr/handler/sql/SolrSchema.java |   8 +-
 .../solr/metrics/SolrCoreMetricManager.java     |   9 +-
 .../apache/solr/metrics/SolrMetricProducer.java |  12 +-
 .../apache/solr/parser/SolrQueryParserBase.java |  26 +-
 .../request/PerSegmentSingleValuedFaceting.java |   9 +-
 .../org/apache/solr/request/SimpleFacets.java   |  37 +-
 .../solr/search/ComplexPhraseQParserPlugin.java |  70 +++-
 .../org/apache/solr/search/facet/HLLAgg.java    |  13 +-
 .../apache/solr/search/facet/PercentileAgg.java |   7 +-
 .../org/apache/solr/search/facet/SlotAcc.java   |   5 +-
 .../apache/solr/search/facet/UniqueSlotAcc.java |   2 +-
 .../java/org/apache/solr/update/PeerSync.java   |   8 +-
 .../apache/solr/update/UpdateShardHandler.java  |  21 +-
 .../stats/InstrumentedHttpRequestExecutor.java  |  48 +--
 ...entedPoolingHttpClientConnectionManager.java |  43 +-
 .../org/apache/solr/util/stats/MetricUtils.java |  13 +-
 .../apache/solr/cloud/rule/RuleEngineTest.java  |   2 +-
 .../solr/handler/admin/MetricsHandlerTest.java  |  36 +-
 .../solr/metrics/SolrCoreMetricManagerTest.java |   7 +-
 .../solr/metrics/SolrMetricTestUtils.java       |  47 +--
 .../apache/solr/request/SimpleFacetsTest.java   |  12 +-
 .../TestComplexPhraseLeadingWildcard.java       | 113 ++++++
 .../solr/search/facet/TestJsonFacets.java       |  71 +++-
 .../client/solrj/io/ops/BooleanOperation.java   |   6 +-
 .../solr/client/solrj/io/ops/LeafOperation.java |   8 +
 .../client/solrj/io/stream/HavingStream.java    |  21 +-
 .../solrj/io/stream/expr/StreamFactory.java     |   2 +
 .../solrj/io/stream/StreamExpressionTest.java   |  36 +-
 .../java/org/apache/solr/SolrTestCaseHS.java    |   4 +
 58 files changed, 779 insertions(+), 896 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/3793eb5e/solr/core/src/java/org/apache/solr/handler/sql/SolrSchema.java
----------------------------------------------------------------------
diff --cc solr/core/src/java/org/apache/solr/handler/sql/SolrSchema.java
index 221ddf8,0000000..aecfd42
mode 100644,000000..100644
--- a/solr/core/src/java/org/apache/solr/handler/sql/SolrSchema.java
+++ b/solr/core/src/java/org/apache/solr/handler/sql/SolrSchema.java
@@@ -1,120 -1,0 +1,124 @@@
 +/*
 + * 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.sql;
 +
 +import com.google.common.collect.ImmutableMap;
 +import org.apache.calcite.rel.type.*;
 +import org.apache.calcite.schema.Table;
 +import org.apache.calcite.schema.impl.AbstractSchema;
 +import org.apache.calcite.sql.type.SqlTypeFactoryImpl;
 +import org.apache.solr.client.solrj.SolrServerException;
 +import org.apache.solr.client.solrj.impl.CloudSolrClient;
 +import org.apache.solr.client.solrj.request.LukeRequest;
 +import org.apache.solr.client.solrj.response.LukeResponse;
++import org.apache.solr.common.cloud.Aliases;
 +import org.apache.solr.common.cloud.ClusterState;
 +import org.apache.solr.common.cloud.ZkStateReader;
 +import org.apache.solr.common.luke.FieldFlag;
 +
 +import java.io.IOException;
 +import java.util.EnumSet;
 +import java.util.Map;
 +import java.util.Properties;
 +import java.util.Set;
 +
 +class SolrSchema extends AbstractSchema {
 +  final Properties properties;
 +
 +  SolrSchema(Properties properties) {
 +    super();
 +    this.properties = properties;
 +  }
 +
 +  @Override
 +  protected Map<String, Table> getTableMap() {
 +    String zk = this.properties.getProperty("zk");
 +    try(CloudSolrClient cloudSolrClient = new CloudSolrClient.Builder().withZkHost(zk).build())
{
 +      cloudSolrClient.connect();
 +      ZkStateReader zkStateReader = cloudSolrClient.getZkStateReader();
 +      ClusterState clusterState = zkStateReader.getClusterState();
 +
 +      final ImmutableMap.Builder<String, Table> builder = ImmutableMap.builder();
 +
 +      for (String collection : clusterState.getCollectionsMap().keySet()) {
 +        builder.put(collection, new SolrTable(this, collection));
 +      }
 +
-       for (Map.Entry<String, String> alias : zkStateReader.getAliases().getCollectionAliasMap().entrySet())
{
-         builder.put(alias.getKey(), new SolrTable(this, alias.getValue()));
++      Aliases aliases = zkStateReader.getAliases();
++      if(aliases.collectionAliasSize() > 0) {
++        for (Map.Entry<String, String> alias : aliases.getCollectionAliasMap().entrySet())
{
++          builder.put(alias.getKey(), new SolrTable(this, alias.getValue()));
++        }
 +      }
 +
 +      return builder.build();
 +    } catch (IOException e) {
 +      throw new RuntimeException(e);
 +    }
 +  }
 +
 +  private Map<String, LukeResponse.FieldInfo> getFieldInfo(String collection) {
 +    String zk = this.properties.getProperty("zk");
 +    try(CloudSolrClient cloudSolrClient = new CloudSolrClient.Builder().withZkHost(zk).build())
{
 +      cloudSolrClient.connect();
 +      LukeRequest lukeRequest = new LukeRequest();
 +      lukeRequest.setNumTerms(0);
 +      LukeResponse lukeResponse = lukeRequest.process(cloudSolrClient, collection);
 +      return lukeResponse.getFieldInfo();
 +    } catch (SolrServerException | IOException e) {
 +      throw new RuntimeException(e);
 +    }
 +  }
 +
 +  RelProtoDataType getRelDataType(String collection) {
 +    // Temporary type factory, just for the duration of this method. Allowable
 +    // because we're creating a proto-type, not a type; before being used, the
 +    // proto-type will be copied into a real type factory.
 +    final RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
 +    final RelDataTypeFactory.FieldInfoBuilder fieldInfo = typeFactory.builder();
 +    Map<String, LukeResponse.FieldInfo> luceneFieldInfoMap = getFieldInfo(collection);
 +    for(Map.Entry<String, LukeResponse.FieldInfo> entry : luceneFieldInfoMap.entrySet())
{
 +      LukeResponse.FieldInfo luceneFieldInfo = entry.getValue();
 +
 +      RelDataType type;
 +      switch (luceneFieldInfo.getType()) {
 +        case "string":
 +          type = typeFactory.createJavaType(String.class);
 +          break;
 +        case "int":
 +        case "long":
 +          type = typeFactory.createJavaType(Long.class);
 +          break;
 +        case "float":
 +        case "double":
 +          type = typeFactory.createJavaType(Double.class);
 +          break;
 +        default:
 +          type = typeFactory.createJavaType(String.class);
 +      }
 +
 +      EnumSet<FieldFlag> flags = luceneFieldInfo.getFlags();
 +      if(flags != null && flags.contains(FieldFlag.MULTI_VALUED)) {
 +        type = typeFactory.createArrayType(type, -1);
 +      }
 +
 +      fieldInfo.add(entry.getKey(), type).nullable(true);
 +    }
 +
 +    return RelDataTypeImpl.proto(fieldInfo.build());
 +  }
 +}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/3793eb5e/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
----------------------------------------------------------------------
diff --cc solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
index fd088f1,5b806a8..e84cb69
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
@@@ -904,6 -914,17 +914,16 @@@ public class StreamExpressionTest exten
      t = tuples.get(1);
      assertTrue(t.getString("id").equals("9"));
  
 -
+     stream = factory.constructStream("having(rollup(over=a_f, sum(a_i), search(" + COLLECTIONORALIAS
+ ", q=*:*, fl=\"id,a_s,a_i,a_f\", sort=\"a_f asc\")), and(eq(sum(a_i), 9),eq(sum(a_i), 9)))");
+     context = new StreamContext();
+     context.setSolrClientCache(solrClientCache);
+     stream.setStreamContext(context);
+     tuples = getTuples(stream);
+ 
+     assert(tuples.size() == 1);
+     t = tuples.get(0);
+     assertTrue(t.getDouble("a_f") == 10.0D);
+ 
      solrClientCache.close();
    }
  
@@@ -1001,6 -1023,19 +1022,17 @@@
      t = tuples.get(1);
      assertTrue(t.getString("id").equals("9"));
  
+     stream = factory.constructStream("parallel("+COLLECTIONORALIAS+", workers=2, sort=\"a_f
asc\", having(rollup(over=a_f, sum(a_i), search(" + COLLECTIONORALIAS + ", q=*:*, fl=\"id,a_s,a_i,a_f\",
sort=\"a_f asc\", partitionKeys=a_f)), and(eq(sum(a_i), 9),eq(sum(a_i),9))))");
+     context = new StreamContext();
+     context.setSolrClientCache(solrClientCache);
+     stream.setStreamContext(context);
+     tuples = getTuples(stream);
+ 
+     assert(tuples.size() == 1);
+ 
+     t = tuples.get(0);
+     assertTrue(t.getDouble("a_f") == 10.0D);
+ 
 -
 -
      solrClientCache.close();
    }
  


Mime
View raw message