You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by si...@apache.org on 2012/10/25 15:10:51 UTC
svn commit: r1402140 [15/17] - in /lucene/dev/branches/LUCENE-2878: ./
dev-tools/ dev-tools/eclipse/ dev-tools/eclipse/dot.settings/
dev-tools/idea/.idea/libraries/ dev-tools/idea/lucene/classification/
dev-tools/maven/ dev-tools/maven/lucene/classific...
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java Thu Oct 25 13:10:25 2012
@@ -16,18 +16,6 @@
*/
package org.apache.solr.highlight;
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Set;
-
-
import org.apache.lucene.analysis.CachingTokenFilter;
import org.apache.lucene.analysis.TokenFilter;
import org.apache.lucene.analysis.TokenStream;
@@ -38,19 +26,16 @@ import org.apache.lucene.index.StorableF
import org.apache.lucene.index.StoredDocument;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.highlight.*;
-import org.apache.lucene.search.vectorhighlight.BoundaryScanner;
-import org.apache.lucene.search.vectorhighlight.FastVectorHighlighter;
-import org.apache.lucene.search.vectorhighlight.FieldQuery;
-import org.apache.lucene.search.vectorhighlight.FragListBuilder;
-import org.apache.lucene.search.vectorhighlight.FragmentsBuilder;
+import org.apache.lucene.search.highlight.Formatter;
+import org.apache.lucene.search.vectorhighlight.*;
import org.apache.lucene.util.AttributeSource.State;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.HighlightParams;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SimpleOrderedMap;
-import org.apache.solr.core.SolrConfig;
import org.apache.solr.core.PluginInfo;
+import org.apache.solr.core.SolrConfig;
import org.apache.solr.core.SolrCore;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.schema.IndexSchema;
@@ -62,6 +47,10 @@ import org.apache.solr.util.plugin.Plugi
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.*;
+
/**
*
* @since solr 1.3
@@ -166,7 +155,7 @@ public class DefaultSolrHighlighter exte
* @param fieldName The name of the field
* @param request The current SolrQueryRequest
* @param tokenStream document text CachingTokenStream
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
protected Highlighter getPhraseHighlighter(Query query, String fieldName, SolrQueryRequest request, CachingTokenFilter tokenStream) throws IOException {
SolrParams params = request.getParams();
@@ -446,6 +435,9 @@ public class DefaultSolrHighlighter exte
listFields.add(field.stringValue());
}
+ // preserve order of values in a multiValued list
+ boolean preserveMulti = params.getFieldBool(fieldName, HighlightParams.PRESERVE_MULTI, false);
+
String[] docTexts = (String[]) listFields.toArray(new String[listFields.size()]);
// according to Document javadoc, doc.getValues() never returns null. check empty instead of null
@@ -459,14 +451,9 @@ public class DefaultSolrHighlighter exte
List<TextFragment> frags = new ArrayList<TextFragment>();
TermOffsetsTokenStream tots = null; // to be non-null iff we're using TermOffsets optimization
- try {
- TokenStream tvStream = TokenSources.getTokenStream(searcher.getIndexReader(), docId, fieldName);
- if (tvStream != null) {
- tots = new TermOffsetsTokenStream(tvStream);
- }
- }
- catch (IllegalArgumentException e) {
- // No problem. But we can't use TermOffsets optimization.
+ TokenStream tvStream = TokenSources.getTokenStreamWithOffsets(searcher.getIndexReader(), docId, fieldName);
+ if (tvStream != null) {
+ tots = new TermOffsetsTokenStream(tvStream);
}
for (int j = 0; j < docTexts.length; j++) {
@@ -511,8 +498,14 @@ public class DefaultSolrHighlighter exte
try {
TextFragment[] bestTextFragments = highlighter.getBestTextFragments(tstream, docTexts[j], mergeContiguousFragments, numFragments);
for (int k = 0; k < bestTextFragments.length; k++) {
- if ((bestTextFragments[k] != null) && (bestTextFragments[k].getScore() > 0)) {
- frags.add(bestTextFragments[k]);
+ if (preserveMulti) {
+ if (bestTextFragments[k] != null) {
+ frags.add(bestTextFragments[k]);
+ }
+ } else {
+ if ((bestTextFragments[k] != null) && (bestTextFragments[k].getScore() > 0)) {
+ frags.add(bestTextFragments[k]);
+ }
}
}
} catch (InvalidTokenOffsetsException e) {
@@ -520,21 +513,30 @@ public class DefaultSolrHighlighter exte
}
}
// sort such that the fragments with the highest score come first
- Collections.sort(frags, new Comparator<TextFragment>() {
- public int compare(TextFragment arg0, TextFragment arg1) {
- return Math.round(arg1.getScore() - arg0.getScore());
- }
- });
-
+ if(!preserveMulti){
+ Collections.sort(frags, new Comparator<TextFragment>() {
+ public int compare(TextFragment arg0, TextFragment arg1) {
+ return Math.round(arg1.getScore() - arg0.getScore());
+ }
+ });
+ }
+
// convert fragments back into text
// TODO: we can include score and position information in output as snippet attributes
if (frags.size() > 0) {
ArrayList<String> fragTexts = new ArrayList<String>();
for (TextFragment fragment: frags) {
- if ((fragment != null) && (fragment.getScore() > 0)) {
- fragTexts.add(fragment.toString());
+ if (preserveMulti) {
+ if (fragment != null) {
+ fragTexts.add(fragment.toString());
+ }
+ } else {
+ if ((fragment != null) && (fragment.getScore() > 0)) {
+ fragTexts.add(fragment.toString());
+ }
}
- if (fragTexts.size() >= numFragments) break;
+
+ if (fragTexts.size() >= numFragments && !preserveMulti) break;
}
summaries = fragTexts.toArray(new String[0]);
if (summaries.length > 0)
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/internal/csv/CSVStrategy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/internal/csv/CSVStrategy.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/internal/csv/CSVStrategy.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/internal/csv/CSVStrategy.java Thu Oct 25 13:10:25 2012
@@ -89,7 +89,7 @@ public class CSVStrategy implements Clon
setIgnoreEmptyLines(ignoreEmptyLines);
}
- /** @deprecated */
+ /** @deprecated Use {@link #CSVStrategy(char, char, char, char, boolean, boolean, boolean, boolean)} */
public CSVStrategy(
char delimiter,
char encapsulator,
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/internal/csv/CharBuffer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/internal/csv/CharBuffer.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/internal/csv/CharBuffer.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/internal/csv/CharBuffer.java Thu Oct 25 13:10:25 2012
@@ -207,7 +207,6 @@ public class CharBuffer {
/**
* Copies the data into a new array of at least <code>capacity</code> size.
- * @param capacity
*/
public void provideCapacity(final int capacity) {
if (c.length >= capacity) {
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/internal/csv/ExtendedBufferedReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/internal/csv/ExtendedBufferedReader.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/internal/csv/ExtendedBufferedReader.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/internal/csv/ExtendedBufferedReader.java Thu Oct 25 13:10:25 2012
@@ -155,7 +155,7 @@ class ExtendedBufferedReader extends Buf
*
* @param c the character to read up to
* @return the string up to the character <code>c</code>
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public String readUntil(char c) throws IOException {
if (lookaheadChar == UNDEFINED) {
@@ -253,10 +253,8 @@ class ExtendedBufferedReader extends Buf
/**
* Skips all chars in the input until (but excluding) the given char
*
- * @param c
* @return counter
- * @throws IllegalArgumentException
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public long skipUntil(char c) throws IllegalArgumentException, IOException {
if (lookaheadChar == UNDEFINED) {
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/internal/csv/writer/CSVConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/internal/csv/writer/CSVConfig.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/internal/csv/writer/CSVConfig.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/internal/csv/writer/CSVConfig.java Thu Oct 25 13:10:25 2012
@@ -275,7 +275,6 @@ public class CSVConfig {
/**
* Specify if the end of the line needs to be trimmed. Defaults to false.
- * @param endTrimmed
*/
public void setEndTrimmed(boolean endTrimmed) {
this.endTrimmed = endTrimmed;
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/internal/csv/writer/CSVConfigGuesser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/internal/csv/writer/CSVConfigGuesser.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/internal/csv/writer/CSVConfigGuesser.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/internal/csv/writer/CSVConfigGuesser.java Thu Oct 25 13:10:25 2012
@@ -116,7 +116,6 @@ public class CSVConfigGuesser {
/**
* Guess if this file is fixedwidth.
* Just basing the fact on all lines being of the same length
- * @param lines
*/
protected void guessFixedWidth(String[] lines) {
int lastLength = 0;
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/request/SimpleFacets.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/request/SimpleFacets.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/request/SimpleFacets.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/request/SimpleFacets.java Thu Oct 25 13:10:25 2012
@@ -58,7 +58,7 @@ import java.util.concurrent.TimeUnit;
public class SimpleFacets {
/** The main set of documents all facet counts should be relative to */
- protected DocSet docs;
+ protected DocSet docsOrig;
/** Configuration params behavior should be driven by */
protected SolrParams params;
protected SolrParams required;
@@ -70,11 +70,11 @@ public class SimpleFacets {
protected SimpleOrderedMap<Object> facetResponse;
// per-facet values
- SolrParams localParams; // localParams on this particular facet command
- String facetValue; // the field to or query to facet on (minus local params)
- DocSet base; // the base docset for this particular facet
- String key; // what name should the results be stored under
- int threads;
+ protected SolrParams localParams; // localParams on this particular facet command
+ protected String facetValue; // the field to or query to facet on (minus local params)
+ protected DocSet docs; // the base docset for this particular facet
+ protected String key; // what name should the results be stored under
+ protected int threads;
public SimpleFacets(SolrQueryRequest req,
DocSet docs,
@@ -88,16 +88,16 @@ public class SimpleFacets {
ResponseBuilder rb) {
this.req = req;
this.searcher = req.getSearcher();
- this.base = this.docs = docs;
+ this.docs = this.docsOrig = docs;
this.params = params;
this.required = new RequiredSolrParams(params);
this.rb = rb;
}
- void parseParams(String type, String param) throws ParseException, IOException {
+ protected void parseParams(String type, String param) throws ParseException, IOException {
localParams = QueryParsing.getLocalParams(param, req.getParams());
- base = docs;
+ docs = docsOrig;
facetValue = param;
key = param;
threads = -1;
@@ -166,7 +166,7 @@ public class SimpleFacets {
} else if (rb.getGroupingSpec().getFunctions().length > 0) {
grouping.addFunctionCommand(rb.getGroupingSpec().getFunctions()[0], req);
} else {
- this.base = base;
+ this.docs = base;
return;
}
AbstractAllGroupHeadsCollector allGroupHeadsCollector = grouping.getCommands().get(0).createAllGroupCollector();
@@ -174,9 +174,9 @@ public class SimpleFacets {
int maxDoc = searcher.maxDoc();
FixedBitSet fixedBitSet = allGroupHeadsCollector.retrieveGroupHeads(maxDoc);
long[] bits = fixedBitSet.getBits();
- this.base = new BitDocSet(new OpenBitSet(bits, bits.length));
+ this.docs = new BitDocSet(new OpenBitSet(bits, bits.length));
} else {
- this.base = base;
+ this.docs = base;
}
}
@@ -184,7 +184,7 @@ public class SimpleFacets {
/**
- * Looks at various Params to determing if any simple Facet Constraint count
+ * Looks at various Params to determining if any simple Facet Constraint count
* computations are desired.
*
* @see #getFacetQueryCounts
@@ -245,7 +245,7 @@ public class SimpleFacets {
if (params.getBool(GroupParams.GROUP_FACET, false)) {
res.add(key, getGroupedFacetQueryCount(qobj));
} else {
- res.add(key, searcher.numDocs(qobj, base));
+ res.add(key, searcher.numDocs(qobj, docs));
}
}
}
@@ -269,7 +269,7 @@ public class SimpleFacets {
}
TermAllGroupsCollector collector = new TermAllGroupsCollector(groupField);
- Filter mainQueryFilter = docs.getTopFilter(); // This returns a filter that only matches documents matching with q param and fq params
+ Filter mainQueryFilter = docsOrig.getTopFilter(); // This returns a filter that only matches documents matching with q param and fq params
searcher.search(facetQuery, mainQueryFilter, collector);
return collector.getGroupCount();
}
@@ -316,25 +316,25 @@ public class SimpleFacets {
}
if (params.getFieldBool(field, GroupParams.GROUP_FACET, false)) {
- counts = getGroupedCounts(searcher, base, field, multiToken, offset,limit, mincount, missing, sort, prefix);
+ counts = getGroupedCounts(searcher, docs, field, multiToken, offset,limit, mincount, missing, sort, prefix);
} else {
// unless the enum method is explicitly specified, use a counting method.
if (enumMethod) {
- counts = getFacetTermEnumCounts(searcher, base, field, offset, limit, mincount,missing,sort,prefix);
+ counts = getFacetTermEnumCounts(searcher, docs, field, offset, limit, mincount,missing,sort,prefix);
} else {
if (multiToken) {
UnInvertedField uif = UnInvertedField.getUnInvertedField(field, searcher);
- counts = uif.getCounts(searcher, base, offset, limit, mincount,missing,sort,prefix);
+ counts = uif.getCounts(searcher, docs, offset, limit, mincount,missing,sort,prefix);
} else {
// TODO: future logic could use filters instead of the fieldcache if
// the number of terms in the field is small enough.
if (per_segment) {
- PerSegmentSingleValuedFaceting ps = new PerSegmentSingleValuedFaceting(searcher, base, field, offset,limit, mincount, missing, sort, prefix);
+ PerSegmentSingleValuedFaceting ps = new PerSegmentSingleValuedFaceting(searcher, docs, field, offset,limit, mincount, missing, sort, prefix);
Executor executor = threads == 0 ? directExecutor : facetExecutor;
ps.setNumThreads(threads);
counts = ps.getFacetCounts(executor);
} else {
- counts = getFieldCacheCounts(searcher, base, field, offset,limit, mincount, missing, sort, prefix);
+ counts = getFieldCacheCounts(searcher, docs, field, offset,limit, mincount, missing, sort, prefix);
}
}
@@ -434,7 +434,7 @@ public class SimpleFacets {
NamedList<Integer> res = new NamedList<Integer>();
for (String term : terms) {
String internal = ft.toInternal(term);
- int count = searcher.numDocs(new TermQuery(new Term(field, internal)), base);
+ int count = searcher.numDocs(new TermQuery(new Term(field, internal)), docs);
res.add(term, count);
}
return res;
@@ -1212,7 +1212,7 @@ public class SimpleFacets {
if (params.getBool(GroupParams.GROUP_FACET, false)) {
return getGroupedFacetQueryCount(rangeQ);
} else {
- return searcher.numDocs(rangeQ ,base);
+ return searcher.numDocs(rangeQ , docs);
}
}
@@ -1223,7 +1223,7 @@ public class SimpleFacets {
protected int rangeCount(SchemaField sf, Date low, Date high,
boolean iLow, boolean iHigh) throws IOException {
Query rangeQ = ((DateField)(sf.getType())).getRangeQuery(null, sf,low,high,iLow,iHigh);
- return searcher.numDocs(rangeQ ,base);
+ return searcher.numDocs(rangeQ , docs);
}
/**
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/request/UnInvertedField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/request/UnInvertedField.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/request/UnInvertedField.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/request/UnInvertedField.java Thu Oct 25 13:10:25 2012
@@ -456,7 +456,7 @@ public class UnInvertedField extends Doc
* @param baseDocs The {@link org.apache.solr.search.DocSet} to gather the stats on
* @param facet One or more fields to facet on.
* @return The {@link org.apache.solr.handler.component.StatsValues} collected
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public StatsValues getStats(SolrIndexSearcher searcher, DocSet baseDocs, String[] facet) throws IOException {
//this function is ripped off nearly wholesale from the getCounts function to use
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/response/BinaryResponseWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/response/BinaryResponseWriter.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/response/BinaryResponseWriter.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/response/BinaryResponseWriter.java Thu Oct 25 13:10:25 2012
@@ -229,9 +229,6 @@ public class BinaryResponseWriter implem
/**
* TODO -- there may be a way to do this without marshal at all...
*
- * @param req
- * @param rsp
- *
* @return a response object equivalent to what you get from the XML/JSON/javabin parser. Documents become
* SolrDocuments, DocList becomes SolrDocumentList etc.
*
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/response/transform/DocTransformer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/response/transform/DocTransformer.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/response/transform/DocTransformer.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/response/transform/DocTransformer.java Thu Oct 25 13:10:25 2012
@@ -53,7 +53,7 @@ public abstract class DocTransformer
*
* @param doc The document to alter
* @param docid The Lucene internal doc id
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public abstract void transform(SolrDocument doc, int docid) throws IOException;
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java Thu Oct 25 13:10:25 2012
@@ -47,6 +47,11 @@ import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+/**
+ * Abstract base class for Solr FieldTypes based on a Lucene 4 {@link SpatialStrategy}.
+ *
+ * @lucene.experimental
+ */
public abstract class AbstractSpatialFieldType<T extends SpatialStrategy> extends FieldType {
/** A local-param with one of "none" (default), "distance", or "recipDistance". */
@@ -62,6 +67,11 @@ public abstract class AbstractSpatialFie
protected void init(IndexSchema schema, Map<String, String> args) {
super.init(schema, args);
+ String units = args.remove("units");
+ if (!"degrees".equals(units))
+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
+ "Must specify units=\"degrees\" on field types with class "+getClass().getSimpleName());
+
//Solr expects us to remove the parameters we've used.
MapListener<String, String> argsWrap = new MapListener<String, String>(args);
ctx = SpatialContextFactory.makeSpatialContext(argsWrap, schema.getResourceLoader().getClassLoader());
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/AbstractSpatialPrefixTreeFieldType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/AbstractSpatialPrefixTreeFieldType.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/AbstractSpatialPrefixTreeFieldType.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/AbstractSpatialPrefixTreeFieldType.java Thu Oct 25 13:10:25 2012
@@ -25,6 +25,10 @@ import org.apache.solr.util.MapListener;
import java.util.Map;
+/**
+ * @see PrefixTreeStrategy
+ * @lucene.experimental
+ */
public abstract class AbstractSpatialPrefixTreeFieldType<T extends PrefixTreeStrategy> extends AbstractSpatialFieldType<T> {
/** @see org.apache.lucene.spatial.prefix.RecursivePrefixTreeStrategy#setDefaultFieldValuesArrayLen(int) */
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/CurrencyField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/CurrencyField.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/CurrencyField.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/CurrencyField.java Thu Oct 25 13:10:25 2012
@@ -227,7 +227,7 @@ public class CurrencyField extends Field
final CurrencyValue p1 = CurrencyValue.parse(part1, defaultCurrency);
final CurrencyValue p2 = CurrencyValue.parse(part2, defaultCurrency);
- if (!p1.getCurrencyCode().equals(p2.getCurrencyCode())) {
+ if (p1 != null && p2 != null && !p1.getCurrencyCode().equals(p2.getCurrencyCode())) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"Cannot parse range query " + part1 + " to " + part2 +
": range queries only supported when upper and lower bound have same currency.");
@@ -237,11 +237,12 @@ public class CurrencyField extends Field
}
public Query getRangeQuery(QParser parser, SchemaField field, final CurrencyValue p1, final CurrencyValue p2, final boolean minInclusive, final boolean maxInclusive) {
- String currencyCode = p1.getCurrencyCode();
+ String currencyCode = (p1 != null) ? p1.getCurrencyCode() :
+ (p2 != null) ? p2.getCurrencyCode() : defaultCurrency;
final CurrencyValueSource vs = new CurrencyValueSource(field, currencyCode, parser);
return new SolrConstantScoreQuery(new ValueSourceRangeFilter(vs,
- p1.getAmount() + "", p2.getAmount() + "", minInclusive, maxInclusive));
+ p1 == null ? null : p1.getAmount() + "" , p2 == null ? null : p2.getAmount() + "", minInclusive, maxInclusive));
}
@Override
@@ -659,6 +660,9 @@ class CurrencyValue {
* @return The parsed CurrencyValue.
*/
public static CurrencyValue parse(String externalVal, String defaultCurrency) {
+ if (externalVal == null) {
+ return null;
+ }
String amount = externalVal;
String code = defaultCurrency;
@@ -668,6 +672,10 @@ class CurrencyValue {
code = amountAndCode[1];
}
+ if (amount.equals("*")) {
+ return null;
+ }
+
Currency currency = java.util.Currency.getInstance(code);
if (currency == null) {
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/ExchangeRateProvider.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/ExchangeRateProvider.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/ExchangeRateProvider.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/ExchangeRateProvider.java Thu Oct 25 13:10:25 2012
@@ -28,9 +28,7 @@ import org.apache.solr.common.SolrExcept
public interface ExchangeRateProvider {
/**
* Get the exchange rate betwen the two given currencies
- * @param sourceCurrencyCode
- * @param targetCurrencyCode
- * @return the exhange rate as a double
+ * @return the exchange rate as a double
* @throws SolrException if the rate is not defined in the provider
*/
public double getExchangeRate(String sourceCurrencyCode, String targetCurrencyCode) throws SolrException;
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/FieldType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/FieldType.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/FieldType.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/FieldType.java Thu Oct 25 13:10:25 2012
@@ -568,7 +568,6 @@ public abstract class FieldType extends
* Sub-classes should override this method to provide their own range query implementation. They should strive to
* handle nulls in part1 and/or part2 as well as unequal minInclusive and maxInclusive parameters gracefully.
*
- * @param parser
* @param field the schema field
* @param part1 the lower boundary of the range, nulls are allowed.
* @param part2 the upper boundary of the range, nulls are allowed
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/IndexSchema.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/IndexSchema.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/IndexSchema.java Thu Oct 25 13:10:25 2012
@@ -892,7 +892,6 @@ public final class IndexSchema {
* not as a result of a copyField declaration with a wildcard? We
* consider it explicitly defined if it matches a field or dynamicField
* declaration.
- * @param fieldName
* @return true if explicitly declared in the schema.
*/
public boolean hasExplicitField(String fieldName) {
@@ -909,7 +908,6 @@ public final class IndexSchema {
/**
* Is the specified field dynamic or not.
- * @param fieldName
* @return true if the specified field is dynamic
*/
public boolean isDynamicField(String fieldName) {
@@ -1047,7 +1045,6 @@ public final class IndexSchema {
/**
* Get all copy fields, both the static and the dynamic ones.
- * @param destField
* @return Array of fields copied into this field
*/
@@ -1070,7 +1067,6 @@ public final class IndexSchema {
/**
* Get all copy fields for a specified source field, both static
* and dynamic ones.
- * @param sourceField
* @return List of CopyFields to copy to.
* @since solr 1.4
*/
@@ -1103,7 +1099,6 @@ public final class IndexSchema {
/**
* Is the given field name a wildcard? I.e. does it begin or end with *?
- * @param name
* @return true/false
*/
private static boolean isWildCard(String name) {
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/PreAnalyzedField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/PreAnalyzedField.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/PreAnalyzedField.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/PreAnalyzedField.java Thu Oct 25 13:10:25 2012
@@ -123,7 +123,7 @@ public class PreAnalyzedField extends Fi
* class.
* @param f field to convert
* @return string that is compatible with the serialization format
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public String toFormattedString(Field f) throws IOException {
return parser.toFormattedString(f);
@@ -155,7 +155,7 @@ public class PreAnalyzedField extends Fi
* Format a field so that the resulting String is valid for parsing with {@link #parse(Reader, AttributeSource)}.
* @param f field instance
* @return formatted string
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public String toFormattedString(Field f) throws IOException;
}
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/SpatialRecursivePrefixTreeFieldType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/SpatialRecursivePrefixTreeFieldType.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/SpatialRecursivePrefixTreeFieldType.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/SpatialRecursivePrefixTreeFieldType.java Thu Oct 25 13:10:25 2012
@@ -21,6 +21,10 @@ import org.apache.lucene.spatial.prefix.
import java.util.Map;
+/**
+ * @see RecursivePrefixTreeStrategy
+ * @lucene.experimental
+ */
public class SpatialRecursivePrefixTreeFieldType extends AbstractSpatialPrefixTreeFieldType<RecursivePrefixTreeStrategy> {
/** @see RecursivePrefixTreeStrategy#setPrefixGridScanLevel(int) */
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/SpatialTermQueryPrefixTreeFieldType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/SpatialTermQueryPrefixTreeFieldType.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/SpatialTermQueryPrefixTreeFieldType.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/schema/SpatialTermQueryPrefixTreeFieldType.java Thu Oct 25 13:10:25 2012
@@ -19,6 +19,10 @@ package org.apache.solr.schema;
import org.apache.lucene.spatial.prefix.TermQueryPrefixTreeStrategy;
+/**
+ * @see TermQueryPrefixTreeStrategy
+ * @lucene.experimental
+ */
public class SpatialTermQueryPrefixTreeFieldType extends AbstractSpatialPrefixTreeFieldType<TermQueryPrefixTreeStrategy> {
@Override
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java Thu Oct 25 13:10:25 2012
@@ -413,9 +413,7 @@ class ExtendedDismaxQParser extends QPar
}
/**
- * Extracts all the alised fields from the requests and adds them to up
- * @param up
- * @param tiebreaker
+ * Extracts all the aliased fields from the requests and adds them to up
*/
private void addAliasesFromRequest(ExtendedSolrQueryParser up, float tiebreaker) {
Iterator<String> it = solrParams.getParameterNamesIterator();
@@ -953,7 +951,6 @@ class ExtendedDismaxQParser extends QPar
/**
* Returns the aliases found for a field.
* Returns null if there are no aliases for the field
- * @param field
* @return Alias
*/
public Alias getAlias(String field) {
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/FunctionQParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/FunctionQParser.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/FunctionQParser.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/FunctionQParser.java Thu Oct 25 13:10:25 2012
@@ -106,7 +106,6 @@ public class FunctionQParser extends QPa
* Are there more arguments in the argument list being parsed?
*
* @return whether more args exist
- * @throws ParseException
*/
public boolean hasMoreArguments() throws ParseException {
int ch = sp.peek();
@@ -114,10 +113,8 @@ public class FunctionQParser extends QPa
return (! (ch == 0 || ch == ')') );
}
- /**
+ /*
* TODO: Doc
- *
- * @throws ParseException
*/
public String parseId() throws ParseException {
String value = parseArg();
@@ -129,7 +126,6 @@ public class FunctionQParser extends QPa
* Parse a float.
*
* @return Float
- * @throws ParseException
*/
public Float parseFloat() throws ParseException {
String str = parseArg();
@@ -141,7 +137,6 @@ public class FunctionQParser extends QPa
/**
* Parse a Double
* @return double
- * @throws ParseException
*/
public double parseDouble() throws ParseException {
String str = parseArg();
@@ -153,7 +148,6 @@ public class FunctionQParser extends QPa
/**
* Parse an integer
* @return An int
- * @throws ParseException
*/
public int parseInt() throws ParseException {
String str = parseArg();
@@ -214,7 +208,6 @@ public class FunctionQParser extends QPa
* to a ValueSource.
*
* @return List<ValueSource>
- * @throws ParseException
*/
public List<ValueSource> parseValueSourceList() throws ParseException {
List<ValueSource> sources = new ArrayList<ValueSource>(3);
@@ -226,18 +219,14 @@ public class FunctionQParser extends QPa
/**
* Parse an individual ValueSource.
- *
- * @throws ParseException
*/
public ValueSource parseValueSource() throws ParseException {
/* consume the delimiter afterward for an external call to parseValueSource */
return parseValueSource(true);
}
- /**
+ /*
* TODO: Doc
- *
- * @throws ParseException
*/
public Query parseNestedQuery() throws ParseException {
Query nestedQuery;
@@ -286,7 +275,6 @@ public class FunctionQParser extends QPa
* Parse an individual value source.
*
* @param doConsumeDelimiter whether to consume a delimiter following the ValueSource
- * @throws ParseException
*/
protected ValueSource parseValueSource(boolean doConsumeDelimiter) throws ParseException {
ValueSource valueSource;
@@ -390,7 +378,6 @@ public class FunctionQParser extends QPa
* Only consumes if more arguments should exist (no ending parens or end of string).
*
* @return whether a delimiter was consumed
- * @throws ParseException
*/
protected boolean consumeArgumentDelimiter() throws ParseException {
/* if a list of args is ending, don't expect the comma */
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/Grouping.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/Grouping.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/Grouping.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/Grouping.java Thu Oct 25 13:10:25 2012
@@ -97,9 +97,6 @@ public class Grouping {
public DocList mainResult; // output if one of the grouping commands should be used as the main result.
/**
- * @param searcher
- * @param qr
- * @param cmd
* @param cacheSecondPassSearch Whether to cache the documents and scores from the first pass search for the second
* pass search.
* @param maxDocsPercentageToCache The maximum number of documents in a percentage relative from maxdoc
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/QParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/QParser.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/QParser.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/QParser.java Thu Oct 25 13:10:25 2012
@@ -137,8 +137,6 @@ public abstract class QParser {
/**
* Returns the resulting query from this QParser, calling parse() only the
* first time and caching the Query result.
- *
- * @throws ParseException
*/
public Query getQuery() throws ParseException {
if (query==null) {
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/ReturnFields.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/ReturnFields.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/ReturnFields.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/ReturnFields.java Thu Oct 25 13:10:25 2012
@@ -201,7 +201,7 @@ public class ReturnFields
sp.eatws();
start = sp.pos;
} else {
- if (ch==' ' || ch == ',' || ch==0) {
+ if (Character.isWhitespace(ch) || ch == ',' || ch==0) {
addField( field, key, augmenters, req );
continue;
}
@@ -215,7 +215,7 @@ public class ReturnFields
// we read "key : "
field = sp.getId(null);
ch = sp.ch();
- if (field != null && (ch==' ' || ch == ',' || ch==0)) {
+ if (field != null && (Character.isWhitespace(ch) || ch == ',' || ch==0)) {
rename.add(field, key);
addField( field, key, augmenters, req );
continue;
@@ -231,7 +231,7 @@ public class ReturnFields
field = sp.getGlobbedId(null);
ch = sp.ch();
- if (field != null && (ch==' ' || ch == ',' || ch==0)) {
+ if (field != null && (Character.isWhitespace(ch) || ch == ',' || ch==0)) {
// "*" looks and acts like a glob, but we give it special treatment
if ("*".equals(field)) {
_wantsAllFields = true;
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java Thu Oct 25 13:10:25 2012
@@ -452,7 +452,7 @@ public class SolrIndexSearcher extends I
}
@Override
- public void binaryField(FieldInfo fieldInfo, byte[] value, int offset, int length) throws IOException {
+ public void binaryField(FieldInfo fieldInfo, byte[] value) throws IOException {
doc.add(new StoredField(fieldInfo.name, value));
}
@@ -586,7 +586,6 @@ public class SolrIndexSearcher extends I
* Returns -1 if no document was found.
* This method is primarily intended for clients that want to fetch
* documents using a unique identifier."
- * @param t
* @return the first document number containing the term
*/
public int getFirstMatch(Term t) throws IOException {
@@ -1033,7 +1032,6 @@ public class SolrIndexSearcher extends I
* If the answer was not cached, it may have been inserted into the cache as a result of this call.
* <p>
*
- * @param query
* @param filter may be null
* @return DocSet meeting the specified criteria, should <b>not</b> be modified by the caller.
*/
@@ -1078,13 +1076,12 @@ public class SolrIndexSearcher extends I
* <p>
* FUTURE: The returned DocList may be retrieved from a cache.
*
- * @param query
* @param filter may be null
* @param lsort criteria by which to sort (if null, query relevance is used)
* @param offset offset into the list of documents to return
* @param len maximum number of documents to return
* @return DocList meeting the specified criteria, should <b>not</b> be modified by the caller.
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public DocList getDocList(Query query, Query filter, Sort lsort, int offset, int len) throws IOException {
QueryCommand qc = new QueryCommand();
@@ -1108,13 +1105,12 @@ public class SolrIndexSearcher extends I
* <p>
* FUTURE: The returned DocList may be retrieved from a cache.
*
- * @param query
* @param filterList may be null
* @param lsort criteria by which to sort (if null, query relevance is used)
* @param offset offset into the list of documents to return
* @param len maximum number of documents to return
* @return DocList meeting the specified criteria, should <b>not</b> be modified by the caller.
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public DocList getDocList(Query query, List<Query> filterList, Sort lsort, int offset, int len, int flags) throws IOException {
QueryCommand qc = new QueryCommand();
@@ -1555,13 +1551,12 @@ public class SolrIndexSearcher extends I
* and sorted by <code>sort</code>.
* FUTURE: The returned DocList may be retrieved from a cache.
*
- * @param query
* @param filter may be null
* @param lsort criteria by which to sort (if null, query relevance is used)
* @param offset offset into the list of documents to return
* @param len maximum number of documents to return
* @return DocList meeting the specified criteria, should <b>not</b> be modified by the caller.
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public DocList getDocList(Query query, DocSet filter, Sort lsort, int offset, int len) throws IOException {
QueryCommand qc = new QueryCommand();
@@ -1587,13 +1582,12 @@ public class SolrIndexSearcher extends I
* <p>
* The DocList and DocSet returned should <b>not</b> be modified.
*
- * @param query
* @param filter may be null
* @param lsort criteria by which to sort (if null, query relevance is used)
* @param offset offset into the list of documents to return
* @param len maximum number of documents to return
* @return DocListAndSet meeting the specified criteria, should <b>not</b> be modified by the caller.
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public DocListAndSet getDocListAndSet(Query query, Query filter, Sort lsort, int offset, int len) throws IOException {
QueryCommand qc = new QueryCommand();
@@ -1620,14 +1614,13 @@ public class SolrIndexSearcher extends I
* <p>
* The DocList and DocSet returned should <b>not</b> be modified.
*
- * @param query
* @param filter may be null
* @param lsort criteria by which to sort (if null, query relevance is used)
* @param offset offset into the list of documents to return
* @param len maximum number of documents to return
* @param flags user supplied flags for the result set
* @return DocListAndSet meeting the specified criteria, should <b>not</b> be modified by the caller.
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public DocListAndSet getDocListAndSet(Query query, Query filter, Sort lsort, int offset, int len, int flags) throws IOException {
QueryCommand qc = new QueryCommand();
@@ -1658,13 +1651,12 @@ public class SolrIndexSearcher extends I
* <p>
* The DocList and DocSet returned should <b>not</b> be modified.
*
- * @param query
* @param filterList may be null
* @param lsort criteria by which to sort (if null, query relevance is used)
* @param offset offset into the list of documents to return
* @param len maximum number of documents to return
* @return DocListAndSet meeting the specified criteria, should <b>not</b> be modified by the caller.
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public DocListAndSet getDocListAndSet(Query query, List<Query> filterList, Sort lsort, int offset, int len) throws IOException {
QueryCommand qc = new QueryCommand();
@@ -1693,14 +1685,13 @@ public class SolrIndexSearcher extends I
* <p>
* The DocList and DocSet returned should <b>not</b> be modified.
*
- * @param query
* @param filterList may be null
* @param lsort criteria by which to sort (if null, query relevance is used)
* @param offset offset into the list of documents to return
* @param len maximum number of documents to return
* @param flags user supplied flags for the result set
* @return DocListAndSet meeting the specified criteria, should <b>not</b> be modified by the caller.
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public DocListAndSet getDocListAndSet(Query query, List<Query> filterList, Sort lsort, int offset, int len, int flags) throws IOException {
QueryCommand qc = new QueryCommand();
@@ -1723,13 +1714,12 @@ public class SolrIndexSearcher extends I
* <p>
* FUTURE: The returned DocList may be retrieved from a cache.
*
- * @param query
* @param filter may be null
* @param lsort criteria by which to sort (if null, query relevance is used)
* @param offset offset into the list of documents to return
* @param len maximum number of documents to return
* @return DocListAndSet meeting the specified criteria, should <b>not</b> be modified by the caller.
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public DocListAndSet getDocListAndSet(Query query, DocSet filter, Sort lsort, int offset, int len) throws IOException {
QueryCommand qc = new QueryCommand();
@@ -1756,14 +1746,13 @@ public class SolrIndexSearcher extends I
* <p>
* The DocList and DocSet returned should <b>not</b> be modified.
*
- * @param query
* @param filter may be null
* @param lsort criteria by which to sort (if null, query relevance is used)
* @param offset offset into the list of documents to return
* @param len maximum number of documents to return
* @param flags user supplied flags for the result set
* @return DocListAndSet meeting the specified criteria, should <b>not</b> be modified by the caller.
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public DocListAndSet getDocListAndSet(Query query, DocSet filter, Sort lsort, int offset, int len, int flags) throws IOException {
QueryCommand qc = new QueryCommand();
@@ -1827,10 +1816,8 @@ public class SolrIndexSearcher extends I
* <p>
* This method is cache-aware and may check as well as modify the cache.
*
- * @param a
- * @param b
- * @return the numer of documents in the intersection between <code>a</code> and <code>b</code>.
- * @throws IOException
+ * @return the number of documents in the intersection between <code>a</code> and <code>b</code>.
+ * @throws IOException If there is a low-level I/O error.
*/
public int numDocs(Query a, DocSet b) throws IOException {
// Negative query if absolute value different from original
@@ -1861,10 +1848,8 @@ public class SolrIndexSearcher extends I
* <p>
* This method is cache-aware and may check as well as modify the cache.
*
- * @param a
- * @param b
- * @return the numer of documents in the intersection between <code>a</code> and <code>b</code>.
- * @throws IOException
+ * @return the number of documents in the intersection between <code>a</code> and <code>b</code>.
+ * @throws IOException If there is a low-level I/O error.
*/
public int numDocs(Query a, Query b) throws IOException {
Query absA = QueryUtils.getAbs(a);
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/SurroundQParserPlugin.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/SurroundQParserPlugin.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/SurroundQParserPlugin.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/SurroundQParserPlugin.java Thu Oct 25 13:10:25 2012
@@ -34,8 +34,8 @@ import org.slf4j.LoggerFactory;
* Plugin for lucene/contrib Surround query parser, bringing SpanQuery support
* to Solr
*
- * <queryParser name="surround"
- * class="org.apache.solr.search.SurroundQParserPlugin" />
+ * <queryParser name="surround"
+ * class="org.apache.solr.search.SurroundQParserPlugin" />
*
* Examples of query syntax can be found in lucene/queryparser/docs/surround
*
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/ValueSourceParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/ValueSourceParser.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/ValueSourceParser.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/ValueSourceParser.java Thu Oct 25 13:10:25 2012
@@ -60,9 +60,6 @@ public abstract class ValueSourceParser
/**
* Parse the user input into a ValueSource.
- *
- * @param fp
- * @throws ParseException
*/
public abstract ValueSource parse(FunctionQParser fp) throws ParseException;
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/function/distance/HaversineFunction.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/function/distance/HaversineFunction.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/function/distance/HaversineFunction.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/function/distance/HaversineFunction.java Thu Oct 25 13:10:25 2012
@@ -66,8 +66,6 @@ public class HaversineFunction extends V
/**
* @param doc The doc to score
- * @param p1DV
- * @param p2DV
* @return The haversine distance formula
*/
protected double distance(int doc, FunctionValues p1DV, FunctionValues p2DV) {
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/function/distance/StringDistanceFunction.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/function/distance/StringDistanceFunction.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/function/distance/StringDistanceFunction.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/search/function/distance/StringDistanceFunction.java Thu Oct 25 13:10:25 2012
@@ -35,11 +35,6 @@ public class StringDistanceFunction exte
protected ValueSource str1, str2;
protected StringDistance dist;
- /**
- * @param str1
- * @param str2
- * @param measure
- */
public StringDistanceFunction(ValueSource str1, ValueSource str2, StringDistance measure) {
this.str1 = str1;
this.str2 = str2;
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java Thu Oct 25 13:10:25 2012
@@ -493,20 +493,24 @@ public class SolrDispatchFilter implemen
* filter into a larger web application.
*
* For example, if web.xml specifies:
- *
+ * <pre class="prettyprint">
+ * {@code
* <filter-mapping>
* <filter-name>SolrRequestFilter</filter-name>
* <url-pattern>/xxx/*</url-pattern>
- * </filter-mapping>
+ * </filter-mapping>}
+ * </pre>
*
* Make sure to set the PathPrefix to "/xxx" either with this function
* or in web.xml.
*
+ * <pre class="prettyprint">
+ * {@code
* <init-param>
* <param-name>path-prefix</param-name>
* <param-value>/xxx</param-value>
- * </init-param>
- *
+ * </init-param>}
+ * </pre>
*/
public void setPathPrefix(String pathPrefix) {
this.pathPrefix = pathPrefix;
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/servlet/cache/HttpCacheHeaderUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/servlet/cache/HttpCacheHeaderUtil.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/servlet/cache/HttpCacheHeaderUtil.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/servlet/cache/HttpCacheHeaderUtil.java Thu Oct 25 13:10:25 2012
@@ -91,7 +91,6 @@ public final class HttpCacheHeaderUtil {
/**
* Calculates a tag for the ETag header.
*
- * @param solrReq
* @return a tag
*/
public static String calcEtag(final SolrQueryRequest solrReq) {
@@ -139,7 +138,6 @@ public final class HttpCacheHeaderUtil {
/**
* Calculate the appropriate last-modified time for Solr relative the current request.
*
- * @param solrReq
* @return the timestamp to use as a last modified time.
*/
public static long calcLastModified(final SolrQueryRequest solrReq) {
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/spelling/AbstractLuceneSpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/spelling/AbstractLuceneSpellChecker.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/spelling/AbstractLuceneSpellChecker.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/spelling/AbstractLuceneSpellChecker.java Thu Oct 25 13:10:25 2012
@@ -224,7 +224,7 @@ public abstract class AbstractLuceneSpel
/**
* Initialize the {@link #index} variable based on the {@link #indexDir}. Does not actually create the spelling index.
*
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
protected void initIndex() throws IOException {
if (indexDir != null) {
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/spelling/PossibilityIterator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/spelling/PossibilityIterator.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/spelling/PossibilityIterator.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/spelling/PossibilityIterator.java Thu Oct 25 13:10:25 2012
@@ -63,8 +63,6 @@ public class PossibilityIterator impleme
* We assume here that the passed-in inner LinkedHashMaps are already sorted
* in order of "Best Possible Correction".
* </p>
- *
- * @param suggestions
*/
public PossibilityIterator(
Map<Token,LinkedHashMap<String,Integer>> suggestions,
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/spelling/QueryConverter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/spelling/QueryConverter.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/spelling/QueryConverter.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/spelling/QueryConverter.java Thu Oct 25 13:10:25 2012
@@ -81,8 +81,7 @@ public abstract class QueryConverter imp
}
/**
- * @param original
- * @return The Collection of {@link org.apache.lucene.analysis.Token}s for
+ * Returns the Collection of {@link org.apache.lucene.analysis.Token}s for
* the query. Offsets on the Token should correspond to the correct
* offset in the origQuery
*/
@@ -90,8 +89,6 @@ public abstract class QueryConverter imp
/**
* Set the analyzer to use. Must be set before any calls to convert.
- *
- * @param analyzer
*/
public void setAnalyzer(Analyzer analyzer) {
this.analyzer = analyzer;
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/spelling/SolrSpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/spelling/SolrSpellChecker.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/spelling/SolrSpellChecker.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/spelling/SolrSpellChecker.java Thu Oct 25 13:10:25 2012
@@ -78,11 +78,6 @@ public abstract class SolrSpellChecker {
}
/**
* Integrate spelling suggestions from the various shards in a distributed environment.
- *
- * @param mergeData
- * @param numSug
- * @param count
- * @param extendedResults
*/
public SpellingResult mergeSuggestions(SpellCheckMergeData mergeData, int numSug, int count, boolean extendedResults) {
float min = 0.5f;
@@ -160,7 +155,7 @@ public abstract class SolrSpellChecker {
/**
* Reloads the index. Useful if an external process is responsible for building the spell checker.
*
- * @throws java.io.IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public abstract void reload(SolrCore core, SolrIndexSearcher searcher) throws IOException;
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/spelling/suggest/Suggester.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/spelling/suggest/Suggester.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/spelling/suggest/Suggester.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/spelling/suggest/Suggester.java Thu Oct 25 13:10:25 2012
@@ -32,11 +32,12 @@ import org.apache.lucene.search.spell.Di
import org.apache.lucene.search.spell.HighFrequencyDictionary;
import org.apache.lucene.search.spell.SuggestMode;
import org.apache.lucene.search.suggest.FileDictionary;
-import org.apache.lucene.search.suggest.Lookup;
import org.apache.lucene.search.suggest.Lookup.LookupResult;
+import org.apache.lucene.search.suggest.Lookup;
+import org.apache.lucene.search.suggest.analyzing.AnalyzingSuggester;
+import org.apache.lucene.search.suggest.fst.WFSTCompletionLookup;
import org.apache.lucene.util.CharsRef;
import org.apache.lucene.util.IOUtils;
-
import org.apache.solr.common.util.NamedList;
import org.apache.solr.core.SolrCore;
import org.apache.solr.search.SolrIndexSearcher;
@@ -187,8 +188,10 @@ public class Suggester extends SolrSpell
scratch.chars = t.buffer();
scratch.offset = 0;
scratch.length = t.length();
- List<LookupResult> suggestions = lookup.lookup(scratch,
- (options.suggestMode == SuggestMode.SUGGEST_MORE_POPULAR), options.count);
+ boolean onlyMorePopular = (options.suggestMode == SuggestMode.SUGGEST_MORE_POPULAR) &&
+ !(lookup instanceof WFSTCompletionLookup) &&
+ !(lookup instanceof AnalyzingSuggester);
+ List<LookupResult> suggestions = lookup.lookup(scratch, onlyMorePopular, options.count);
if (suggestions == null) {
continue;
}
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java Thu Oct 25 13:10:25 2012
@@ -39,7 +39,6 @@ public final class DefaultSolrCoreState
// protects pauseWriter and writerFree
private final Object writerPauseLock = new Object();
- private int refCnt = 1;
private SolrIndexWriter indexWriter = null;
private DirectoryFactory directoryFactory;
@@ -56,6 +55,21 @@ public final class DefaultSolrCoreState
this.directoryFactory = directoryFactory;
}
+ private synchronized void closeIndexWriter(IndexWriterCloser closer) {
+ try {
+ log.info("SolrCoreState ref count has reached 0 - closing IndexWriter");
+ if (closer != null) {
+ log.info("closing IndexWriter with IndexWriterCloser");
+ closer.closeWriter(indexWriter);
+ } else if (indexWriter != null) {
+ log.info("closing IndexWriter...");
+ indexWriter.close();
+ }
+ } catch (Throwable t) {
+ log.error("Error during shutdown of writer.", t);
+ }
+ }
+
@Override
public synchronized RefCounted<IndexWriter> getIndexWriter(SolrCore core)
throws IOException {
@@ -76,17 +90,7 @@ public final class DefaultSolrCoreState
if (indexWriter == null) {
indexWriter = createMainIndexWriter(core, "DirectUpdateHandler2", false);
}
- if (refCntWriter == null) {
- refCntWriter = new RefCounted<IndexWriter>(indexWriter) {
- @Override
- public void close() {
- synchronized (writerPauseLock) {
- writerFree = true;
- writerPauseLock.notifyAll();
- }
- }
- };
- }
+ initRefCntWriter();
writerFree = false;
writerPauseLock.notifyAll();
refCntWriter.incref();
@@ -94,6 +98,20 @@ public final class DefaultSolrCoreState
}
}
+ private void initRefCntWriter() {
+ if (refCntWriter == null) {
+ refCntWriter = new RefCounted<IndexWriter>(indexWriter) {
+ @Override
+ public void close() {
+ synchronized (writerPauseLock) {
+ writerFree = true;
+ writerPauseLock.notifyAll();
+ }
+ }
+ };
+ }
+ }
+
@Override
public synchronized void newIndexWriter(SolrCore core, boolean rollback) throws IOException {
log.info("Creating new IndexWriter...");
@@ -143,46 +161,6 @@ public final class DefaultSolrCoreState
}
@Override
- public void decref(IndexWriterCloser closer) {
- synchronized (this) {
- refCnt--;
- if (refCnt == 0) {
- try {
- log.info("SolrCoreState ref count has reached 0 - closing IndexWriter");
- if (closer != null) {
- closer.closeWriter(indexWriter);
- } else if (indexWriter != null) {
- indexWriter.close();
- }
- } catch (Throwable t) {
- log.error("Error during shutdown of writer.", t);
- }
- try {
- directoryFactory.close();
- } catch (Throwable t) {
- log.error("Error during shutdown of directory factory.", t);
- }
- try {
- log.info("Closing SolrCoreState - canceling any ongoing recovery");
- cancelRecovery();
- } catch (Throwable t) {
- log.error("Error cancelling recovery", t);
- }
-
- closed = true;
- }
- }
- }
-
- @Override
- public synchronized void incref() {
- if (refCnt == 0) {
- throw new IllegalStateException("IndexWriter has been closed");
- }
- refCnt++;
- }
-
- @Override
public synchronized void rollbackIndexWriter(SolrCore core) throws IOException {
newIndexWriter(core, true);
}
@@ -269,5 +247,12 @@ public final class DefaultSolrCoreState
public void failed() {
recoveryRunning = false;
}
+
+ @Override
+ public synchronized void close(IndexWriterCloser closer) {
+ closed = true;
+ cancelRecovery();
+ closeIndexWriter(closer);
+ }
}
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java Thu Oct 25 13:10:25 2012
@@ -96,7 +96,7 @@ public class DirectUpdateHandler2 extend
public DirectUpdateHandler2(SolrCore core) {
super(core);
- solrCoreState = new DefaultSolrCoreState(core.getDirectoryFactory());
+ solrCoreState = core.getSolrCoreState();
UpdateHandlerInfo updateHandlerInfo = core.getSolrConfig()
.getUpdateHandlerInfo();
@@ -111,13 +111,7 @@ public class DirectUpdateHandler2 extend
public DirectUpdateHandler2(SolrCore core, UpdateHandler updateHandler) {
super(core);
- if (updateHandler instanceof DirectUpdateHandler2) {
- this.solrCoreState = ((DirectUpdateHandler2) updateHandler).solrCoreState;
- } else {
- // the impl has changed, so we cannot use the old state - decref it
- updateHandler.decref();
- solrCoreState = new DefaultSolrCoreState(core.getDirectoryFactory());
- }
+ solrCoreState = core.getSolrCoreState();
UpdateHandlerInfo updateHandlerInfo = core.getSolrConfig()
.getUpdateHandlerInfo();
@@ -658,8 +652,6 @@ public class DirectUpdateHandler2 extend
softCommitTracker.close();
numDocsPending.set(0);
-
- solrCoreState.decref(this);
}
@@ -817,20 +809,6 @@ public class DirectUpdateHandler2 extend
return solrCoreState;
}
- @Override
- public void decref() {
- try {
- solrCoreState.decref(this);
- } catch (IOException e) {
- throw new SolrException(ErrorCode.SERVER_ERROR, "", e);
- }
- }
-
- @Override
- public void incref() {
- solrCoreState.incref();
- }
-
// allow access for tests
public CommitTracker getCommitTracker() {
return commitTracker;
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/DocumentBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/DocumentBuilder.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/DocumentBuilder.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/DocumentBuilder.java Thu Oct 25 13:10:25 2012
@@ -237,8 +237,7 @@ public class DocumentBuilder {
String name = field.getName();
SchemaField sfield = schema.getFieldOrNull(name);
boolean used = false;
- float boost = field.getBoost();
- boolean applyBoost = sfield != null && sfield.indexed() && !sfield.omitNorms();
+
// Make sure it has the correct number
if( sfield!=null && !sfield.multiValued() && field.getValueCount() > 1 ) {
@@ -247,12 +246,19 @@ public class DocumentBuilder {
sfield.getName() + ": " +field.getValue() );
}
- if (applyBoost == false && boost != 1.0F) {
+ float fieldBoost = field.getBoost();
+ boolean applyBoost = sfield != null && sfield.indexed() && !sfield.omitNorms();
+
+ if (applyBoost == false && fieldBoost != 1.0F) {
throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,
"ERROR: "+getID(doc, schema)+"cannot set an index-time boost, unindexed or norms are omitted for field " +
sfield.getName() + ": " +field.getValue() );
}
+ // Lucene no longer has a native docBoost, so we have to multiply
+ // it ourselves
+ float compoundBoost = fieldBoost * docBoost;
+
// load each field value
boolean hasField = false;
try {
@@ -263,16 +269,20 @@ public class DocumentBuilder {
hasField = true;
if (sfield != null) {
used = true;
- addField(out, sfield, v, applyBoost ? docBoost*boost : 1f);
+ addField(out, sfield, v, applyBoost ? compoundBoost : 1f);
}
- // Check if we should copy this field to any other fields.
+ // Check if we should copy this field value to any other fields.
// This could happen whether it is explicit or not.
List<CopyField> copyFields = schema.getCopyFieldsList(name);
for (CopyField cf : copyFields) {
SchemaField destinationField = cf.getDestination();
+
+ final boolean destHasValues =
+ (null != out.getField(destinationField.getName()));
+
// check if the copy field is a multivalued or not
- if (!destinationField.multiValued() && out.getField(destinationField.getName()) != null) {
+ if (!destinationField.multiValued() && destHasValues) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"ERROR: "+getID(doc, schema)+"multiple values encountered for non multiValued copy field " +
destinationField.getName() + ": " + v);
@@ -285,14 +295,23 @@ public class DocumentBuilder {
if( val instanceof String && cf.getMaxChars() > 0 ) {
val = cf.getLimitedValue((String)val);
}
- addField(out, destinationField, val, destinationField.indexed() && !destinationField.omitNorms() ? docBoost*boost : 1F);
+
+ // we can't copy any boost unless the dest field is
+ // indexed & !omitNorms, but which boost we copy depends
+ // on wether the dest field already contains values (we
+ // don't want to apply the compounded docBoost more then once)
+ final float destBoost =
+ (destinationField.indexed() && !destinationField.omitNorms()) ?
+ (destHasValues ? fieldBoost : compoundBoost) : 1.0F;
+
+ addField(out, destinationField, val, destBoost);
}
- // In lucene, the boost for a given field is the product of the
- // document boost and *all* boosts on values of that field.
+ // The final boost for a given field named is the product of the
+ // *all* boosts on values of that field.
// For multi-valued fields, we only want to set the boost on the
// first field.
- boost = docBoost;
+ fieldBoost = compoundBoost = 1.0f;
}
}
catch( SolrException ex ) {
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/PeerSync.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/PeerSync.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/PeerSync.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/PeerSync.java Thu Oct 25 13:10:25 2012
@@ -19,6 +19,7 @@ package org.apache.solr.update;
import java.io.IOException;
import java.net.ConnectException;
+import java.net.SocketException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -28,6 +29,7 @@ import java.util.Set;
import org.apache.http.NoHttpResponseException;
import org.apache.http.client.HttpClient;
+import org.apache.http.conn.ConnectTimeoutException;
import org.apache.lucene.util.BytesRef;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpClientUtil;
@@ -78,6 +80,7 @@ public class PeerSync {
private long ourLowThreshold; // 20th percentile
private long ourHighThreshold; // 80th percentile
private boolean cantReachIsSuccess;
+ private boolean getNoVersionsIsSuccess;
private static final HttpClient client;
static {
ModifiableSolrParams params = new ModifiableSolrParams();
@@ -128,20 +131,15 @@ public class PeerSync {
}
public PeerSync(SolrCore core, List<String> replicas, int nUpdates) {
- this(core, replicas, nUpdates, false);
+ this(core, replicas, nUpdates, false, true);
}
- /**
- *
- * @param core
- * @param replicas
- * @param nUpdates
- */
- public PeerSync(SolrCore core, List<String> replicas, int nUpdates, boolean cantReachIsSuccess) {
+ public PeerSync(SolrCore core, List<String> replicas, int nUpdates, boolean cantReachIsSuccess, boolean getNoVersionsIsSuccess) {
this.replicas = replicas;
this.nUpdates = nUpdates;
this.maxUpdates = nUpdates;
this.cantReachIsSuccess = cantReachIsSuccess;
+ this.getNoVersionsIsSuccess = getNoVersionsIsSuccess;
uhandler = core.getUpdateHandler();
@@ -305,8 +303,8 @@ public class PeerSync {
if (cantReachIsSuccess && sreq.purpose == 1 && srsp.getException() instanceof SolrServerException) {
Throwable solrException = ((SolrServerException) srsp.getException())
.getRootCause();
- if (solrException instanceof ConnectException
- || solrException instanceof NoHttpResponseException) {
+ if (solrException instanceof ConnectException || solrException instanceof ConnectTimeoutException
+ || solrException instanceof NoHttpResponseException || solrException instanceof SocketException) {
log.warn(msg() + " couldn't connect to " + srsp.getShardAddress() + ", counting as success");
return true;
@@ -317,6 +315,11 @@ public class PeerSync {
log.warn(msg() + " got a 503 from " + srsp.getShardAddress() + ", counting as success");
return true;
}
+
+ if (cantReachIsSuccess && sreq.purpose == 1 && srsp.getException() instanceof SolrException && ((SolrException) srsp.getException()).code() == 404) {
+ log.warn(msg() + " got a 404 from " + srsp.getShardAddress() + ", counting as success");
+ return true;
+ }
// TODO: at least log???
// srsp.getException().printStackTrace(System.out);
@@ -343,7 +346,7 @@ public class PeerSync {
log.info(msg() + " Received " + otherVersions.size() + " versions from " + sreq.shards[0] );
if (otherVersions.size() == 0) {
- return true;
+ return getNoVersionsIsSuccess;
}
boolean completeList = otherVersions.size() < nUpdates; // do we have their complete list of updates?
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java Thu Oct 25 13:10:25 2012
@@ -101,7 +101,6 @@ public class SolrCmdDistributor {
public void finish() {
- // piggyback on any outstanding adds or deletes if possible.
flushAdds(1);
flushDeletes(1);
@@ -150,6 +149,12 @@ public class SolrCmdDistributor {
public void distribCommit(CommitUpdateCommand cmd, List<Node> nodes,
ModifiableSolrParams params) throws IOException {
+
+ // make sure we are ordered
+ flushAdds(1);
+ flushDeletes(1);
+
+
// Wait for all outstanding responses to make sure that a commit
// can't sneak in ahead of adds or deletes we already sent.
// We could do this on a per-server basis, but it's more complex
@@ -163,7 +168,7 @@ public class SolrCmdDistributor {
addCommit(ureq, cmd);
- log.info("Distrib commit to:" + nodes);
+ log.info("Distrib commit to:" + nodes + " params:" + params);
for (Node node : nodes) {
submit(ureq, node);
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/SolrCoreState.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/SolrCoreState.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/SolrCoreState.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/SolrCoreState.java Thu Oct 25 13:10:25 2012
@@ -41,9 +41,8 @@ public abstract class SolrCoreState {
* Force the creation of a new IndexWriter using the settings from the given
* SolrCore.
*
- * @param core
* @param rollback close IndexWriter if false, else rollback
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public abstract void newIndexWriter(SolrCore core, boolean rollback) throws IOException;
@@ -51,30 +50,15 @@ public abstract class SolrCoreState {
* Get the current IndexWriter. If a new IndexWriter must be created, use the
* settings from the given {@link SolrCore}.
*
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public abstract RefCounted<IndexWriter> getIndexWriter(SolrCore core) throws IOException;
/**
- * Decrement the number of references to this state. When then number of
- * references hits 0, the state will close. If an optional closer is
- * passed, that will be used to close the writer.
- *
- * @throws IOException
- */
- public abstract void decref(IndexWriterCloser closer) throws IOException;
-
- /**
- * Increment the number of references to this state.
- */
- public abstract void incref();
-
- /**
* Rollback the current IndexWriter. When creating the new IndexWriter use the
* settings from the given {@link SolrCore}.
*
- * @param core
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public abstract void rollbackIndexWriter(SolrCore core) throws IOException;
@@ -92,4 +76,6 @@ public abstract class SolrCoreState {
public abstract void cancelRecovery();
+ public abstract void close(IndexWriterCloser closer);
+
}
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java Thu Oct 25 13:10:25 2012
@@ -44,6 +44,7 @@ public class SolrIndexConfig {
public final boolean useCompoundFile;
public final int maxBufferedDocs;
public final int maxMergeDocs;
+ public final int maxIndexingThreads;
public final int mergeFactor;
public final double ramBufferSizeMB;
@@ -71,6 +72,7 @@ public class SolrIndexConfig {
useCompoundFile = false;
maxBufferedDocs = -1;
maxMergeDocs = -1;
+ maxIndexingThreads = IndexWriterConfig.DEFAULT_MAX_THREAD_STATES;
mergeFactor = -1;
ramBufferSizeMB = 32;
writeLockTimeout = -1;
@@ -116,6 +118,7 @@ public class SolrIndexConfig {
useCompoundFile=solrConfig.getBool(prefix+"/useCompoundFile", def.useCompoundFile);
maxBufferedDocs=solrConfig.getInt(prefix+"/maxBufferedDocs",def.maxBufferedDocs);
maxMergeDocs=solrConfig.getInt(prefix+"/maxMergeDocs",def.maxMergeDocs);
+ maxIndexingThreads=solrConfig.getInt(prefix+"/maxIndexingThreads",def.maxIndexingThreads);
mergeFactor=solrConfig.getInt(prefix+"/mergeFactor",def.mergeFactor);
ramBufferSizeMB = solrConfig.getDouble(prefix+"/ramBufferSizeMB", def.ramBufferSizeMB);
@@ -176,6 +179,10 @@ public class SolrIndexConfig {
iwc.setMergePolicy(buildMergePolicy(schema));
iwc.setMergeScheduler(buildMergeScheduler(schema));
+ if (maxIndexingThreads != -1) {
+ iwc.setMaxThreadStates(maxIndexingThreads);
+ }
+
return iwc;
}
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/SolrIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/SolrIndexWriter.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/SolrIndexWriter.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/update/SolrIndexWriter.java Thu Oct 25 13:10:25 2012
@@ -60,7 +60,7 @@ public class SolrIndexWriter extends Ind
final Directory d = directoryFactory.get(path, config.lockType, forceNewDirectory);
try {
w = new SolrIndexWriter(name, path, d, create, schema,
- config, delPolicy, codec, forceNewDirectory);
+ config, delPolicy, codec);
w.setDirectoryFactory(directoryFactory);
return w;
} finally {
@@ -71,7 +71,7 @@ public class SolrIndexWriter extends Ind
}
}
- private SolrIndexWriter(String name, String path, Directory directory, boolean create, IndexSchema schema, SolrIndexConfig config, IndexDeletionPolicy delPolicy, Codec codec, boolean forceNewDirectory) throws IOException {
+ private SolrIndexWriter(String name, String path, Directory directory, boolean create, IndexSchema schema, SolrIndexConfig config, IndexDeletionPolicy delPolicy, Codec codec) throws IOException {
super(directory,
config.toIndexWriterConfig(schema).
setOpenMode(create ? IndexWriterConfig.OpenMode.CREATE : IndexWriterConfig.OpenMode.APPEND).