You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2014/04/04 12:27:14 UTC
svn commit: r1584603 [10/12] - in /lucene/dev/branches/solr5914: ./
dev-tools/ dev-tools/idea/solr/core/src/test/ lucene/ lucene/analysis/
lucene/analysis/common/
lucene/analysis/common/src/java/org/apache/lucene/analysis/br/
lucene/analysis/common/src...
Modified: lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/schema/TextField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/schema/TextField.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/schema/TextField.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/schema/TextField.java Fri Apr 4 10:27:05 2014
@@ -23,9 +23,7 @@ import org.apache.lucene.index.StorableF
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.util.BytesRef;
-import org.apache.lucene.util.CharsRef;
import org.apache.lucene.util.QueryBuilder;
-import org.apache.lucene.util.UnicodeUtil;
import org.apache.solr.common.SolrException;
import org.apache.solr.response.TextResponseWriter;
import org.apache.solr.search.QParser;
@@ -170,22 +168,11 @@ public class TextField extends FieldType
@Override
public Object marshalSortValue(Object value) {
- if (null == value) {
- return null;
- }
- CharsRef spare = new CharsRef();
- UnicodeUtil.UTF8toUTF16((BytesRef)value, spare);
- return spare.toString();
+ return marshalStringSortValue(value);
}
@Override
public Object unmarshalSortValue(Object value) {
- if (null == value) {
- return null;
- }
- BytesRef spare = new BytesRef();
- String stringVal = (String)value;
- UnicodeUtil.UTF16toUTF8(stringVal, 0, stringVal.length(), spare);
- return spare;
+ return unmarshalStringSortValue(value);
}
}
Modified: lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/schema/TrieDateField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/schema/TrieDateField.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/schema/TrieDateField.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/schema/TrieDateField.java Fri Apr 4 10:27:05 2014
@@ -84,6 +84,16 @@ public class TrieDateField extends DateF
}
@Override
+ public Object marshalSortValue(Object value) {
+ return value;
+ }
+
+ @Override
+ public Object unmarshalSortValue(Object value) {
+ return value;
+ }
+
+ @Override
public ValueSource getValueSource(SchemaField field, QParser parser) {
return wrappedField.getValueSource(field, parser);
}
Modified: lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java Fri Apr 4 10:27:05 2014
@@ -443,6 +443,7 @@ public class CollapsingQParserPlugin ext
private int nullDoc;
private FloatArrayList nullScores;
private IntOpenHashSet boostDocs;
+ private int[] boostOrds;
public CollapsingScoreCollector(int maxDoc,
int segments,
@@ -455,11 +456,19 @@ public class CollapsingQParserPlugin ext
this.boostDocs = boostDocs;
if(this.boostDocs != null) {
//Set the elevated docs now.
+ IntOpenHashSet boostG = new IntOpenHashSet();
Iterator<IntCursor> it = this.boostDocs.iterator();
while(it.hasNext()) {
IntCursor cursor = it.next();
- this.collapsedSet.set(cursor.value);
+ int i = cursor.value;
+ this.collapsedSet.set(i);
+ int ord = values.getOrd(i);
+ if(ord > -1) {
+ boostG.add(ord);
+ }
}
+ boostOrds = boostG.toArray();
+ Arrays.sort(boostOrds);
}
this.values = values;
int valueCount = values.getValueCount();
@@ -489,6 +498,7 @@ public class CollapsingQParserPlugin ext
public void collect(int docId) throws IOException {
int globalDoc = docId+this.docBase;
int ord = values.getOrd(globalDoc);
+
if(ord > -1) {
float score = scorer.score();
if(score > scores[ord]) {
@@ -520,6 +530,12 @@ public class CollapsingQParserPlugin ext
this.collapsedSet.set(nullDoc);
}
+ if(this.boostOrds != null) {
+ for(int i=0; i<this.boostOrds.length; i++) {
+ ords[boostOrds[i]] = -1;
+ }
+ }
+
for(int i=0; i<ords.length; i++) {
int doc = ords[i];
if(doc > -1) {
@@ -539,6 +555,7 @@ public class CollapsingQParserPlugin ext
while((docId = it.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
int ord = values.getOrd(docId);
+
if(ord > -1) {
dummy.score = scores[ord];
} else if(this.boostDocs != null && boostDocs.contains(docId)) {
@@ -600,14 +617,14 @@ public class CollapsingQParserPlugin ext
this.needsScores = needsScores;
this.boostDocs = boostDocs;
if(funcQuery != null) {
- this.fieldValueCollapse = new ValueSourceCollapse(maxDoc, field, nullPolicy, new int[valueCount], max, this.needsScores, boostDocs, funcQuery, searcher);
+ this.fieldValueCollapse = new ValueSourceCollapse(maxDoc, field, nullPolicy, new int[valueCount], max, this.needsScores, boostDocs, funcQuery, searcher, values);
} else {
if(fieldType instanceof TrieIntField) {
- this.fieldValueCollapse = new IntValueCollapse(maxDoc, field, nullPolicy, new int[valueCount], max, this.needsScores, boostDocs);
+ this.fieldValueCollapse = new IntValueCollapse(maxDoc, field, nullPolicy, new int[valueCount], max, this.needsScores, boostDocs, values);
} else if(fieldType instanceof TrieLongField) {
- this.fieldValueCollapse = new LongValueCollapse(maxDoc, field, nullPolicy, new int[valueCount], max, this.needsScores, boostDocs);
+ this.fieldValueCollapse = new LongValueCollapse(maxDoc, field, nullPolicy, new int[valueCount], max, this.needsScores, boostDocs, values);
} else if(fieldType instanceof TrieFloatField) {
- this.fieldValueCollapse = new FloatValueCollapse(maxDoc, field, nullPolicy, new int[valueCount], max, this.needsScores, boostDocs);
+ this.fieldValueCollapse = new FloatValueCollapse(maxDoc, field, nullPolicy, new int[valueCount], max, this.needsScores, boostDocs, values);
} else {
throw new IOException("min/max must be either TrieInt, TrieLong or TrieFloat.");
}
@@ -696,6 +713,7 @@ public class CollapsingQParserPlugin ext
protected float[] scores;
protected FixedBitSet collapsedSet;
protected IntOpenHashSet boostDocs;
+ protected int[] boostOrds;
protected int nullDoc = -1;
protected boolean needsScores;
protected boolean max;
@@ -709,7 +727,8 @@ public class CollapsingQParserPlugin ext
int nullPolicy,
boolean max,
boolean needsScores,
- IntOpenHashSet boostDocs) {
+ IntOpenHashSet boostDocs,
+ SortedDocValues values) {
this.field = field;
this.nullPolicy = nullPolicy;
this.max = max;
@@ -717,11 +736,19 @@ public class CollapsingQParserPlugin ext
this.collapsedSet = new FixedBitSet(maxDoc);
this.boostDocs = boostDocs;
if(this.boostDocs != null) {
+ IntOpenHashSet boostG = new IntOpenHashSet();
Iterator<IntCursor> it = boostDocs.iterator();
while(it.hasNext()) {
IntCursor cursor = it.next();
- this.collapsedSet.set(cursor.value);
+ int i = cursor.value;
+ this.collapsedSet.set(i);
+ int ord = values.getOrd(i);
+ if(ord > -1) {
+ boostG.add(ord);
+ }
}
+ this.boostOrds = boostG.toArray();
+ Arrays.sort(this.boostOrds);
}
}
@@ -730,6 +757,12 @@ public class CollapsingQParserPlugin ext
this.collapsedSet.set(nullDoc);
}
+ if(this.boostOrds != null) {
+ for(int i=0; i<this.boostOrds.length; i++) {
+ ords[boostOrds[i]] = -1;
+ }
+ }
+
for(int i=0; i<ords.length; i++) {
int doc = ords[i];
if(doc > -1) {
@@ -770,8 +803,8 @@ public class CollapsingQParserPlugin ext
int[] ords,
boolean max,
boolean needsScores,
- IntOpenHashSet boostDocs) throws IOException {
- super(maxDoc, field, nullPolicy, max, needsScores, boostDocs);
+ IntOpenHashSet boostDocs, SortedDocValues values) throws IOException {
+ super(maxDoc, field, nullPolicy, max, needsScores, boostDocs, values);
this.ords = ords;
this.ordVals = new int[ords.length];
Arrays.fill(ords, -1);
@@ -838,8 +871,8 @@ public class CollapsingQParserPlugin ext
int[] ords,
boolean max,
boolean needsScores,
- IntOpenHashSet boostDocs) throws IOException {
- super(maxDoc, field, nullPolicy, max, needsScores, boostDocs);
+ IntOpenHashSet boostDocs, SortedDocValues values) throws IOException {
+ super(maxDoc, field, nullPolicy, max, needsScores, boostDocs, values);
this.ords = ords;
this.ordVals = new long[ords.length];
Arrays.fill(ords, -1);
@@ -907,8 +940,8 @@ public class CollapsingQParserPlugin ext
int[] ords,
boolean max,
boolean needsScores,
- IntOpenHashSet boostDocs) throws IOException {
- super(maxDoc, field, nullPolicy, max, needsScores, boostDocs);
+ IntOpenHashSet boostDocs, SortedDocValues values) throws IOException {
+ super(maxDoc, field, nullPolicy, max, needsScores, boostDocs, values);
this.ords = ords;
this.ordVals = new float[ords.length];
Arrays.fill(ords, -1);
@@ -982,8 +1015,8 @@ public class CollapsingQParserPlugin ext
boolean max,
boolean needsScores,
IntOpenHashSet boostDocs,
- FunctionQuery funcQuery, IndexSearcher searcher) throws IOException {
- super(maxDoc, null, nullPolicy, max, needsScores, boostDocs);
+ FunctionQuery funcQuery, IndexSearcher searcher, SortedDocValues values) throws IOException {
+ super(maxDoc, null, nullPolicy, max, needsScores, boostDocs, values);
this.valueSource = funcQuery.getValueSource();
this.rcontext = ValueSource.newContext(searcher);
this.ords = ords;
Modified: lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java Fri Apr 4 10:27:05 2014
@@ -22,7 +22,6 @@ import org.apache.lucene.queries.functio
import org.apache.lucene.queries.function.docvalues.FloatDocValues;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.util.BytesRef;
-import org.apache.lucene.util.IOUtils;
import org.apache.solr.core.SolrCore;
import org.apache.solr.handler.RequestHandlerBase;
import org.apache.solr.handler.RequestHandlerUtils;
@@ -39,6 +38,7 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
import java.util.*;
/**
@@ -252,7 +252,7 @@ public class FileFloatSource extends Val
return vals;
}
- BufferedReader r = new BufferedReader(new InputStreamReader(is, IOUtils.CHARSET_UTF_8));
+ BufferedReader r = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
String idName = ffs.keyField.getName();
FieldType idType = ffs.keyField.getType();
Modified: lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/servlet/LoadAdminUiServlet.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/servlet/LoadAdminUiServlet.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/servlet/LoadAdminUiServlet.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/servlet/LoadAdminUiServlet.java Fri Apr 4 10:27:05 2014
@@ -21,8 +21,8 @@ import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
+import java.nio.charset.StandardCharsets;
-import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -37,7 +37,7 @@ import org.apache.solr.core.SolrCore;
*
* @since solr 4.0
*/
-public final class LoadAdminUiServlet extends HttpServlet {
+public final class LoadAdminUiServlet extends BaseSolrServlet {
@Override
public void doGet(HttpServletRequest request,
@@ -51,7 +51,7 @@ public final class LoadAdminUiServlet ex
try {
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html");
- Writer out = new OutputStreamWriter(response.getOutputStream(), "UTF-8");
+ Writer out = new OutputStreamWriter(response.getOutputStream(), StandardCharsets.UTF_8);
String html = IOUtils.toString(in, "UTF-8");
Package pack = SolrCore.class.getPackage();
Modified: lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/servlet/RedirectServlet.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/servlet/RedirectServlet.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/servlet/RedirectServlet.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/servlet/RedirectServlet.java Fri Apr 4 10:27:05 2014
@@ -21,14 +21,13 @@ import java.io.IOException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* A Simple redirection servlet to help us deprecate old UI elements
*/
-public class RedirectServlet extends HttpServlet{
+public class RedirectServlet extends BaseSolrServlet {
static final String CONTEXT_KEY = "${context}";
Modified: lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java Fri Apr 4 10:27:05 2014
@@ -73,7 +73,6 @@ import org.apache.solr.util.FastWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
@@ -81,6 +80,7 @@ import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -89,6 +89,7 @@ import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.URL;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -105,13 +106,12 @@ import java.util.Set;
*
* @since solr 1.2
*/
-public class SolrDispatchFilter implements Filter
-{
+public class SolrDispatchFilter extends BaseSolrFilter {
private static final String CONNECTION_HEADER = "Connection";
private static final String TRANSFER_ENCODING_HEADER = "Transfer-Encoding";
private static final String CONTENT_LENGTH_HEADER = "Content-Length";
- final Logger log;
+ static final Logger log = LoggerFactory.getLogger(SolrDispatchFilter.class);
protected volatile CoreContainer cores;
@@ -119,19 +119,9 @@ public class SolrDispatchFilter implemen
protected String abortErrorMessage = null;
protected final HttpClient httpClient = HttpClientUtil.createClient(new ModifiableSolrParams());
- private static final Charset UTF8 = Charset.forName("UTF-8");
+ private static final Charset UTF8 = StandardCharsets.UTF_8;
public SolrDispatchFilter() {
- try {
- log = LoggerFactory.getLogger(SolrDispatchFilter.class);
- } catch (NoClassDefFoundError e) {
- throw new SolrException(
- ErrorCode.SERVER_ERROR,
- "Could not find necessary SLF4j logging jars. If using Jetty, the SLF4j logging jars need to go in "
- +"the jetty lib/ext directory. For other containers, the corresponding directory should be used. "
- +"For more information, see: http://wiki.apache.org/solr/SolrLogging",
- e);
- }
}
@Override
@@ -765,7 +755,7 @@ public class SolrDispatchFilter implemen
binWriter.write(response.getOutputStream(), solrReq, solrRsp);
} else {
String charset = ContentStreamBase.getCharsetFromContentType(ct);
- Writer out = (charset == null || charset.equalsIgnoreCase("UTF-8"))
+ Writer out = (charset == null)
? new OutputStreamWriter(response.getOutputStream(), UTF8)
: new OutputStreamWriter(response.getOutputStream(), charset);
out = new FastWriter(out);
Modified: lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java Fri Apr 4 10:27:05 2014
@@ -27,6 +27,7 @@ import java.nio.charset.CharacterCodingE
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CodingErrorAction;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -244,7 +245,7 @@ public class SolrRequestParsers
}
}
};
- parseFormDataContent(in, Long.MAX_VALUE, IOUtils.CHARSET_UTF_8, map, true);
+ parseFormDataContent(in, Long.MAX_VALUE, StandardCharsets.UTF_8, map, true);
} catch (IOException ioe) {
throw new SolrException(ErrorCode.BAD_REQUEST, ioe);
}
@@ -598,7 +599,7 @@ public class SolrRequestParsers
// get query String from request body, using the charset given in content-type:
final String cs = ContentStreamBase.getCharsetFromContentType(req.getContentType());
- final Charset charset = (cs == null) ? IOUtils.CHARSET_UTF_8 : Charset.forName(cs);
+ final Charset charset = (cs == null) ? StandardCharsets.UTF_8 : Charset.forName(cs);
InputStream in = null;
try {
in = req.getInputStream();
Modified: lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/servlet/ZookeeperInfoServlet.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/servlet/ZookeeperInfoServlet.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/servlet/ZookeeperInfoServlet.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/servlet/ZookeeperInfoServlet.java Fri Apr 4 10:27:05 2014
@@ -18,22 +18,18 @@
package org.apache.solr.servlet;
import java.io.IOException;
-import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.List;
import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.lucene.util.BytesRef;
-import org.apache.lucene.util.IOUtils;
-import org.noggit.CharArr;
-import org.noggit.JSONWriter;
import org.apache.solr.cloud.ZkController;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.cloud.SolrZkClient;
@@ -42,6 +38,8 @@ import org.apache.solr.core.CoreContaine
import org.apache.solr.util.FastWriter;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.data.Stat;
+import org.noggit.CharArr;
+import org.noggit.JSONWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,7 +49,7 @@ import org.slf4j.LoggerFactory;
*
* @since solr 4.0
*/
-public final class ZookeeperInfoServlet extends HttpServlet {
+public final class ZookeeperInfoServlet extends BaseSolrServlet {
static final Logger log = LoggerFactory.getLogger(ZookeeperInfoServlet.class);
@Override
@@ -96,7 +94,7 @@ public final class ZookeeperInfoServlet
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json");
- Writer out = new FastWriter(new OutputStreamWriter(response.getOutputStream(), IOUtils.CHARSET_UTF_8));
+ Writer out = new FastWriter(new OutputStreamWriter(response.getOutputStream(), StandardCharsets.UTF_8));
ZKPrinter printer = new ZKPrinter(response, out, cores.getZkController(), addr);
printer.detail = detail;
Modified: lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/spelling/suggest/FileDictionaryFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/spelling/suggest/FileDictionaryFactory.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/spelling/suggest/FileDictionaryFactory.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/spelling/suggest/FileDictionaryFactory.java Fri Apr 4 10:27:05 2014
@@ -19,10 +19,10 @@ package org.apache.solr.spelling.suggest
import java.io.IOException;
import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
import org.apache.lucene.search.spell.Dictionary;
import org.apache.lucene.search.suggest.FileDictionary;
-import org.apache.lucene.util.IOUtils;
import org.apache.solr.core.SolrCore;
import org.apache.solr.search.SolrIndexSearcher;
@@ -53,7 +53,7 @@ public class FileDictionaryFactory exten
try {
return new FileDictionary(new InputStreamReader(
- core.getResourceLoader().openResource(sourceLocation), IOUtils.CHARSET_UTF_8), fieldDelimiter);
+ core.getResourceLoader().openResource(sourceLocation), StandardCharsets.UTF_8), fieldDelimiter);
} catch (IOException e) {
throw new RuntimeException();
}
Modified: lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/spelling/suggest/Suggester.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/spelling/suggest/Suggester.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/spelling/suggest/Suggester.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/spelling/suggest/Suggester.java Fri Apr 4 10:27:05 2014
@@ -23,6 +23,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.List;
@@ -131,7 +132,7 @@ public class Suggester extends SolrSpell
} else {
try {
dictionary = new FileDictionary(new InputStreamReader(
- core.getResourceLoader().openResource(sourceLocation), IOUtils.CHARSET_UTF_8));
+ core.getResourceLoader().openResource(sourceLocation), StandardCharsets.UTF_8));
} catch (UnsupportedEncodingException e) {
// should not happen
LOG.error("should not happen", e);
Modified: lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/spelling/suggest/fst/FreeTextLookupFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/spelling/suggest/fst/FreeTextLookupFactory.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/spelling/suggest/fst/FreeTextLookupFactory.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/spelling/suggest/fst/FreeTextLookupFactory.java Fri Apr 4 10:27:05 2014
@@ -1,9 +1,10 @@
package org.apache.solr.spelling.suggest.fst;
+import java.nio.charset.StandardCharsets;
+
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.search.suggest.Lookup;
import org.apache.lucene.search.suggest.analyzing.FreeTextSuggester;
-import org.apache.lucene.util.IOUtils;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.core.SolrCore;
import org.apache.solr.schema.FieldType;
@@ -71,7 +72,7 @@ public class FreeTextLookupFactory exten
: FreeTextSuggester.DEFAULT_GRAMS;
byte separator = (params.get(SEPARATOR) != null)
- ? params.get(SEPARATOR).toString().getBytes(IOUtils.CHARSET_UTF_8)[0]
+ ? params.get(SEPARATOR).toString().getBytes(StandardCharsets.UTF_8)[0]
: FreeTextSuggester.DEFAULT_SEPARATOR;
return new FreeTextSuggester(indexAnalyzer, queryAnalyzer, grams, separator);
Modified: lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/store/blockcache/CachedIndexOutput.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/store/blockcache/CachedIndexOutput.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/store/blockcache/CachedIndexOutput.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/store/blockcache/CachedIndexOutput.java Fri Apr 4 10:27:05 2014
@@ -88,5 +88,10 @@ public class CachedIndexOutput extends R
offset += len;
}
}
-
+
+ @Override
+ public long getChecksum() throws IOException {
+ flush();
+ return dest.getChecksum();
+ }
}
Modified: lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/store/hdfs/NullIndexOutput.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/store/hdfs/NullIndexOutput.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/store/hdfs/NullIndexOutput.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/store/hdfs/NullIndexOutput.java Fri Apr 4 10:27:05 2014
@@ -66,5 +66,9 @@ public class NullIndexOutput extends Ind
length = pos;
}
}
-
+
+ @Override
+ public long getChecksum() throws IOException {
+ return 0; // we don't write anything.
+ }
}
Modified: lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java Fri Apr 4 10:27:05 2014
@@ -21,7 +21,6 @@ import java.io.IOException;
import java.net.ConnectException;
import java.util.ArrayList;
import java.util.List;
-
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpSolrServer;
@@ -206,7 +205,7 @@ public class SolrCmdDistributor {
void addCommit(UpdateRequest ureq, CommitUpdateCommand cmd) {
if (cmd == null) return;
ureq.setAction(cmd.optimize ? AbstractUpdateRequest.ACTION.OPTIMIZE
- : AbstractUpdateRequest.ACTION.COMMIT, false, cmd.waitSearcher, cmd.maxOptimizeSegments, cmd.softCommit, cmd.expungeDeletes);
+ : AbstractUpdateRequest.ACTION.COMMIT, false, cmd.waitSearcher, cmd.maxOptimizeSegments, cmd.softCommit, cmd.expungeDeletes, cmd.openSearcher);
}
private void submit(Req req) {
Modified: lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/update/processor/MD5Signature.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/update/processor/MD5Signature.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/update/processor/MD5Signature.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/update/processor/MD5Signature.java Fri Apr 4 10:27:05 2014
@@ -17,6 +17,7 @@ package org.apache.solr.update.processor
*/
import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@@ -44,13 +45,7 @@ public class MD5Signature extends Signat
@Override
public void add(String content) {
- try {
- digester.update(content.getBytes("UTF-8"));
- } catch (UnsupportedEncodingException e) {
- // won't happen
- log.error("UTF-8 not supported", e);
- throw new RuntimeException(e);
- }
+ digester.update(content.getBytes(StandardCharsets.UTF_8));
}
@Override
Modified: lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/update/processor/RegexpBoostProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/update/processor/RegexpBoostProcessor.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/update/processor/RegexpBoostProcessor.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/update/processor/RegexpBoostProcessor.java Fri Apr 4 10:27:05 2014
@@ -21,18 +21,18 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
-import org.apache.commons.io.IOUtils;
+import org.apache.commons.io.IOUtils;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.update.AddUpdateCommand;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -121,7 +121,7 @@ public class RegexpBoostProcessor extend
private List<BoostEntry> initBoostEntries(InputStream is) throws IOException {
List<BoostEntry> newBoostEntries = new ArrayList<>();
- BufferedReader reader = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
+ BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
try {
String line = null;
while ((line = reader.readLine()) != null) {
Modified: lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/update/processor/StatelessScriptUpdateProcessorFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/update/processor/StatelessScriptUpdateProcessorFactory.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/update/processor/StatelessScriptUpdateProcessorFactory.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/update/processor/StatelessScriptUpdateProcessorFactory.java Fri Apr 4 10:27:05 2014
@@ -27,7 +27,6 @@ import org.apache.solr.request.LocalSolr
import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.update.*;
import org.apache.solr.util.plugin.SolrCoreAware;
-
import org.apache.commons.lang.StringUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.FilenameUtils;
@@ -41,6 +40,7 @@ import javax.script.ScriptException;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
+import java.nio.charset.StandardCharsets;
import java.util.Set;
import java.util.LinkedHashSet;
import java.util.ArrayList;
@@ -494,7 +494,7 @@ public class StatelessScriptUpdateProces
public Reader openReader(SolrResourceLoader resourceLoader) throws IOException {
InputStream input = resourceLoader.openResource(fileName);
return org.apache.lucene.util.IOUtils.getDecodingReader
- (input, org.apache.lucene.util.IOUtils.CHARSET_UTF_8);
+ (input, StandardCharsets.UTF_8);
}
}
}
Modified: lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/util/SimplePostTool.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/util/SimplePostTool.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/util/SimplePostTool.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/java/org/apache/solr/util/SimplePostTool.java Fri Apr 4 10:27:05 2014
@@ -18,37 +18,37 @@ package org.apache.solr.util;
*/
import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.ByteArrayInputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.ProtocolException;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
-import java.util.HashSet;
import java.util.TimeZone;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import java.util.zip.GZIPInputStream;
import java.util.zip.Inflater;
import java.util.zip.InflaterInputStream;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.ProtocolException;
-import java.net.URL;
-import java.net.URLEncoder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -893,13 +893,7 @@ public class SimplePostTool {
* @return the input stream
*/
public static InputStream stringToStream(String s) {
- InputStream is = null;
- try {
- is = new ByteArrayInputStream(s.getBytes("UTF-8"));
- } catch (UnsupportedEncodingException e) {
- fatal("Shouldn't happen: UTF-8 not supported?!?!?!");
- }
- return is;
+ return new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8));
}
/**
@@ -961,10 +955,9 @@ public class SimplePostTool {
/**
* Takes a string as input and returns a DOM
*/
- public static Document makeDom(String in, String inputEncoding) throws SAXException, IOException,
+ public static Document makeDom(byte[] in) throws SAXException, IOException,
ParserConfigurationException {
- InputStream is = new ByteArrayInputStream(in
- .getBytes(inputEncoding));
+ InputStream is = new ByteArrayInputStream(in);
Document dom = DocumentBuilderFactory.newInstance()
.newDocumentBuilder().parse(is);
return dom;
@@ -1105,7 +1098,7 @@ public class SimplePostTool {
*/
protected List<String> parseRobotsTxt(InputStream is) throws IOException {
List<String> disallows = new ArrayList<>();
- BufferedReader r = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+ BufferedReader r = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
String l;
while((l = r.readLine()) != null) {
String[] arr = l.split("#");
@@ -1137,10 +1130,9 @@ public class SimplePostTool {
URL extractUrl = new URL(appendParam(postUrl.toString(), "extractOnly=true"));
boolean success = postData(is, null, os, type, extractUrl);
if(success) {
- String rawXml = os.toString("UTF-8");
- Document d = makeDom(rawXml, "UTF-8");
+ Document d = makeDom(os.toByteArray());
String innerXml = getXP(d, "/response/str/text()[1]", false);
- d = makeDom(innerXml, "UTF-8");
+ d = makeDom(innerXml.getBytes(StandardCharsets.UTF_8));
NodeList links = getNodesFromXP(d, "/html/body//a/@href");
for(int i = 0; i < links.getLength(); i++) {
String link = links.item(i).getTextContent();
Modified: lucene/dev/branches/solr5914/solr/core/src/test-files/solr/collection1/conf/schema-rest.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test-files/solr/collection1/conf/schema-rest.xml?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test-files/solr/collection1/conf/schema-rest.xml (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test-files/solr/collection1/conf/schema-rest.xml Fri Apr 4 10:27:05 2014
@@ -457,6 +457,7 @@
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.ManagedStopFilterFactory" managed="english" />
+ <filter class="solr.ManagedSynonymFilterFactory" managed="english" />
</analyzer>
</fieldtype>
Modified: lucene/dev/branches/solr5914/solr/core/src/test-files/solr/collection1/conf/schema-sorts.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test-files/solr/collection1/conf/schema-sorts.xml?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test-files/solr/collection1/conf/schema-sorts.xml (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test-files/solr/collection1/conf/schema-sorts.xml Fri Apr 4 10:27:05 2014
@@ -71,6 +71,94 @@ NOTE: Tests expect every field in this s
<field name="double_dv_last" type="double_dv_last" />
<field name="double_dv_first" type="double_dv_first" />
+ <field name="date" type="date" />
+ <field name="date_last" type="date_last" />
+ <field name="date_first" type="date_first" />
+ <field name="date_dv" type="date_dv" />
+ <field name="date_dv_last" type="date_dv_last" />
+ <field name="date_dv_first" type="date_dv_first" />
+
+ <field name="uuid" type="uuid" />
+ <field name="uuid_last" type="uuid_last" />
+ <field name="uuid_first" type="uuid_first" />
+ <field name="uuid_dv" type="uuid_dv" />
+ <field name="uuid_dv_last" type="uuid_dv_last" />
+ <field name="uuid_dv_first" type="uuid_dv_first" />
+
+ <field name="currency" type="currency" />
+ <field name="currency_last" type="currency_last" />
+ <field name="currency_first" type="currency_first" />
+
+ <field name="collation_en_primary" type="collation_en_primary" />
+ <field name="collation_en_primary_last" type="collation_en_primary_last" />
+ <field name="collation_en_primary_first" type="collation_en_primary_first" />
+ <field name="collation_en_primary_dv" type="collation_en_primary_dv" />
+ <field name="collation_en_primary_dv_last" type="collation_en_primary_dv_last" />
+ <field name="collation_en_primary_dv_first" type="collation_en_primary_dv_first" />
+
+ <field name="icu_collation_en_primary" type="icu_collation_en_primary" />
+ <field name="icu_collation_en_primary_last" type="icu_collation_en_primary_last" />
+ <field name="icu_collation_en_primary_first" type="icu_collation_en_primary_first" />
+ <field name="icu_collation_en_primary_dv" type="icu_collation_en_primary_dv" />
+ <field name="icu_collation_en_primary_dv_last" type="icu_collation_en_primary_dv_last" />
+ <field name="icu_collation_en_primary_dv_first" type="icu_collation_en_primary_dv_first" />
+
+ <field name="bool" type="bool" />
+ <field name="bool_last" type="bool_last" />
+ <field name="bool_first" type="bool_first" />
+
+ <field name="enum" type="enum" />
+ <field name="enum_last" type="enum_last" />
+ <field name="enum_first" type="enum_first" />
+ <!-- EnumField incorrectly disallows missing DocValues - see SOLR-5927 -->
+ <!-- <field name="enum_dv" type="enum_dv" /> -->
+ <!-- <field name="enum_dv_last" type="enum_dv_last" /> -->
+ <!-- <field name="enum_dv_first" type="enum_dv_first" /> -->
+
+ <field name="bcd_int" type="bcd_int" />
+ <field name="bcd_int_last" type="bcd_int_last" />
+ <field name="bcd_int_first" type="bcd_int_first" />
+
+ <field name="bcd_long" type="bcd_long" />
+ <field name="bcd_long_last" type="bcd_long_last" />
+ <field name="bcd_long_first" type="bcd_long_first" />
+
+ <field name="bcd_str" type="bcd_str" />
+ <field name="bcd_str_last" type="bcd_str_last" />
+ <field name="bcd_str_first" type="bcd_str_first" />
+
+ <!-- IntField doesn't support sortMissingFirst or sortMissingLast variants -->
+ <field name="legacy_int" type="legacy_int" />
+
+ <field name="legacy_sortable_int" type="legacy_sortable_int" />
+ <field name="legacy_sortable_int_last" type="legacy_sortable_int_last" />
+ <field name="legacy_sortable_int_first" type="legacy_sortable_int_first" />
+
+ <!-- LongField doesn't support sortMissingFirst or sortMissingLast variants -->
+ <field name="legacy_long" type="legacy_long" />
+
+ <field name="legacy_sortable_long" type="legacy_sortable_long" />
+ <field name="legacy_sortable_long_last" type="legacy_sortable_long_last" />
+ <field name="legacy_sortable_long_first" type="legacy_sortable_long_first" />
+
+ <!-- FloatField doesn't support sortMissingFirst or sortMissingLast variants -->
+ <field name="legacy_float" type="legacy_float" />
+
+ <field name="legacy_sortable_float" type="legacy_sortable_float" />
+ <field name="legacy_sortable_float_last" type="legacy_sortable_float_last" />
+ <field name="legacy_sortable_float_first" type="legacy_sortable_float_first" />
+
+ <!-- DoubleField doesn't support sortMissingFirst or sortMissingLast variants -->
+ <field name="legacy_double" type="legacy_double" />
+
+ <field name="legacy_sortable_double" type="legacy_sortable_double" />
+ <field name="legacy_sortable_double_last" type="legacy_sortable_double_last" />
+ <field name="legacy_sortable_double_first" type="legacy_sortable_double_first" />
+
+ <field name="legacy_date" type="legacy_date" />
+ <field name="legacy_date_last" type="legacy_date_last" />
+ <field name="legacy_date_first" type="legacy_date_first" />
+
<!-- ensure function sorts don't mistakenly get interpreted as field sorts
https://issues.apache.org/jira/browse/SOLR-5354?focusedCommentId=13835891&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13835891
-->
@@ -82,6 +170,16 @@ NOTE: Tests expect every field in this s
<copyField source="str" dest="str_dv" />
<copyField source="str" dest="str_dv_last" />
<copyField source="str" dest="str_dv_first" />
+ <copyField source="str" dest="collation_en_primary_last" />
+ <copyField source="str" dest="collation_en_primary_first" />
+ <copyField source="str" dest="collation_en_primary_dv" />
+ <copyField source="str" dest="collation_en_primary_dv_last" />
+ <copyField source="str" dest="collation_en_primary_dv_first" />
+ <copyField source="str" dest="icu_collation_en_primary_last" />
+ <copyField source="str" dest="icu_collation_en_primary_first" />
+ <copyField source="str" dest="icu_collation_en_primary_dv" />
+ <copyField source="str" dest="icu_collation_en_primary_dv_last" />
+ <copyField source="str" dest="icu_collation_en_primary_dv_first" />
<copyField source="bin" dest="bin_last" />
<copyField source="bin" dest="bin_first" />
@@ -94,24 +192,76 @@ NOTE: Tests expect every field in this s
<copyField source="int" dest="int_dv" />
<copyField source="int" dest="int_dv_last" />
<copyField source="int" dest="int_dv_first" />
+ <copyField source="int" dest="bcd_int" />
+ <copyField source="int" dest="bcd_int_last" />
+ <copyField source="int" dest="bcd_int_first" />
+ <copyField source="int" dest="bcd_str" />
+ <copyField source="int" dest="bcd_str_last" />
+ <copyField source="int" dest="bcd_str_first" />
+ <copyField source="int" dest="legacy_int" />
+ <copyField source="int" dest="legacy_sortable_int" />
+ <copyField source="int" dest="legacy_sortable_int_last" />
+ <copyField source="int" dest="legacy_sortable_int_first" />
<copyField source="long" dest="long_last" />
<copyField source="long" dest="long_first" />
<copyField source="long" dest="long_dv" />
<copyField source="long" dest="long_dv_last" />
<copyField source="long" dest="long_dv_first" />
+ <copyField source="long" dest="bcd_long" />
+ <copyField source="long" dest="bcd_long_last" />
+ <copyField source="long" dest="bcd_long_first" />
+ <copyField source="long" dest="legacy_long" />
+ <copyField source="long" dest="legacy_sortable_long" />
+ <copyField source="long" dest="legacy_sortable_long_last" />
+ <copyField source="long" dest="legacy_sortable_long_first" />
<copyField source="float" dest="float_last" />
<copyField source="float" dest="float_first" />
<copyField source="float" dest="float_dv" />
<copyField source="float" dest="float_dv_last" />
<copyField source="float" dest="float_dv_first" />
+ <copyField source="float" dest="legacy_float" />
+ <copyField source="float" dest="legacy_sortable_float" />
+ <copyField source="float" dest="legacy_sortable_float_last" />
+ <copyField source="float" dest="legacy_sortable_float_first" />
<copyField source="double" dest="double_last" />
<copyField source="double" dest="double_first" />
<copyField source="double" dest="double_dv" />
<copyField source="double" dest="double_dv_last" />
<copyField source="double" dest="double_dv_first" />
+ <copyField source="double" dest="legacy_double" />
+ <copyField source="double" dest="legacy_sortable_double" />
+ <copyField source="double" dest="legacy_sortable_double_last" />
+ <copyField source="double" dest="legacy_sortable_double_first" />
+
+ <copyField source="date" dest="date_last" />
+ <copyField source="date" dest="date_first" />
+ <copyField source="date" dest="date_dv" />
+ <copyField source="date" dest="date_dv_last" />
+ <copyField source="date" dest="date_dv_first" />
+ <copyField source="date" dest="legacy_date_last" />
+ <copyField source="date" dest="legacy_date_first" />
+
+ <copyField source="uuid" dest="uuid_last" />
+ <copyField source="uuid" dest="uuid_first" />
+ <copyField source="uuid" dest="uuid_dv" />
+ <copyField source="uuid" dest="uuid_dv_last" />
+ <copyField source="uuid" dest="uuid_dv_first" />
+
+ <copyField source="currency" dest="currency_last" />
+ <copyField source="currency" dest="currency_first" />
+
+ <copyField source="bool" dest="bool_last" />
+ <copyField source="bool" dest="bool_first" />
+
+ <copyField source="enum" dest="enum_last" />
+ <copyField source="enum" dest="enum_first" />
+ <!-- EnumField incorrectly disallows missing DocValues - see SOLR-5927 -->
+ <!-- <copyField source="enum" dest="enum_dv" /> -->
+ <!-- <copyField source="enum" dest="enum_dv_last" /> -->
+ <!-- <copyField source="enum" dest="enum_dv_first" /> -->
<types>
@@ -157,6 +307,94 @@ NOTE: Tests expect every field in this s
<fieldtype name="double_dv_last" class="solr.TrieDoubleField" stored="true" indexed="false" docValues="true" sortMissingLast="true"/>
<fieldtype name="double_dv_first" class="solr.TrieDoubleField" stored="true" indexed="false" docValues="true" sortMissingFirst="true"/>
+ <fieldtype name="date" class="solr.TrieDateField" stored="true" indexed="true" />
+ <fieldtype name="date_last" class="solr.TrieDateField" stored="true" indexed="true" sortMissingLast="true"/>
+ <fieldtype name="date_first" class="solr.TrieDateField" stored="true" indexed="true" sortMissingFirst="true"/>
+ <fieldtype name="date_dv" class="solr.TrieDateField" stored="true" indexed="false" docValues="true"/>
+ <fieldtype name="date_dv_last" class="solr.TrieDateField" stored="true" indexed="false" docValues="true" sortMissingLast="true"/>
+ <fieldtype name="date_dv_first" class="solr.TrieDateField" stored="true" indexed="false" docValues="true" sortMissingFirst="true"/>
+
+ <fieldtype name="uuid" class="solr.UUIDField" stored="true" indexed="true" />
+ <fieldtype name="uuid_last" class="solr.UUIDField" stored="true" indexed="true" sortMissingLast="true"/>
+ <fieldtype name="uuid_first" class="solr.UUIDField" stored="true" indexed="true" sortMissingFirst="true"/>
+ <fieldtype name="uuid_dv" class="solr.UUIDField" stored="true" indexed="false" docValues="true"/>
+ <fieldtype name="uuid_dv_last" class="solr.UUIDField" stored="true" indexed="false" docValues="true" sortMissingLast="true"/>
+ <fieldtype name="uuid_dv_first" class="solr.UUIDField" stored="true" indexed="false" docValues="true" sortMissingFirst="true"/>
+
+ <fieldtype name="currency" class="solr.CurrencyField" stored="true" indexed="true" foo="bar" providerClass="solr.MockExchangeRateProvider"/>
+ <fieldtype name="currency_last" class="solr.CurrencyField" stored="true" indexed="true" foo="bar" providerClass="solr.MockExchangeRateProvider" sortMissingLast="true"/>
+ <fieldtype name="currency_first" class="solr.CurrencyField" stored="true" indexed="true" foo="bar" providerClass="solr.MockExchangeRateProvider" sortMissingFirst="true"/>
+
+ <fieldtype name="collation_en_primary" class="solr.CollationField" language="en" strength="primary" stored="true" indexed="true" />
+ <fieldtype name="collation_en_primary_last" class="solr.CollationField" language="en" strength="primary" stored="true" indexed="true" sortMissingLast="true"/>
+ <fieldtype name="collation_en_primary_first" class="solr.CollationField" language="en" strength="primary" stored="true" indexed="true" sortMissingFirst="true"/>
+ <fieldtype name="collation_en_primary_dv" class="solr.CollationField" language="en" strength="primary" stored="true" indexed="false" docValues="true"/>
+ <fieldtype name="collation_en_primary_dv_last" class="solr.CollationField" language="en" strength="primary" stored="true" indexed="false" docValues="true" sortMissingLast="true"/>
+ <fieldtype name="collation_en_primary_dv_first" class="solr.CollationField" language="en" strength="primary" stored="true" indexed="false" docValues="true" sortMissingFirst="true"/>
+
+ <fieldtype name="icu_collation_en_primary" class="solr.ICUCollationField" locale="en" strength="primary" stored="true" indexed="true" />
+ <fieldtype name="icu_collation_en_primary_last" class="solr.ICUCollationField" locale="en" strength="primary" stored="true" indexed="true" sortMissingLast="true"/>
+ <fieldtype name="icu_collation_en_primary_first" class="solr.ICUCollationField" locale="en" strength="primary" stored="true" indexed="true" sortMissingFirst="true"/>
+ <fieldtype name="icu_collation_en_primary_dv" class="solr.ICUCollationField" locale="en" strength="primary" stored="true" indexed="false" docValues="true"/>
+ <fieldtype name="icu_collation_en_primary_dv_last" class="solr.ICUCollationField" locale="en" strength="primary" stored="true" indexed="false" docValues="true" sortMissingLast="true"/>
+ <fieldtype name="icu_collation_en_primary_dv_first" class="solr.ICUCollationField" locale="en" strength="primary" stored="true" indexed="false" docValues="true" sortMissingFirst="true"/>
+
+ <!-- BoolField does not support DocValues - see SOLR-5933 -->
+ <fieldtype name="bool" class="solr.BoolField" stored="true" indexed="true" />
+ <fieldtype name="bool_last" class="solr.BoolField" stored="true" indexed="true" sortMissingLast="true"/>
+ <fieldtype name="bool_first" class="solr.BoolField" stored="true" indexed="true" sortMissingFirst="true"/>
+
+ <fieldType name="enum" class="solr.EnumField" enumsConfig="enumsConfig.xml" enumName="severity"/>
+ <fieldType name="enum_last" class="solr.EnumField" enumsConfig="enumsConfig.xml" enumName="severity" sortMissingLast="true"/>
+ <fieldType name="enum_first" class="solr.EnumField" enumsConfig="enumsConfig.xml" enumName="severity" sortMissingFirst="true"/>
+ <!-- EnumField incorrectly disallows missing DocValues - see SOLR-5927 -->
+ <!-- <fieldType name="enum_dv" class="solr.EnumField" enumsConfig="enumsConfig.xml" enumName="severity" docValues="true"/> -->
+ <!-- <fieldType name="enum_dv_last" class="solr.EnumField" enumsConfig="enumsConfig.xml" enumName="severity" docValues="true" sortMissingLast="true"/> -->
+ <!-- <fieldType name="enum_dv_first" class="solr.EnumField" enumsConfig="enumsConfig.xml" enumName="severity" docValues="true" sortMissingFirst="true"/> -->
+
+ <fieldtype name="bcd_int" class="solr.BCDIntField" stored="true" indexed="true" />
+ <fieldtype name="bcd_int_last" class="solr.BCDIntField" stored="true" indexed="true" sortMissingLast="true"/>
+ <fieldtype name="bcd_int_first" class="solr.BCDIntField" stored="true" indexed="true" sortMissingFirst="true"/>
+
+ <fieldtype name="bcd_long" class="solr.BCDLongField" stored="true" indexed="true" />
+ <fieldtype name="bcd_long_last" class="solr.BCDLongField" stored="true" indexed="true" sortMissingLast="true"/>
+ <fieldtype name="bcd_long_first" class="solr.BCDLongField" stored="true" indexed="true" sortMissingFirst="true"/>
+
+ <fieldtype name="bcd_str" class="solr.BCDStrField" stored="true" indexed="true" />
+ <fieldtype name="bcd_str_last" class="solr.BCDStrField" stored="true" indexed="true" sortMissingLast="true"/>
+ <fieldtype name="bcd_str_first" class="solr.BCDStrField" stored="true" indexed="true" sortMissingFirst="true"/>
+
+ <!-- IntField doesn't support sortMissingFirst or sortMissingLast variants -->
+ <fieldtype name="legacy_int" class="solr.IntField" stored="true" indexed="true" />
+
+ <fieldtype name="legacy_sortable_int" class="solr.SortableIntField" stored="true" indexed="true" />
+ <fieldtype name="legacy_sortable_int_last" class="solr.SortableIntField" stored="true" indexed="true" sortMissingLast="true"/>
+ <fieldtype name="legacy_sortable_int_first" class="solr.SortableIntField" stored="true" indexed="true" sortMissingFirst="true"/>
+
+ <!-- LongField doesn't support sortMissingFirst or sortMissingLast variants -->
+ <fieldtype name="legacy_long" class="solr.LongField" stored="true" indexed="true" />
+
+ <fieldtype name="legacy_sortable_long" class="solr.SortableLongField" stored="true" indexed="true" />
+ <fieldtype name="legacy_sortable_long_last" class="solr.SortableLongField" stored="true" indexed="true" sortMissingLast="true"/>
+ <fieldtype name="legacy_sortable_long_first" class="solr.SortableLongField" stored="true" indexed="true" sortMissingFirst="true"/>
+
+ <!-- FloatField doesn't support sortMissingFirst or sortMissingLast variants -->
+ <fieldtype name="legacy_float" class="solr.FloatField" stored="true" indexed="true" />
+
+ <fieldtype name="legacy_sortable_float" class="solr.SortableFloatField" stored="true" indexed="true" />
+ <fieldtype name="legacy_sortable_float_last" class="solr.SortableFloatField" stored="true" indexed="true" sortMissingLast="true"/>
+ <fieldtype name="legacy_sortable_float_first" class="solr.SortableFloatField" stored="true" indexed="true" sortMissingFirst="true"/>
+
+ <!-- DoubleField doesn't support sortMissingFirst or sortMissingLast variants -->
+ <fieldtype name="legacy_double" class="solr.DoubleField" stored="true" indexed="true" />
+
+ <fieldtype name="legacy_sortable_double" class="solr.SortableDoubleField" stored="true" indexed="true" />
+ <fieldtype name="legacy_sortable_double_last" class="solr.SortableDoubleField" stored="true" indexed="true" sortMissingLast="true"/>
+ <fieldtype name="legacy_sortable_double_first" class="solr.SortableDoubleField" stored="true" indexed="true" sortMissingFirst="true"/>
+
+ <fieldtype name="legacy_date" class="solr.DateField" stored="true" indexed="true" />
+ <fieldtype name="legacy_date_last" class="solr.DateField" stored="true" indexed="true" sortMissingLast="true"/>
+ <fieldtype name="legacy_date_first" class="solr.DateField" stored="true" indexed="true" sortMissingFirst="true"/>
</types>
</schema>
Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java Fri Apr 4 10:27:05 2014
@@ -20,6 +20,7 @@ package org.apache.solr;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.StringWriter;
+import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@@ -468,7 +469,7 @@ public class BasicFunctionalityTest exte
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
builder.parse(new ByteArrayInputStream
- (writer.toString().getBytes("UTF-8")));
+ (writer.toString().getBytes(StandardCharsets.UTF_8)));
req.close();
}
Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/CursorPagingTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/CursorPagingTest.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/CursorPagingTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/CursorPagingTest.java Fri Apr 4 10:27:05 2014
@@ -31,18 +31,22 @@ import static org.apache.solr.common.par
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.solr.request.SolrQueryRequest;
+import org.apache.solr.schema.DateField;
import org.apache.solr.search.CursorMark; //jdoc
import org.noggit.ObjectBuilder;
+import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.ArrayList;
+import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Collection;
import java.util.Collections;
+import java.util.Locale;
import java.util.Map;
-import java.nio.ByteBuffer;
+import java.util.UUID;
import org.junit.BeforeClass;
import org.junit.After;
@@ -56,6 +60,9 @@ public class CursorPagingTest extends So
public final static String TEST_SOLRCONFIG_NAME = "solrconfig-deeppaging.xml";
/** schema.xml file name, shared with other cursor related tests */
public final static String TEST_SCHEMAXML_NAME = "schema-sorts.xml";
+ /** values from enumConfig.xml */
+ public static final String[] SEVERITY_ENUM_VALUES =
+ { "Not Available", "Low", "Medium", "High", "Critical" };
@BeforeClass
public static void beforeTests() throws Exception {
@@ -676,7 +683,7 @@ public class CursorPagingTest extends So
String cursorMark = CURSOR_MARK_START;
int docsOnThisPage = Integer.MAX_VALUE;
while (0 < docsOnThisPage) {
- String json = assertJQ(req(params,
+ String json = assertJQ(req(params,
CURSOR_MARK_PARAM, cursorMark));
Map rsp = (Map) ObjectBuilder.fromJSON(json);
assertTrue("response doesn't contain " + CURSOR_MARK_NEXT + ": " + json,
@@ -893,7 +900,6 @@ public class CursorPagingTest extends So
if (useField()) {
doc.addField("str", skewed(randomUsableUnicodeString(),
TestUtil.randomSimpleString(random(), 1, 1)));
-
}
if (useField()) {
int numBytes = (int) skewed(TestUtil.nextInt(random(), 20, 50), 2);
@@ -901,6 +907,23 @@ public class CursorPagingTest extends So
random().nextBytes(randBytes);
doc.addField("bin", ByteBuffer.wrap(randBytes));
}
+ if (useField()) {
+ doc.addField("date", skewed(randomDate(),
+ dateWithRandomSecondOn2010_10_31_at_10_31()));
+ }
+ if (useField()) {
+ doc.addField("uuid", UUID.randomUUID().toString());
+ }
+ if (useField()) {
+ doc.addField("currency", skewed("" + (random().nextInt() / 100.) + "," + randomCurrency(),
+ "" + TestUtil.nextInt(random(), 250, 320) + ",USD"));
+ }
+ if (useField()) {
+ doc.addField("bool", random().nextBoolean() ? "t" : "f");
+ }
+ if (useField()) {
+ doc.addField("enum", randomEnumValue());
+ }
return doc;
}
@@ -939,6 +962,25 @@ public class CursorPagingTest extends So
return result;
}
+ private static String randomDate() {
+ return DateField.formatExternal(new Date(random().nextLong()));
+ }
+
+ private static String dateWithRandomSecondOn2010_10_31_at_10_31() {
+ return String.format(Locale.ROOT, "2010-10-31T10:31:%02d.000Z",
+ TestUtil.nextInt(random(), 0, 59));
+ }
+
+ private static final String[] currencies = { "USD", "EUR", "NOK" };
+
+ public static String randomCurrency() {
+ return currencies[random().nextInt(currencies.length)];
+ }
+
+ private static String randomEnumValue() {
+ return SEVERITY_ENUM_VALUES[random().nextInt(SEVERITY_ENUM_VALUES.length)];
+ }
+
/**
* Given a list of fieldNames, builds up a random sort string which is guaranteed to
* have at least 3 clauses, ending with the "id" field for tie breaking
@@ -956,15 +998,16 @@ public class CursorPagingTest extends So
String field = shuffledNames.get(i);
// wrap in a function sometimes
- if ( (!"score".equals(field))
+ if ( (!"score".equals(field) && !field.contains("bcd"))
&&
(0 == TestUtil.nextInt(random(), 0, 7)) ) {
// specific function doesn't matter, just proving that we can handle the concept.
// but we do have to be careful with non numeric fields
- if (field.startsWith("str") || field.startsWith("bin")) {
- field = "if(exists(" + field + "),47,83)";
- } else {
+ if (field.contains("float") || field.contains("double")
+ || field.contains("int") || field.contains("long")) {
field = "abs(" + field + ")";
+ } else {
+ field = "if(exists(" + field + "),47,83)";
}
}
result.append(field).append(random().nextBoolean() ? " asc, " : " desc, ");
Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/TestSolrCoreProperties.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/TestSolrCoreProperties.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/TestSolrCoreProperties.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/TestSolrCoreProperties.java Fri Apr 4 10:27:05 2014
@@ -29,6 +29,7 @@ import org.apache.solr.common.params.Sol
import org.apache.solr.common.util.NamedList;
import org.junit.BeforeClass;
+import java.nio.charset.StandardCharsets;
/**
* <p> Test for Loading core properties from a properties file </p>
@@ -63,7 +64,7 @@ public class TestSolrCoreProperties exte
Properties p = new Properties();
p.setProperty("foo.foo1", "f1");
p.setProperty("foo.foo2", "f2");
- Writer fos = new OutputStreamWriter(new FileOutputStream(new File(confDir, "solrcore.properties")), IOUtils.CHARSET_UTF_8);
+ Writer fos = new OutputStreamWriter(new FileOutputStream(new File(confDir, "solrcore.properties")), StandardCharsets.UTF_8);
p.store(fos, null);
IOUtils.close(fos);
Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analysis/LegacyHTMLStripCharFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analysis/LegacyHTMLStripCharFilterTest.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analysis/LegacyHTMLStripCharFilterTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analysis/LegacyHTMLStripCharFilterTest.java Fri Apr 4 10:27:05 2014
@@ -23,6 +23,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringReader;
+import java.nio.charset.StandardCharsets;
import java.util.HashSet;
import java.util.Set;
@@ -62,7 +63,7 @@ public class LegacyHTMLStripCharFilterTe
//Some sanity checks, but not a full-fledged check
public void testHTML() throws Exception {
InputStream stream = getClass().getResourceAsStream("htmlStripReaderTest.html");
- LegacyHTMLStripCharFilter reader = new LegacyHTMLStripCharFilter(new InputStreamReader(stream, "UTF-8"));
+ LegacyHTMLStripCharFilter reader = new LegacyHTMLStripCharFilter(new InputStreamReader(stream, StandardCharsets.UTF_8));
StringBuilder builder = new StringBuilder();
int ch = -1;
while ((ch = reader.read()) != -1){
Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/AbstractAnalyticsStatsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/AbstractAnalyticsStatsTest.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/AbstractAnalyticsStatsTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/AbstractAnalyticsStatsTest.java Fri Apr 4 10:27:05 2014
@@ -21,6 +21,7 @@ import java.io.ByteArrayInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -82,7 +83,7 @@ public class AbstractAnalyticsStatsTest
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true); // never forget this!
DocumentBuilder builder = factory.newDocumentBuilder();
- doc = builder.parse(new InputSource(new ByteArrayInputStream(response.getBytes("UTF-8"))));
+ doc = builder.parse(new InputSource(new ByteArrayInputStream(response.getBytes(StandardCharsets.UTF_8))));
xPathFact = XPathFactory.newInstance();
rawResponse = response;
}
@@ -106,8 +107,8 @@ public class AbstractAnalyticsStatsTest
case DOUBLE: return Double.parseDouble(val);
case FLOAT: return Float.parseFloat(val);
case LONG: return Long.parseLong(val);
- case STRING: return val;
- case DATE: return val;
+ case STRING: assertTrue(rawResponse, val != null && val.length() > 0 ); return val;
+ case DATE: assertTrue(rawResponse, val != null && val.length() > 0 ); return val;
}
} catch (Exception e) {
e.printStackTrace();
Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/expression/ExpressionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/expression/ExpressionTest.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/expression/ExpressionTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/expression/ExpressionTest.java Fri Apr 4 10:27:05 2014
@@ -20,7 +20,6 @@ package org.apache.solr.analytics.expres
import com.google.common.collect.ObjectArrays;
import org.apache.lucene.util.IOUtils;
-import org.apache.lucene.util.LuceneTestCase.BadApple;
import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.analytics.AbstractAnalyticsStatsTest;
@@ -36,7 +35,6 @@ import java.util.ArrayList;
import java.util.Scanner;
@SuppressCodecs({"Lucene3x", "Lucene40", "Lucene41", "Lucene42", "Appending", "Asserting"})
-@BadApple(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5302")
public class ExpressionTest extends AbstractAnalyticsStatsTest {
private static final String fileName = "/analytics/requestFiles/expressions.txt";
Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/facet/AbstractAnalyticsFacetTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/facet/AbstractAnalyticsFacetTest.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/facet/AbstractAnalyticsFacetTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/facet/AbstractAnalyticsFacetTest.java Fri Apr 4 10:27:05 2014
@@ -21,6 +21,7 @@ import java.io.ByteArrayInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -65,7 +66,7 @@ public class AbstractAnalyticsFacetTest
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true); // never forget this!
DocumentBuilder builder = factory.newDocumentBuilder();
- doc = builder.parse(new InputSource(new ByteArrayInputStream(response.getBytes("UTF-8"))));
+ doc = builder.parse(new InputSource(new ByteArrayInputStream(response.getBytes(StandardCharsets.UTF_8))));
xPathFact = XPathFactory.newInstance();
rawResponse = response;
}
Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/facet/FieldFacetExtrasTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/facet/FieldFacetExtrasTest.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/facet/FieldFacetExtrasTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/facet/FieldFacetExtrasTest.java Fri Apr 4 10:27:05 2014
@@ -24,6 +24,7 @@ import java.util.Collections;
import java.util.List;
import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
+import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/facet/FieldFacetTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/facet/FieldFacetTest.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/facet/FieldFacetTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/facet/FieldFacetTest.java Fri Apr 4 10:27:05 2014
@@ -18,17 +18,18 @@
package org.apache.solr.analytics.facet;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
+import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.junit.Ignore;
@SuppressCodecs({"Lucene3x","Lucene40","Lucene41","Lucene42","Appending","Asserting"})
-@Ignore // failing after https://issues.apache.org/jira/browse/SOLR-5685
public class FieldFacetTest extends AbstractAnalyticsFacetTest{
static String fileName = "/analytics/requestFiles/fieldFacets.txt";
@@ -390,8 +391,13 @@ public class FieldFacetTest extends Abst
}
}
- assertU(commit());
- setResponse(h.query(request(fileToStringArr(FieldFacetTest.class, fileName))));
+ assertU(commit());
+ String[] reqFacetParamas = fileToStringArr(FieldFacetTest.class, fileName);
+ String[] reqParamas = new String[reqFacetParamas.length + 2];
+ System.arraycopy(reqFacetParamas, 0, reqParamas, 0, reqFacetParamas.length);
+ reqParamas[reqFacetParamas.length] = "solr";
+ reqParamas[reqFacetParamas.length+1] = "asc";
+ setResponse(h.query(request(reqFacetParamas)));
}
@SuppressWarnings("unchecked")
@@ -1063,11 +1069,18 @@ public class FieldFacetTest extends Abst
}
private void checkStddevs(ArrayList<Double> list1, ArrayList<Double> list2) {
+ Collections.sort(list1);
+ Collections.sort(list2);
for (int i = 0; i<list1.size(); i++) {
if ((Math.abs(list1.get(i)-list2.get(i))<.00000000001) == false) {
- assertEquals(getRawResponse(), list1.get(i), list2.get(i), 0.00000000001);
+ Assert.assertEquals(getRawResponse(), list1.get(i), list2.get(i), 0.00000000001);
}
}
}
+ public static void assertEquals(String mes, Object actual, Object expected) {
+ Collections.sort((List<Comparable>) actual);
+ Collections.sort((List<Comparable>) expected);
+ Assert.assertEquals(mes, actual, expected);
+ }
}
Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/util/valuesource/FunctionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/util/valuesource/FunctionTest.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/util/valuesource/FunctionTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/analytics/util/valuesource/FunctionTest.java Fri Apr 4 10:27:05 2014
@@ -90,6 +90,7 @@ public class FunctionTest extends Abstra
double result = (Double)getStatResult("ar", "sum", VAL_TYPE.DOUBLE);
double calculated = (Double)getStatResult("ar", "sumc", VAL_TYPE.DOUBLE);
assertEquals(getRawResponse(), result, calculated, 0.0);
+ // TODO checfk why asserted 2times
assertEquals(getRawResponse(), result, calculated, 0.0);
result = (Double)getStatResult("ar", "mean", VAL_TYPE.DOUBLE);
@@ -170,24 +171,24 @@ public class FunctionTest extends Abstra
@Test
public void dateMathTest() throws Exception {
- String result = (String)getStatResult("dmr", "median", VAL_TYPE.STRING);
- String calculated = (String)getStatResult("dmr", "medianc", VAL_TYPE.STRING);
+ String result = (String)getStatResult("dmr", "median", VAL_TYPE.DATE);
+ String calculated = (String)getStatResult("dmr", "medianc", VAL_TYPE.DATE);
assertEquals(getRawResponse(), result, calculated);
- result = (String)getStatResult("dmr", "max", VAL_TYPE.STRING);
- calculated = (String)getStatResult("dmr", "maxc", VAL_TYPE.STRING);
+ result = (String)getStatResult("dmr", "max", VAL_TYPE.DATE);
+ calculated = (String)getStatResult("dmr", "maxc", VAL_TYPE.DATE);
assertEquals(getRawResponse(), result, calculated);
}
@Test
public void constantDateTest() throws Exception {
- String result = (String)getStatResult("cdr", "median", VAL_TYPE.STRING);
- String calculated = (String)getStatResult("cdr", "medianc", VAL_TYPE.STRING);
+ String result = (String)getStatResult("cdr", "median", VAL_TYPE.DATE);
+ String calculated = (String)getStatResult("cdr", "medianc", VAL_TYPE.DATE);
assertEquals(getRawResponse(), result, calculated);
assertEquals(getRawResponse(), result, calculated);
- result = (String)getStatResult("cdr", "max", VAL_TYPE.STRING);
- calculated = (String)getStatResult("cdr", "maxc", VAL_TYPE.STRING);
+ result = (String)getStatResult("cdr", "max", VAL_TYPE.DATE);
+ calculated = (String)getStatResult("cdr", "maxc", VAL_TYPE.DATE);
assertEquals(getRawResponse(), result, calculated);
}
Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/AsyncMigrateRouteKeyTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/AsyncMigrateRouteKeyTest.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/AsyncMigrateRouteKeyTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/AsyncMigrateRouteKeyTest.java Fri Apr 4 10:27:05 2014
@@ -53,7 +53,11 @@ public class AsyncMigrateRouteKeyTest ex
params = new ModifiableSolrParams();
params.set("action", CollectionParams.CollectionAction.REQUESTSTATUS.toString());
params.set(OverseerCollectionProcessor.REQUESTID, asyncId);
- message = sendStatusRequestWithRetry(params, 10);
+ // This task takes long enough to run. Also check for the current state of the task to be running.
+ message = sendStatusRequestWithRetry(params, 2);
+ assertEquals("found " + asyncId + " in submitted tasks", message);
+ // Now wait until the task actually completes successfully/fails.
+ message = sendStatusRequestWithRetry(params, 20);
assertEquals("Task " + asyncId + " not found in completed tasks.",
"found " + asyncId + " in completed tasks", message);
}
@@ -92,7 +96,6 @@ public class AsyncMigrateRouteKeyTest ex
if (state.equals("completed") || state.equals("failed"))
return (String) status.get("msg");
-
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java Fri Apr 4 10:27:05 2014
@@ -75,14 +75,14 @@ public class ChaosMonkeyNothingIsSafeTes
SolrCmdDistributor.testing_errorHook = null;
}
- public static String[] fieldNames = new String[]{"f_i", "f_f", "f_d", "f_l", "f_dt"};
- public static RandVal[] randVals = new RandVal[]{rint, rfloat, rdouble, rlong, rdate};
+ protected static final String[] fieldNames = new String[]{"f_i", "f_f", "f_d", "f_l", "f_dt"};
+ protected static final RandVal[] randVals = new RandVal[]{rint, rfloat, rdouble, rlong, rdate};
- protected String[] getFieldNames() {
+ public String[] getFieldNames() {
return fieldNames;
}
- protected RandVal[] getRandValues() {
+ public RandVal[] getRandValues() {
return randVals;
}
Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java Fri Apr 4 10:27:05 2014
@@ -58,14 +58,14 @@ public class ChaosMonkeySafeLeaderTest e
SolrCmdDistributor.testing_errorHook = null;
}
- public static String[] fieldNames = new String[]{"f_i", "f_f", "f_d", "f_l", "f_dt"};
- public static RandVal[] randVals = new RandVal[]{rint, rfloat, rdouble, rlong, rdate};
+ protected static final String[] fieldNames = new String[]{"f_i", "f_f", "f_d", "f_l", "f_dt"};
+ protected static final RandVal[] randVals = new RandVal[]{rint, rfloat, rdouble, rlong, rdate};
- protected String[] getFieldNames() {
+ public String[] getFieldNames() {
return fieldNames;
}
- protected RandVal[] getRandValues() {
+ public RandVal[] getRandValues() {
return randVals;
}
Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyShardSplitTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyShardSplitTest.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyShardSplitTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyShardSplitTest.java Fri Apr 4 10:27:05 2014
@@ -256,7 +256,7 @@ public class ChaosMonkeyShardSplitTest e
// TODO: close Overseer
Overseer overseer = new Overseer(
- new HttpShardHandlerFactory().getShardHandler(), "/admin/cores", reader);
+ new HttpShardHandlerFactory().getShardHandler(), "/admin/cores", reader,null);
overseer.close();
ElectionContext ec = new OverseerElectionContext(zkClient, overseer,
address.replaceAll("/", "_"));
Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java?rev=1584603&r1=1584602&r2=1584603&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java Fri Apr 4 10:27:05 2014
@@ -39,12 +39,17 @@ import org.apache.solr.client.solrj.Solr
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
import org.apache.solr.client.solrj.impl.CloudSolrServer;
import org.apache.solr.client.solrj.request.QueryRequest;
+import org.apache.solr.common.cloud.SolrZkClient;
+import org.apache.solr.common.cloud.ZkNodeProps;
+import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.CollectionParams.CollectionAction;
import org.apache.solr.common.params.MapSolrParams;
import org.apache.solr.common.params.SolrParams;
+import org.apache.zookeeper.data.Stat;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
+
@LuceneTestCase.Slow
@SuppressSSL // Currently unknown why SSL does not work
public class OverseerRolesTest extends AbstractFullDistribZkTestBase{
@@ -85,11 +90,43 @@ public class OverseerRolesTest extends
@Override
public void doTest() throws Exception {
- addOverseerRole2ExistingNodes();
+ testOverseerRole();
+ testQuitCommand();
+
+ }
+
+ private void testQuitCommand() throws Exception{
+ String collectionName = "testOverseerQuit";
+
+ createCollection(collectionName, client);
+
+ waitForRecoveriesToFinish(collectionName, false);
+
+ SolrZkClient zk = client.getZkStateReader().getZkClient();
+ byte[] data = new byte[0];
+ data = zk.getData("/overseer_elect/leader", null, new Stat(), true);
+ Map m = (Map) ZkStateReader.fromJSON(data);
+ String s = (String) m.get("id");
+ String leader = LeaderElector.getNodeName(s);
+ Overseer.getInQueue(zk).offer(ZkStateReader.toJSON(new ZkNodeProps(Overseer.QUEUE_OPERATION, Overseer.QUIT)));
+ long timeout = System.currentTimeMillis()+5000;
+ String newLeader=null;
+ for(;System.currentTimeMillis() < timeout;){
+ newLeader = OverseerCollectionProcessor.getLeaderNode(zk);
+ if(!newLeader.equals(leader)) break;
+ Thread.sleep(100);
+ }
+ assertNotSame( "Leader not changed yet",newLeader,leader);
+
+
+ assertTrue("The old leader should have rejoined election ", OverseerCollectionProcessor.getSortedOverseerNodeNames(zk).contains(leader));
}
- private void addOverseerRole2ExistingNodes() throws Exception {
+
+
+
+ private void testOverseerRole() throws Exception {
String collectionName = "testOverseerCol";
createCollection(collectionName, client);
@@ -202,13 +239,6 @@ public class OverseerRolesTest extends
assertTrue("New overseer not the frontrunner : "+ getSortedOverseerNodeNames(client.getZkStateReader().getZkClient()) + " expected : "+ killedOverseer, leaderchanged);
-
-
-
-
- client.shutdown();
-
-
}
private void setOverseerRole(CollectionAction action, String overseerDesignate) throws Exception, IOException {