You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2011/12/09 03:19:48 UTC
svn commit: r1212221 [4/4] - in /lucene/dev/branches/solrcloud: ./
dev-tools/eclipse/ dev-tools/idea/lucene/contrib/
dev-tools/maven/lucene/contrib/misc/ lucene/
lucene/contrib/memory/src/java/org/apache/lucene/index/memory/
lucene/contrib/memory/src/t...
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/FloatField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/FloatField.java?rev=1212221&r1=1212220&r2=1212221&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/FloatField.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/FloatField.java Fri Dec 9 02:19:42 2011
@@ -27,7 +27,18 @@ import org.apache.solr.response.TextResp
import java.util.Map;
import java.io.IOException;
/**
+ * A legacy numeric field type that encodes "Float" values as simple Strings.
+ * This class should not be used except by people with existing indexes that
+ * contain numeric values indexed as Strings.
+ * New schemas should use {@link TrieFloatField}.
*
+ * <p>
+ * Field values will sort numerically, but Range Queries (and other features
+ * that rely on numeric ranges) will not work as expected: values will be
+ * evaluated in unicode String order, not numeric order.
+ * </p>
+ *
+ * @see TrieFloatField
*/
public class FloatField extends FieldType {
@Override
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/IntField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/IntField.java?rev=1212221&r1=1212220&r2=1212221&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/IntField.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/IntField.java Fri Dec 9 02:19:42 2011
@@ -27,7 +27,18 @@ import org.apache.solr.response.TextResp
import java.util.Map;
import java.io.IOException;
/**
+ * A legacy numeric field type that encodes "Integer" values as simple Strings.
+ * This class should not be used except by people with existing indexes that
+ * contain numeric values indexed as Strings.
+ * New schemas should use {@link TrieIntField}.
*
+ * <p>
+ * Field values will sort numerically, but Range Queries (and other features
+ * that rely on numeric ranges) will not work as expected: values will be
+ * evaluated in unicode String order, not numeric order.
+ * </p>
+ *
+ * @see TrieIntField
*/
public class IntField extends FieldType {
@Override
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/LongField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/LongField.java?rev=1212221&r1=1212220&r2=1212221&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/LongField.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/LongField.java Fri Dec 9 02:19:42 2011
@@ -27,7 +27,18 @@ import org.apache.solr.search.QParser;
import java.io.IOException;
import java.util.Map;
/**
+ * A legacy numeric field type that encodes "Long" values as simple Strings.
+ * This class should not be used except by people with existing indexes that
+ * contain numeric values indexed as Strings.
+ * New schemas should use {@link TrieLongField}.
*
+ * <p>
+ * Field values will sort numerically, but Range Queries (and other features
+ * that rely on numeric ranges) will not work as expected: values will be
+ * evaluated in unicode String order, not numeric order.
+ * </p>
+ *
+ * @see TrieLongField
*/
public class LongField extends FieldType {
@Override
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/ShortField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/ShortField.java?rev=1212221&r1=1212220&r2=1212221&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/ShortField.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/ShortField.java Fri Dec 9 02:19:42 2011
@@ -29,8 +29,21 @@ import java.util.Map;
/**
+ * A numeric field that can contain 16-bit signed two's complement integer
+ * values, encoded as simple Strings.
*
+ * <p>
+ * Field values will sort numerically, but Range Queries (and other features
+ * that rely on numeric ranges) will not work as expected: values will be
+ * evaluated in unicode String order, not numeric order.
+ * </p>
*
+ * <ul>
+ * <li>Min Value Allowed: -32768</li>
+ * <li>Max Value Allowed: 32767</li>
+ * </ul>
+ *
+ * @see Short
**/
public class ShortField extends FieldType {
@Override
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/SortableDoubleField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/SortableDoubleField.java?rev=1212221&r1=1212220&r2=1212221&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/SortableDoubleField.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/SortableDoubleField.java Fri Dec 9 02:19:42 2011
@@ -36,8 +36,19 @@ import org.apache.solr.response.TextResp
import java.util.Map;
import java.io.IOException;
/**
+ * A legacy numeric field type that encodes "Double" values as Strings such
+ * that Term enumeration order matches the natural numeric order. This class
+ * should not be used except by people with existing indexes that already
+ * contain fields of this type. New schemas should use {@link TrieDoubleField}.
*
+ * <p>
+ * The naming convention "Sortable" comes from the fact that both the numeric
+ * values and encoded String representations Sort identically (as opposed to
+ * a direct String representation where values such as "11" sort before values
+ * such as "2").
+ * </p>
*
+ * @see TrieDoubleField
* @deprecated use {@link DoubleField} or {@link TrieDoubleField} - will be removed in 5.x
*/
@Deprecated
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/SortableFloatField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/SortableFloatField.java?rev=1212221&r1=1212220&r2=1212221&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/SortableFloatField.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/SortableFloatField.java Fri Dec 9 02:19:42 2011
@@ -35,9 +35,21 @@ import org.apache.solr.response.TextResp
import java.util.Map;
import java.io.IOException;
+
/**
+ * A legacy numeric field type that encodes "Float" values as Strings such
+ * that Term enumeration order matches the natural numeric order. This class
+ * should not be used except by people with existing indexes that already
+ * contain fields of this type. New schemas should use {@link TrieFloatField}.
+ *
+ * <p>
+ * The naming convention "Sortable" comes from the fact that both the numeric
+ * values and encoded String representations Sort identically (as opposed to
+ * a direct String representation where values such as "11" sort before values
+ * such as "2").
+ * </p>
*
- *
+ * @see TrieFloatField
* @deprecated use {@link FloatField} or {@link TrieFloatField} - will be removed in 5.x
*/
@Deprecated
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/SortableIntField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/SortableIntField.java?rev=1212221&r1=1212220&r2=1212221&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/SortableIntField.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/SortableIntField.java Fri Dec 9 02:19:42 2011
@@ -35,9 +35,21 @@ import org.apache.solr.response.TextResp
import java.util.Map;
import java.io.IOException;
+
/**
+ * A legacy numeric field type that encodes "Integer" values as Strings such
+ * that Term enumeration order matches the natural numeric order. This class
+ * should not be used except by people with existing indexes that already
+ * contain fields of this type. New schemas should use {@link TrieIntField}.
*
+ * <p>
+ * The naming convention "Sortable" comes from the fact that both the numeric
+ * values and encoded String representations Sort identically (as opposed to
+ * a direct String representation where values such as "11" sort before values
+ * such as "2").
+ * </p>
*
+ * @see TrieIntField
* @deprecated use {@link IntField} or {@link TrieIntField} - will be removed in 5.x
*/
@Deprecated
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/SortableLongField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/SortableLongField.java?rev=1212221&r1=1212220&r2=1212221&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/SortableLongField.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/SortableLongField.java Fri Dec 9 02:19:42 2011
@@ -36,8 +36,19 @@ import org.apache.solr.response.TextResp
import java.util.Map;
import java.io.IOException;
/**
+ * A legacy numeric field type that encodes "Long" values as Strings such
+ * that Term enumeration order matches the natural numeric order. This class
+ * should not be used except by people with existing indexes that already
+ * contain fields of this type. New schemas should use {@link TrieLongField}.
*
+ * <p>
+ * The naming convention "Sortable" comes from the fact that both the numeric
+ * values and encoded String representations Sort identically (as opposed to
+ * a direct String representation where values such as "11" sort before values
+ * such as "2").
+ * </p>
*
+ * @see TrieLongField
* @deprecated use {@link LongField} or {@link TrieLongField} - will be removed in 5.x
*/
@Deprecated
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/TrieDoubleField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/TrieDoubleField.java?rev=1212221&r1=1212220&r2=1212221&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/TrieDoubleField.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/TrieDoubleField.java Fri Dec 9 02:19:42 2011
@@ -17,6 +17,22 @@
package org.apache.solr.schema;
+/**
+ * A numeric field that can contain double-precision 64-bit IEEE 754 floating
+ * point values.
+ *
+ * <ul>
+ * <li>Min Value Allowed: 4.9E-324</li>
+ * <li>Max Value Allowed: 1.7976931348623157E308</li>
+ * </ul>
+ *
+ * <b>NOTE:</b> The behavior of this class when given values of
+ * {@link Double#NaN}, {@link Double#NEGATIVE_INFINITY}, or
+ * {@link Double#POSITIVE_INFINITY} is undefined.
+ *
+ * @see Double
+ * @see <a href="http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.2.3">Java Language Specification, s4.2.3</a>
+ */
public class TrieDoubleField extends TrieField {
{
type=TrieTypes.DOUBLE;
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/TrieFloatField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/TrieFloatField.java?rev=1212221&r1=1212220&r2=1212221&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/TrieFloatField.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/TrieFloatField.java Fri Dec 9 02:19:42 2011
@@ -17,6 +17,22 @@
package org.apache.solr.schema;
+/**
+ * A numeric field that can contain single-precision 32-bit IEEE 754
+ * floating point values.
+ *
+ * <ul>
+ * <li>Min Value Allowed: 1.401298464324817E-45</li>
+ * <li>Max Value Allowed: 3.4028234663852886E38</li>
+ * </ul>
+ *
+ * <b>NOTE:</b> The behavior of this class when given values of
+ * {@link Float#NaN}, {@link Float#NEGATIVE_INFINITY}, or
+ * {@link Float#POSITIVE_INFINITY} is undefined.
+ *
+ * @see Float
+ * @see <a href="http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.2.3">Java Language Specification, s4.2.3</a>
+ */
public class TrieFloatField extends TrieField {
{
type=TrieTypes.FLOAT;
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/TrieIntField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/TrieIntField.java?rev=1212221&r1=1212220&r2=1212221&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/TrieIntField.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/TrieIntField.java Fri Dec 9 02:19:42 2011
@@ -17,6 +17,16 @@
package org.apache.solr.schema;
+/**
+ * A numeric field that can contain 32-bit signed two's complement integer values.
+ *
+ * <ul>
+ * <li>Min Value Allowed: -2147483648</li>
+ * <li>Max Value Allowed: 2147483647</li>
+ * </ul>
+ *
+ * @see Integer
+ */
public class TrieIntField extends TrieField {
{
type=TrieTypes.INTEGER;
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/TrieLongField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/TrieLongField.java?rev=1212221&r1=1212220&r2=1212221&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/TrieLongField.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/TrieLongField.java Fri Dec 9 02:19:42 2011
@@ -17,6 +17,16 @@
package org.apache.solr.schema;
+/**
+ * A numeric field that can contain 64-bit signed two's complement integer values.
+ *
+ * <ul>
+ * <li>Min Value Allowed: -9223372036854775808</li>
+ * <li>Max Value Allowed: 9223372036854775807</li>
+ * </ul>
+ *
+ * @see Long
+ */
public class TrieLongField extends TrieField {
{
type=TrieTypes.LONG;
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/JoinQParserPlugin.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/JoinQParserPlugin.java?rev=1212221&r1=1212220&r2=1212221&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/JoinQParserPlugin.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/JoinQParserPlugin.java Fri Dec 9 02:19:42 2011
@@ -314,7 +314,7 @@ class JoinQuery extends Query {
if (freq < minDocFreqFrom) {
fromTermDirectCount++;
// OK to skip liveDocs, since we check for intersection with docs matching query
- fromDeState.docsEnum = fromDeState.termsEnum.docs(null, fromDeState.docsEnum);
+ fromDeState.docsEnum = fromDeState.termsEnum.docs(null, fromDeState.docsEnum, false);
DocsEnum docsEnum = fromDeState.docsEnum;
if (docsEnum instanceof MultiDocsEnum) {
@@ -379,7 +379,7 @@ class JoinQuery extends Query {
toTermDirectCount++;
// need to use liveDocs here so we don't map to any deleted ones
- toDeState.docsEnum = toDeState.termsEnum.docs(toDeState.liveDocs, toDeState.docsEnum);
+ toDeState.docsEnum = toDeState.termsEnum.docs(toDeState.liveDocs, toDeState.docsEnum, false);
DocsEnum docsEnum = toDeState.docsEnum;
if (docsEnum instanceof MultiDocsEnum) {
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java?rev=1212221&r1=1212220&r2=1212221&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java Fri Dec 9 02:19:42 2011
@@ -559,7 +559,7 @@ public class SolrIndexSearcher extends I
if (!termsEnum.seekExact(termBytes, false)) {
return -1;
}
- DocsEnum docs = termsEnum.docs(MultiFields.getLiveDocs(reader), null);
+ DocsEnum docs = termsEnum.docs(MultiFields.getLiveDocs(reader), null, false);
if (docs == null) return -1;
int id = docs.nextDoc();
return id == DocIdSetIterator.NO_MORE_DOCS ? -1 : id;
@@ -583,7 +583,7 @@ public class SolrIndexSearcher extends I
final Bits liveDocs = reader.getLiveDocs();
- final DocsEnum docs = reader.termDocsEnum(liveDocs, field, idBytes);
+ final DocsEnum docs = reader.termDocsEnum(liveDocs, field, idBytes, false);
if (docs == null) continue;
int id = docs.nextDoc();
@@ -892,7 +892,7 @@ public class SolrIndexSearcher extends I
int bitsSet = 0;
OpenBitSet obs = null;
- DocsEnum docsEnum = deState.termsEnum.docs(deState.liveDocs, deState.docsEnum);
+ DocsEnum docsEnum = deState.termsEnum.docs(deState.liveDocs, deState.docsEnum, false);
if (deState.docsEnum == null) {
deState.docsEnum = docsEnum;
}
@@ -973,7 +973,7 @@ public class SolrIndexSearcher extends I
if (terms != null) {
final TermsEnum termsEnum = terms.iterator(null);
if (termsEnum.seekExact(termBytes, false)) {
- docsEnum = termsEnum.docs(MultiFields.getLiveDocs(reader), null);
+ docsEnum = termsEnum.docs(MultiFields.getLiveDocs(reader), null, false);
}
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java?rev=1212221&r1=1212220&r2=1212221&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java Fri Dec 9 02:19:42 2011
@@ -277,7 +277,7 @@ public class FileFloatSource extends Val
continue;
}
- docsEnum = termsEnum.docs(null, docsEnum);
+ docsEnum = termsEnum.docs(null, docsEnum, false);
int doc;
while ((doc = docsEnum.nextDoc()) != DocsEnum.NO_MORE_DOCS) {
vals[doc] = fval;
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java?rev=1212221&r1=1212220&r2=1212221&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java Fri Dec 9 02:19:42 2011
@@ -95,7 +95,7 @@ public class SolrDispatchFilter implemen
}
catch( Throwable t ) {
// catch this so our filter still works
- log.error( "Could not start Solr. Check solr/home property", t);
+ log.error( "Could not start Solr. Check solr/home property and the logs", t);
SolrConfig.severeErrors.add( t );
SolrCore.log( t );
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/spelling/SpellingQueryConverter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/spelling/SpellingQueryConverter.java?rev=1212221&r1=1212220&r2=1212221&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/spelling/SpellingQueryConverter.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/spelling/SpellingQueryConverter.java Fri Dec 9 02:19:42 2011
@@ -28,6 +28,7 @@ import java.util.regex.Pattern;
import org.apache.lucene.analysis.Token;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.FlagsAttribute;
+import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
import org.apache.lucene.analysis.tokenattributes.PayloadAttribute;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
@@ -111,12 +112,13 @@ public class SpellingQueryConverter exte
TypeAttribute typeAtt = stream.addAttribute(TypeAttribute.class);
PayloadAttribute payloadAtt = stream.addAttribute(PayloadAttribute.class);
PositionIncrementAttribute posIncAtt = stream.addAttribute(PositionIncrementAttribute.class);
+ OffsetAttribute offsetAtt = stream.addAttribute(OffsetAttribute.class);
stream.reset();
while (stream.incrementToken()) {
Token token = new Token();
token.copyBuffer(termAtt.buffer(), 0, termAtt.length());
- token.setStartOffset(matcher.start());
- token.setEndOffset(matcher.end());
+ token.setStartOffset(matcher.start() + offsetAtt.startOffset());
+ token.setEndOffset(matcher.start() + offsetAtt.endOffset());
token.setFlags(flagsAtt.getFlags());
token.setType(typeAtt.type());
token.setPayload(payloadAtt.getPayload());
Modified: lucene/dev/branches/solrcloud/solr/core/src/test-files/solr/conf/solrconfig-elevate.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test-files/solr/conf/solrconfig-elevate.xml?rev=1212221&r1=1212220&r2=1212221&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test-files/solr/conf/solrconfig-elevate.xml (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test-files/solr/conf/solrconfig-elevate.xml Fri Dec 9 02:19:42 2011
@@ -185,7 +185,17 @@
<!-- test elevation -->
<searchComponent name="elevate" class="org.apache.solr.handler.component.QueryElevationComponent" >
<str name="queryFieldType">string</str>
- <str name="config-file">elevate.xml</str>
+ <str name="config-file">${elevate.file:elevate.xml}</str>
+ </searchComponent>
+
+ <!-- SOLR-1730 -->
+ <!--<searchComponent name="badElevate" class="org.apache.solr.handler.component.QueryElevationComponent" >
+ <str name="queryFieldType">string</str>
+ <str name="config-file">foo.xml</str>
+ </searchComponent>-->
+ <searchComponent name="dataElevate" class="org.apache.solr.handler.component.QueryElevationComponent" >
+ <str name="queryFieldType">string</str>
+ <str name="config-file">${elevate.data.file:elevate-data.xml}</str>
</searchComponent>
<requestHandler name="/elevate" class="org.apache.solr.handler.component.SearchHandler">
@@ -197,6 +207,24 @@
</arr>
</requestHandler>
+ <requestHandler name="/dataElevate" class="org.apache.solr.handler.component.SearchHandler">
+ <lst name="defaults">
+ <str name="echoParams">explicit</str>
+ </lst>
+ <arr name="last-components">
+ <str>dataElevate</str>
+ </arr>
+ </requestHandler>
+
+ <!--<requestHandler name="/badElevate" class="org.apache.solr.handler.component.SearchHandler">
+ <lst name="defaults">
+ <str name="echoParams">explicit</str>
+ </lst>
+ <arr name="last-components">
+ <str>badElevate</str>
+ </arr>
+ </requestHandler>-->
+
<!-- enable streaming for testing... -->
<requestDispatcher handleSelect="true" >
<requestParsers enableRemoteStreaming="true" multipartUploadLimitInKB="2048" />
Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java?rev=1212221&r1=1212220&r2=1212221&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java Fri Dec 9 02:19:42 2011
@@ -30,6 +30,7 @@ import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.MapSolrParams;
import org.apache.solr.common.params.QueryElevationParams;
+import org.apache.solr.common.util.FileUtils;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.core.SolrCore;
import org.apache.solr.handler.component.QueryElevationComponent.ElevationObj;
@@ -45,7 +46,13 @@ public class QueryElevationComponentTest
@BeforeClass
public static void beforeClass() throws Exception {
- initCore("solrconfig-elevate.xml","schema12.xml");
+ //write out elevate-data.xml to the Data dir first by copying it from conf, which we know exists, this way we can test both conf and data configurations
+ createTempDir();
+ File parent = new File(TEST_HOME(), "conf");
+ File elevateFile = new File(parent, "elevate.xml");
+ File elevateDataFile = new File(dataDir, "elevate-data.xml");
+ FileUtils.copyFile(elevateFile, elevateDataFile);
+ initCore("solrconfig-elevate.xml", "schema12.xml");
}
@Before
Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java?rev=1212221&r1=1212220&r2=1212221&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java Fri Dec 9 02:19:42 2011
@@ -114,7 +114,7 @@ public class SpellCheckComponentTest ext
assertJQ(req("json.nl","map", "qt",rh, SpellCheckComponent.COMPONENT_NAME, "true", "q","documemtsss broens", SpellCheckComponent.SPELLCHECK_COLLATE, "true")
,"/spellcheck/suggestions/collation=='document brown'"
);
- assertJQ(req("json.nl","map", "qt",rh, SpellCheckComponent.COMPONENT_NAME, "true", "q","pixma-a-b-c-d-e-f-g", SpellCheckComponent.SPELLCHECK_COLLATE, "true")
+ assertJQ(req("json.nl","map", "qt",rh, SpellCheckComponent.COMPONENT_NAME, "true", "q","pixma", SpellCheckComponent.SPELLCHECK_COLLATE, "true")
,"/spellcheck/suggestions/collation=='pixmaa'"
);
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/search/TestRealTimeGet.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/search/TestRealTimeGet.java?rev=1212221&r1=1212220&r2=1212221&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/search/TestRealTimeGet.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/search/TestRealTimeGet.java Fri Dec 9 02:19:42 2011
@@ -1651,7 +1651,7 @@ public class TestRealTimeGet extends Sol
if (!termsEnum.seekExact(termBytes, false)) {
return -1;
}
- DocsEnum docs = termsEnum.docs(MultiFields.getLiveDocs(r), null);
+ DocsEnum docs = termsEnum.docs(MultiFields.getLiveDocs(r), null, false);
int id = docs.nextDoc();
if (id != DocIdSetIterator.NO_MORE_DOCS) {
int next = docs.nextDoc();
Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java?rev=1212221&r1=1212220&r2=1212221&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java Fri Dec 9 02:19:42 2011
@@ -46,9 +46,62 @@ public class SpellCheckCollatorTest exte
assertNull(h.validateUpdate(adoc("id", "3", "lowerfilt", "faith of homer")));
assertNull(h.validateUpdate(adoc("id", "4", "lowerfilt", "fat of homer")));
assertNull(h.validateUpdate(adoc("id", "5", "lowerfilt1", "peace")));
+ assertNull(h.validateUpdate(adoc("id", "6", "lowerfilt", "hyphenated word")));
assertNull(h.validateUpdate(commit()));
}
-
+
+ @Test
+ public void testCollationWithHypens() throws Exception
+ {
+ SolrCore core = h.getCore();
+ SearchComponent speller = core.getSearchComponent("spellcheck");
+ assertTrue("speller is null and it shouldn't be", speller != null);
+
+ ModifiableSolrParams params = new ModifiableSolrParams();
+ params.add(SpellCheckComponent.COMPONENT_NAME, "true");
+ params.add(SpellCheckComponent.SPELLCHECK_BUILD, "true");
+ params.add(SpellCheckComponent.SPELLCHECK_COUNT, "10");
+ params.add(SpellCheckComponent.SPELLCHECK_COLLATE, "true");
+
+ params.add(CommonParams.Q, "lowerfilt:(hypenated-wotd)");
+ {
+ SolrRequestHandler handler = core.getRequestHandler("spellCheckCompRH");
+ SolrQueryResponse rsp = new SolrQueryResponse();
+ rsp.add("responseHeader", new SimpleOrderedMap());
+ SolrQueryRequest req = new LocalSolrQueryRequest(core, params);
+ handler.handleRequest(req, rsp);
+ req.close();
+ NamedList values = rsp.getValues();
+ NamedList spellCheck = (NamedList) values.get("spellcheck");
+ NamedList suggestions = (NamedList) spellCheck.get("suggestions");
+ List<String> collations = suggestions.getAll("collation");
+ assertTrue(collations.size()==1);
+ String collation = collations.iterator().next();
+ assertTrue("Incorrect collation: " + collation,"lowerfilt:(hyphenated-word)".equals(collation));
+ }
+
+ params.remove(CommonParams.Q);
+ params.add("defType", "dismax");
+ params.add("qf", "lowerfilt");
+ params.add(CommonParams.Q, "hypenated-wotd");
+ {
+ SolrRequestHandler handler = core.getRequestHandler("spellCheckCompRH");
+ SolrQueryResponse rsp = new SolrQueryResponse();
+ rsp.add("responseHeader", new SimpleOrderedMap());
+ SolrQueryRequest req = new LocalSolrQueryRequest(core, params);
+ handler.handleRequest(req, rsp);
+ req.close();
+ NamedList values = rsp.getValues();
+ NamedList spellCheck = (NamedList) values.get("spellcheck");
+ NamedList suggestions = (NamedList) spellCheck.get("suggestions");
+ List<String> collations = suggestions.getAll("collation");
+ assertTrue(collations.size()==1);
+ String collation = collations.iterator().next();
+ assertTrue("Incorrect collation: " + collation,"hyphenated-word".equals(collation));
+ }
+
+ }
+
@Test
public void testCollateWithFilter() throws Exception
{