You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2017/02/21 03:23:02 UTC
lucene-solr:branch_6x: SOLR-10175: Rename test so it doesn't match
test glob pattern.
Repository: lucene-solr
Updated Branches:
refs/heads/branch_6x db83e582f -> 017b8a6e2
SOLR-10175: Rename test so it doesn't match test glob pattern.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/017b8a6e
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/017b8a6e
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/017b8a6e
Branch: refs/heads/branch_6x
Commit: 017b8a6e2852bcd423661ad457bb623f05bbbf5e
Parents: db83e58
Author: markrmiller <ma...@apache.org>
Authored: Mon Feb 20 21:27:39 2017 -0500
Committer: markrmiller <ma...@apache.org>
Committed: Mon Feb 20 22:22:54 2017 -0500
----------------------------------------------------------------------
.../conf/solrconfig-analytics-query.xml | 2 +-
.../solr/search/AnalyticsMergeStrategyTest.java | 2 +-
.../solr/search/AnalyticsTestQParserPlugin.java | 171 ++++++++++++++++++
.../solr/search/TestAnalyticsQParserPlugin.java | 173 -------------------
4 files changed, 173 insertions(+), 175 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/017b8a6e/solr/core/src/test-files/solr/collection1/conf/solrconfig-analytics-query.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/collection1/conf/solrconfig-analytics-query.xml b/solr/core/src/test-files/solr/collection1/conf/solrconfig-analytics-query.xml
index 9ce9219..b5959cc 100644
--- a/solr/core/src/test-files/solr/collection1/conf/solrconfig-analytics-query.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/solrconfig-analytics-query.xml
@@ -478,7 +478,7 @@ based HashBitset. -->
<propTest attr1="${solr.test.sys.prop1}-$${literal}"
attr2="${non.existent.sys.prop:default-from-config}">prefix-${solr.test.sys.prop2}-suffix</propTest>
- <queryParser name="count" class="org.apache.solr.search.TestAnalyticsQParserPlugin"/>
+ <queryParser name="count" class="org.apache.solr.search.AnalyticsTestQParserPlugin"/>
<updateRequestProcessorChain name="dedupe">
<processor class="org.apache.solr.update.processor.SignatureUpdateProcessorFactory">
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/017b8a6e/solr/core/src/test/org/apache/solr/search/AnalyticsMergeStrategyTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/AnalyticsMergeStrategyTest.java b/solr/core/src/test/org/apache/solr/search/AnalyticsMergeStrategyTest.java
index a9dd0e5..813d61f 100644
--- a/solr/core/src/test/org/apache/solr/search/AnalyticsMergeStrategyTest.java
+++ b/solr/core/src/test/org/apache/solr/search/AnalyticsMergeStrategyTest.java
@@ -63,7 +63,7 @@ public class AnalyticsMergeStrategyTest extends BaseDistributedSearchTestCase {
commit();
/*
- * The count qparser plugin is pointing to the TestAnalyticsQParserPlugin. This class defines a simple AnalyticsQuery and
+ * The count qparser plugin is pointing to AnalyticsTestQParserPlugin. This class defines a simple AnalyticsQuery and
* has two merge strategies. If the iterate local param is true then an InterativeMergeStrategy is used.
*/
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/017b8a6e/solr/core/src/test/org/apache/solr/search/AnalyticsTestQParserPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/AnalyticsTestQParserPlugin.java b/solr/core/src/test/org/apache/solr/search/AnalyticsTestQParserPlugin.java
new file mode 100644
index 0000000..392fb82
--- /dev/null
+++ b/solr/core/src/test/org/apache/solr/search/AnalyticsTestQParserPlugin.java
@@ -0,0 +1,171 @@
+/*
+ * 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.search;
+
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.solr.client.solrj.request.QueryRequest;
+
+import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.params.SolrParams;
+import org.apache.solr.common.util.NamedList;
+import org.apache.solr.handler.component.IterativeMergeStrategy;
+import org.apache.solr.handler.component.ResponseBuilder;
+import org.apache.solr.handler.component.ShardRequest;
+import org.apache.solr.request.SolrQueryRequest;
+import org.apache.solr.handler.component.MergeStrategy;
+import org.apache.solr.handler.component.ShardResponse;
+
+import java.util.List;
+import java.util.concurrent.Future;
+import java.io.IOException;
+
+public class AnalyticsTestQParserPlugin extends QParserPlugin {
+
+
+ public QParser createParser(String query, SolrParams localParams, SolrParams params, SolrQueryRequest req) {
+ return new TestAnalyticsQueryParser(query, localParams, params, req);
+ }
+
+ class TestAnalyticsQueryParser extends QParser {
+
+ public TestAnalyticsQueryParser(String query, SolrParams localParams, SolrParams params, SolrQueryRequest req) {
+ super(query, localParams, params, req);
+ }
+
+ public Query parse() throws SyntaxError {
+ int base = localParams.getInt("base", 0);
+ boolean iterate = localParams.getBool("iterate", false);
+ if(iterate)
+ return new TestAnalyticsQuery(base, new TestIterative());
+ else
+ return new TestAnalyticsQuery(base, new TestAnalyticsMergeStrategy());
+ }
+ }
+
+ class TestAnalyticsQuery extends AnalyticsQuery {
+
+ private int base;
+
+ public TestAnalyticsQuery(int base, MergeStrategy mergeStrategy) {
+ super(mergeStrategy);
+ this.base = base;
+ }
+
+ public DelegatingCollector getAnalyticsCollector(ResponseBuilder rb, IndexSearcher searcher) {
+ return new TestAnalyticsCollector(base, rb);
+ }
+ }
+
+ class TestAnalyticsCollector extends DelegatingCollector {
+ ResponseBuilder rb;
+ int count;
+ int base;
+
+ public TestAnalyticsCollector(int base, ResponseBuilder rb) {
+ this.base = base;
+ this.rb = rb;
+ }
+
+ public void collect(int doc) throws IOException {
+ ++count;
+ leafDelegate.collect(doc);
+ }
+
+ public void finish() throws IOException {
+ NamedList analytics = new NamedList();
+ rb.rsp.add("analytics", analytics);
+ analytics.add("mycount", count+base);
+ if(this.delegate instanceof DelegatingCollector) {
+ ((DelegatingCollector)this.delegate).finish();
+ }
+ }
+ }
+
+ class TestAnalyticsMergeStrategy implements MergeStrategy {
+
+ public boolean mergesIds() {
+ return false;
+ }
+
+ public boolean handlesMergeFields() {
+ return false;
+ }
+
+ public int getCost() {
+ return 100;
+ }
+
+ public void handleMergeFields(ResponseBuilder rb, SolrIndexSearcher searcher) {
+ }
+
+ public void merge(ResponseBuilder rb, ShardRequest shardRequest) {
+ int count = 0;
+ NamedList merged = new NamedList();
+
+ for(ShardResponse shardResponse : shardRequest.responses) {
+ NamedList response = shardResponse.getSolrResponse().getResponse();
+ NamedList analytics = (NamedList)response.get("analytics");
+ Integer c = (Integer)analytics.get("mycount");
+ count += c.intValue();
+ }
+
+ merged.add("mycount", count);
+ rb.rsp.add("analytics", merged);
+ }
+ }
+
+ class TestIterative extends IterativeMergeStrategy {
+
+ public void process(ResponseBuilder rb, ShardRequest sreq) throws Exception {
+ int count = 0;
+ for(ShardResponse shardResponse : sreq.responses) {
+ NamedList response = shardResponse.getSolrResponse().getResponse();
+ NamedList analytics = (NamedList)response.get("analytics");
+ Integer c = (Integer)analytics.get("mycount");
+ count += c.intValue();
+ }
+
+ ModifiableSolrParams params = new ModifiableSolrParams();
+ params.add("distrib", "false");
+ params.add("fq","{!count base="+count+"}");
+ params.add("q","*:*");
+
+
+ /*
+ * Call back to all the shards in the response and process the result.
+ */
+
+ QueryRequest request = new QueryRequest(params);
+ List<Future<CallBack>> futures = callBack(sreq.responses, request);
+
+ int nextCount = 0;
+
+ for(Future<CallBack> future : futures) {
+ QueryResponse response = future.get().getResponse();
+ NamedList analytics = (NamedList)response.getResponse().get("analytics");
+ Integer c = (Integer)analytics.get("mycount");
+ nextCount += c.intValue();
+ }
+
+ NamedList merged = new NamedList();
+ merged.add("mycount", nextCount);
+ rb.rsp.add("analytics", merged);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/017b8a6e/solr/core/src/test/org/apache/solr/search/TestAnalyticsQParserPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestAnalyticsQParserPlugin.java b/solr/core/src/test/org/apache/solr/search/TestAnalyticsQParserPlugin.java
deleted file mode 100644
index 937fe9c..0000000
--- a/solr/core/src/test/org/apache/solr/search/TestAnalyticsQParserPlugin.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * 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.search;
-
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.util.LuceneTestCase.AwaitsFix;
-import org.apache.solr.client.solrj.request.QueryRequest;
-
-import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.common.params.ModifiableSolrParams;
-import org.apache.solr.common.params.SolrParams;
-import org.apache.solr.common.util.NamedList;
-import org.apache.solr.handler.component.IterativeMergeStrategy;
-import org.apache.solr.handler.component.ResponseBuilder;
-import org.apache.solr.handler.component.ShardRequest;
-import org.apache.solr.request.SolrQueryRequest;
-import org.apache.solr.handler.component.MergeStrategy;
-import org.apache.solr.handler.component.ShardResponse;
-
-import java.util.List;
-import java.util.concurrent.Future;
-import java.io.IOException;
-
-@AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/SOLR-10175")
-public class TestAnalyticsQParserPlugin extends QParserPlugin {
-
-
- public QParser createParser(String query, SolrParams localParams, SolrParams params, SolrQueryRequest req) {
- return new TestAnalyticsQueryParser(query, localParams, params, req);
- }
-
- class TestAnalyticsQueryParser extends QParser {
-
- public TestAnalyticsQueryParser(String query, SolrParams localParams, SolrParams params, SolrQueryRequest req) {
- super(query, localParams, params, req);
- }
-
- public Query parse() throws SyntaxError {
- int base = localParams.getInt("base", 0);
- boolean iterate = localParams.getBool("iterate", false);
- if(iterate)
- return new TestAnalyticsQuery(base, new TestIterative());
- else
- return new TestAnalyticsQuery(base, new TestAnalyticsMergeStrategy());
- }
- }
-
- class TestAnalyticsQuery extends AnalyticsQuery {
-
- private int base;
-
- public TestAnalyticsQuery(int base, MergeStrategy mergeStrategy) {
- super(mergeStrategy);
- this.base = base;
- }
-
- public DelegatingCollector getAnalyticsCollector(ResponseBuilder rb, IndexSearcher searcher) {
- return new TestAnalyticsCollector(base, rb);
- }
- }
-
- class TestAnalyticsCollector extends DelegatingCollector {
- ResponseBuilder rb;
- int count;
- int base;
-
- public TestAnalyticsCollector(int base, ResponseBuilder rb) {
- this.base = base;
- this.rb = rb;
- }
-
- public void collect(int doc) throws IOException {
- ++count;
- leafDelegate.collect(doc);
- }
-
- public void finish() throws IOException {
- NamedList analytics = new NamedList();
- rb.rsp.add("analytics", analytics);
- analytics.add("mycount", count+base);
- if(this.delegate instanceof DelegatingCollector) {
- ((DelegatingCollector)this.delegate).finish();
- }
- }
- }
-
- class TestAnalyticsMergeStrategy implements MergeStrategy {
-
- public boolean mergesIds() {
- return false;
- }
-
- public boolean handlesMergeFields() {
- return false;
- }
-
- public int getCost() {
- return 100;
- }
-
- public void handleMergeFields(ResponseBuilder rb, SolrIndexSearcher searcher) {
- }
-
- public void merge(ResponseBuilder rb, ShardRequest shardRequest) {
- int count = 0;
- NamedList merged = new NamedList();
-
- for(ShardResponse shardResponse : shardRequest.responses) {
- NamedList response = shardResponse.getSolrResponse().getResponse();
- NamedList analytics = (NamedList)response.get("analytics");
- Integer c = (Integer)analytics.get("mycount");
- count += c.intValue();
- }
-
- merged.add("mycount", count);
- rb.rsp.add("analytics", merged);
- }
- }
-
- class TestIterative extends IterativeMergeStrategy {
-
- public void process(ResponseBuilder rb, ShardRequest sreq) throws Exception {
- int count = 0;
- for(ShardResponse shardResponse : sreq.responses) {
- NamedList response = shardResponse.getSolrResponse().getResponse();
- NamedList analytics = (NamedList)response.get("analytics");
- Integer c = (Integer)analytics.get("mycount");
- count += c.intValue();
- }
-
- ModifiableSolrParams params = new ModifiableSolrParams();
- params.add("distrib", "false");
- params.add("fq","{!count base="+count+"}");
- params.add("q","*:*");
-
-
- /*
- * Call back to all the shards in the response and process the result.
- */
-
- QueryRequest request = new QueryRequest(params);
- List<Future<CallBack>> futures = callBack(sreq.responses, request);
-
- int nextCount = 0;
-
- for(Future<CallBack> future : futures) {
- QueryResponse response = future.get().getResponse();
- NamedList analytics = (NamedList)response.getResponse().get("analytics");
- Integer c = (Integer)analytics.get("mycount");
- nextCount += c.intValue();
- }
-
- NamedList merged = new NamedList();
- merged.add("mycount", nextCount);
- rb.rsp.add("analytics", merged);
- }
- }
-}