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 2016/09/23 12:43:56 UTC
[1/3] lucene-solr:master: SOLR-9543: reduce code duplication in
ReRankQParserPlugin.ReRankCollector.topDocs (part 1 of 2)
Repository: lucene-solr
Updated Branches:
refs/heads/master 3eb0f7c79 -> ef5da9705
SOLR-9543: reduce code duplication in ReRankQParserPlugin.ReRankCollector.topDocs (part 1 of 2)
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/a9eb64e4
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/a9eb64e4
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/a9eb64e4
Branch: refs/heads/master
Commit: a9eb64e427a640f64d582ccac86b759a1e8aa928
Parents: 0abf032
Author: Christine Poerschke <cp...@apache.org>
Authored: Thu Sep 22 18:23:29 2016 +0100
Committer: Christine Poerschke <cp...@apache.org>
Committed: Fri Sep 23 13:41:36 2016 +0100
----------------------------------------------------------------------
.../apache/solr/search/ReRankQParserPlugin.java | 44 ++++++--------------
1 file changed, 12 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/a9eb64e4/solr/core/src/java/org/apache/solr/search/ReRankQParserPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/ReRankQParserPlugin.java b/solr/core/src/java/org/apache/solr/search/ReRankQParserPlugin.java
index 2c462a0..e4f00ee 100644
--- a/solr/core/src/java/org/apache/solr/search/ReRankQParserPlugin.java
+++ b/solr/core/src/java/org/apache/solr/search/ReRankQParserPlugin.java
@@ -246,6 +246,18 @@ public class ReRankQParserPlugin extends QParserPlugin {
return mainDocs;
}
+ ScoreDoc[] mainScoreDocs = mainDocs.scoreDocs;
+ ScoreDoc[] reRankScoreDocs = new ScoreDoc[Math.min(mainScoreDocs.length, reRankDocs)];
+ System.arraycopy(mainScoreDocs, 0, reRankScoreDocs, 0, reRankScoreDocs.length);
+
+ mainDocs.scoreDocs = reRankScoreDocs;
+
+ TopDocs rescoredDocs = reRankQueryRescorer
+ .rescore(searcher, mainDocs, mainDocs.scoreDocs.length);
+
+ //Lower howMany to return if we've collected fewer documents.
+ howMany = Math.min(howMany, mainScoreDocs.length);
+
if(boostedPriority != null) {
SolrRequestInfo info = SolrRequestInfo.getRequestInfo();
Map requestContext = null;
@@ -255,20 +267,8 @@ public class ReRankQParserPlugin extends QParserPlugin {
IntIntHashMap boostedDocs = QueryElevationComponent.getBoostDocs((SolrIndexSearcher)searcher, boostedPriority, requestContext);
- ScoreDoc[] mainScoreDocs = mainDocs.scoreDocs;
- ScoreDoc[] reRankScoreDocs = new ScoreDoc[Math.min(mainScoreDocs.length, reRankDocs)];
- System.arraycopy(mainScoreDocs,0,reRankScoreDocs,0,reRankScoreDocs.length);
-
- mainDocs.scoreDocs = reRankScoreDocs;
-
- TopDocs rescoredDocs = reRankQueryRescorer
- .rescore(searcher, mainDocs, mainDocs.scoreDocs.length);
-
Arrays.sort(rescoredDocs.scoreDocs, new BoostedComp(boostedDocs, mainDocs.scoreDocs, rescoredDocs.getMaxScore()));
- //Lower howMany if we've collected fewer documents.
- howMany = Math.min(howMany, mainScoreDocs.length);
-
if(howMany == rescoredDocs.scoreDocs.length) {
return rescoredDocs; // Just return the rescoredDocs
} else if(howMany > rescoredDocs.scoreDocs.length) {
@@ -288,26 +288,6 @@ public class ReRankQParserPlugin extends QParserPlugin {
} else {
- ScoreDoc[] mainScoreDocs = mainDocs.scoreDocs;
-
- /*
- * Create the array for the reRankScoreDocs.
- */
- ScoreDoc[] reRankScoreDocs = new ScoreDoc[Math.min(mainScoreDocs.length, reRankDocs)];
-
- /*
- * Copy the initial results into the reRankScoreDocs array.
- */
- System.arraycopy(mainScoreDocs, 0, reRankScoreDocs, 0, reRankScoreDocs.length);
-
- mainDocs.scoreDocs = reRankScoreDocs;
-
- TopDocs rescoredDocs = reRankQueryRescorer
- .rescore(searcher, mainDocs, mainDocs.scoreDocs.length);
-
- //Lower howMany to return if we've collected fewer documents.
- howMany = Math.min(howMany, mainScoreDocs.length);
-
if(howMany == rescoredDocs.scoreDocs.length) {
return rescoredDocs; // Just return the rescoredDocs
} else if(howMany > rescoredDocs.scoreDocs.length) {
[3/3] lucene-solr:master: SOLR-9551: Add JSONWriter constructor
variant, JSONWriterTest.testConstantsUnchanged test. (Jonny Marks,
Christine Poerschke)
Posted by cp...@apache.org.
SOLR-9551: Add JSONWriter constructor variant, JSONWriterTest.testConstantsUnchanged test. (Jonny Marks, Christine Poerschke)
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/ef5da970
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/ef5da970
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/ef5da970
Branch: refs/heads/master
Commit: ef5da9705d99561f5dda7cdbed0b6f5b5ebf66d4
Parents: a9eb64e
Author: Christine Poerschke <cp...@apache.org>
Authored: Fri Sep 23 11:09:58 2016 +0100
Committer: Christine Poerschke <cp...@apache.org>
Committed: Fri Sep 23 13:42:54 2016 +0100
----------------------------------------------------------------------
solr/CHANGES.txt | 3 +++
.../solr/response/JSONResponseWriter.java | 25 +++++++++++++-------
.../apache/solr/response/JSONWriterTest.java | 10 ++++++++
3 files changed, 29 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ef5da970/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 662f6dd..242052a 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -180,6 +180,9 @@ Other Changes
* SOLR-6090: Remove unreachable printLayout usage in cloud tests. (Cao Manh Dat via shalin)
+* SOLR-9551: Add JSONWriter constructor variant, JSONWriterTest.testConstantsUnchanged test.
+ (Jonny Marks, Christine Poerschke)
+
================== 6.2.1 ==================
Bug Fixes
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ef5da970/solr/core/src/java/org/apache/solr/response/JSONResponseWriter.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/response/JSONResponseWriter.java b/solr/core/src/java/org/apache/solr/response/JSONResponseWriter.java
index cd8d07c..522030f 100644
--- a/solr/core/src/java/org/apache/solr/response/JSONResponseWriter.java
+++ b/solr/core/src/java/org/apache/solr/response/JSONResponseWriter.java
@@ -66,19 +66,26 @@ public class JSONResponseWriter implements QueryResponseWriter {
class JSONWriter extends TextResponseWriter {
protected String wrapperFunction;
- private String namedListStyle;
+ final private String namedListStyle;
- private static final String JSON_NL_STYLE="json.nl";
- private static final String JSON_NL_MAP="map";
- private static final String JSON_NL_FLAT="flat";
- private static final String JSON_NL_ARROFARR="arrarr";
- private static final String JSON_NL_ARROFMAP="arrmap";
- private static final String JSON_WRAPPER_FUNCTION="json.wrf";
+ static final String JSON_NL_STYLE="json.nl";
+ static final String JSON_NL_MAP="map";
+ static final String JSON_NL_FLAT="flat";
+ static final String JSON_NL_ARROFARR="arrarr";
+ static final String JSON_NL_ARROFMAP="arrmap";
+ static final String JSON_WRAPPER_FUNCTION="json.wrf";
public JSONWriter(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp) {
+ this(writer, req, rsp,
+ req.getParams().get(JSON_WRAPPER_FUNCTION),
+ req.getParams().get(JSON_NL_STYLE, JSON_NL_FLAT).intern());
+ }
+
+ public JSONWriter(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp,
+ String wrapperFunction, String namedListStyle) {
super(writer, req, rsp);
- namedListStyle = req.getParams().get(JSON_NL_STYLE, JSON_NL_FLAT).intern();
- wrapperFunction = req.getParams().get(JSON_WRAPPER_FUNCTION);
+ this.wrapperFunction = wrapperFunction;
+ this.namedListStyle = namedListStyle;
}
public void writeResponse() throws IOException {
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ef5da970/solr/core/src/test/org/apache/solr/response/JSONWriterTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/response/JSONWriterTest.java b/solr/core/src/test/org/apache/solr/response/JSONWriterTest.java
index 59de096..ad390cb 100644
--- a/solr/core/src/test/org/apache/solr/response/JSONWriterTest.java
+++ b/solr/core/src/test/org/apache/solr/response/JSONWriterTest.java
@@ -131,4 +131,14 @@ public class JSONWriterTest extends SolrTestCaseJ4 {
req.close();
}
+ @Test
+ public void testConstantsUnchanged() {
+ assertEquals("json.nl", JSONWriter.JSON_NL_STYLE);
+ assertEquals("map", JSONWriter.JSON_NL_MAP);
+ assertEquals("flat", JSONWriter.JSON_NL_FLAT);
+ assertEquals("arrarr", JSONWriter.JSON_NL_ARROFARR);
+ assertEquals("arrmap", JSONWriter.JSON_NL_ARROFMAP);
+ assertEquals("json.wrf", JSONWriter.JSON_WRAPPER_FUNCTION);
+ }
+
}
[2/3] lucene-solr:master: LUCENE-7454: unusedPrivateMember removal
(DefaultIndexingChain) and tweak (PointInSetQuery)
Posted by cp...@apache.org.
LUCENE-7454: unusedPrivateMember removal (DefaultIndexingChain) and tweak (PointInSetQuery)
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/0abf0321
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/0abf0321
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/0abf0321
Branch: refs/heads/master
Commit: 0abf0321585293279d76afc9467265683e1ac53c
Parents: 3eb0f7c
Author: Christine Poerschke <cp...@apache.org>
Authored: Thu Sep 22 18:21:38 2016 +0100
Committer: Christine Poerschke <cp...@apache.org>
Committed: Fri Sep 23 13:41:36 2016 +0100
----------------------------------------------------------------------
.../src/java/org/apache/lucene/index/DefaultIndexingChain.java | 2 --
lucene/core/src/java/org/apache/lucene/search/PointInSetQuery.java | 2 +-
2 files changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0abf0321/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java b/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java
index 58ad981..55cdbf3 100644
--- a/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java
+++ b/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java
@@ -641,8 +641,6 @@ final class DefaultIndexingChain extends DocConsumer {
// reused
TokenStream tokenStream;
- IndexOptions indexOptions;
-
public PerField(FieldInfo fieldInfo, boolean invert) {
this.fieldInfo = fieldInfo;
similarity = docState.similarity;
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0abf0321/lucene/core/src/java/org/apache/lucene/search/PointInSetQuery.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/search/PointInSetQuery.java b/lucene/core/src/java/org/apache/lucene/search/PointInSetQuery.java
index 34b6ed8..d41b91c 100644
--- a/lucene/core/src/java/org/apache/lucene/search/PointInSetQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/search/PointInSetQuery.java
@@ -172,7 +172,7 @@ public abstract class PointInSetQuery extends Query {
this.result = result;
this.sortedPackedPoints = sortedPackedPoints;
scratch.length = bytesPerDim;
- this.iterator = sortedPackedPoints.iterator();
+ this.iterator = this.sortedPackedPoints.iterator();
nextQueryPoint = iterator.next();
}