You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2011/12/08 19:01:14 UTC
svn commit: r1212008 - in /lucene/dev/branches/lucene3606: ./ lucene/
lucene/src/java/org/apache/lucene/index/codecs/
lucene/src/java/org/apache/lucene/index/codecs/appending/
lucene/src/java/org/apache/lucene/search/
lucene/src/java/org/apache/lucene/...
Author: uschindler
Date: Thu Dec 8 18:01:13 2011
New Revision: 1212008
URL: http://svn.apache.org/viewvc?rev=1212008&view=rev
Log:
LUCENE-3606: Merge up to trunk r1212007
Added:
lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsReader.java
- copied unchanged from r1212007, lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsReader.java
lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsWriter.java
- copied unchanged from r1212007, lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsWriter.java
lucene/dev/branches/lucene3606/solr/core/src/test/org/apache/solr/handler/component/BadComponentTest.java
- copied unchanged from r1212007, lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/component/BadComponentTest.java
Removed:
lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictReader.java
lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictWriter.java
lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsIndexReader.java
lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsIndexWriter.java
Modified:
lucene/dev/branches/lucene3606/ (props changed)
lucene/dev/branches/lucene3606/lucene/ (props changed)
lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/BlockTreeTermsReader.java
lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/BlockTreeTermsWriter.java
lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/appending/AppendingPostingsFormat.java
lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/search/FieldValueFilter.java
lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/store/MMapDirectory.java
lucene/dev/branches/lucene3606/modules/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java
lucene/dev/branches/lucene3606/solr/ (props changed)
lucene/dev/branches/lucene3606/solr/CHANGES.txt (contents, props changed)
lucene/dev/branches/lucene3606/solr/core/ (props changed)
lucene/dev/branches/lucene3606/solr/core/src/java/ (props changed)
lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/CoreContainer.java
lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/SolrCore.java
lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
lucene/dev/branches/lucene3606/solr/core/src/test/ (props changed)
lucene/dev/branches/lucene3606/solr/core/src/test-files/solr/conf/solrconfig-elevate.xml
lucene/dev/branches/lucene3606/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java
Modified: lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/BlockTreeTermsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/BlockTreeTermsReader.java?rev=1212008&r1=1212007&r2=1212008&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/BlockTreeTermsReader.java (original)
+++ lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/BlockTreeTermsReader.java Thu Dec 8 18:01:13 2011
@@ -166,16 +166,16 @@ public class BlockTreeTermsReader extend
}
protected void readHeader(IndexInput input) throws IOException {
- CodecUtil.checkHeader(input, BlockTreeTermsWriter.CODEC_NAME,
- BlockTreeTermsWriter.VERSION_START,
- BlockTreeTermsWriter.VERSION_CURRENT);
+ CodecUtil.checkHeader(input, BlockTreeTermsWriter.TERMS_CODEC_NAME,
+ BlockTreeTermsWriter.TERMS_VERSION_START,
+ BlockTreeTermsWriter.TERMS_VERSION_CURRENT);
dirOffset = input.readLong();
}
protected void readIndexHeader(IndexInput input) throws IOException {
- CodecUtil.checkHeader(input, BlockTreeTermsWriter.CODEC_NAME,
- BlockTreeTermsWriter.VERSION_START,
- BlockTreeTermsWriter.VERSION_CURRENT);
+ CodecUtil.checkHeader(input, BlockTreeTermsWriter.TERMS_INDEX_CODEC_NAME,
+ BlockTreeTermsWriter.TERMS_INDEX_VERSION_START,
+ BlockTreeTermsWriter.TERMS_INDEX_VERSION_CURRENT);
indexDirOffset = input.readLong();
}
Modified: lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/BlockTreeTermsWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/BlockTreeTermsWriter.java?rev=1212008&r1=1212007&r2=1212008&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/BlockTreeTermsWriter.java (original)
+++ lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/BlockTreeTermsWriter.java Thu Dec 8 18:01:13 2011
@@ -99,18 +99,21 @@ public class BlockTreeTermsWriter extend
static final int OUTPUT_FLAG_IS_FLOOR = 0x1;
static final int OUTPUT_FLAG_HAS_TERMS = 0x2;
- final static String CODEC_NAME = "BLOCK_TREE_TERMS_DICT";
-
- // Initial format
- public static final int VERSION_START = 0;
-
- public static final int VERSION_CURRENT = VERSION_START;
-
/** Extension of terms file */
static final String TERMS_EXTENSION = "tim";
+ final static String TERMS_CODEC_NAME = "BLOCK_TREE_TERMS_DICT";
+ // Initial format
+ public static final int TERMS_VERSION_START = 0;
+ public static final int TERMS_VERSION_CURRENT = TERMS_VERSION_START;
+
+ /** Extension of terms index file */
static final String TERMS_INDEX_EXTENSION = "tip";
+ final static String TERMS_INDEX_CODEC_NAME = "BLOCK_TREE_TERMS_INDEX";
+ // Initial format
+ public static final int TERMS_INDEX_VERSION_START = 0;
+ public static final int TERMS_INDEX_VERSION_CURRENT = TERMS_INDEX_VERSION_START;
- protected final IndexOutput out;
+ private final IndexOutput out;
private final IndexOutput indexOut;
final int minItemsInBlock;
final int maxItemsInBlock;
@@ -178,22 +181,22 @@ public class BlockTreeTermsWriter extend
}
protected void writeHeader(IndexOutput out) throws IOException {
- CodecUtil.writeHeader(out, CODEC_NAME, VERSION_CURRENT);
+ CodecUtil.writeHeader(out, TERMS_CODEC_NAME, TERMS_VERSION_CURRENT);
out.writeLong(0); // leave space for end index pointer
}
protected void writeIndexHeader(IndexOutput out) throws IOException {
- CodecUtil.writeHeader(out, CODEC_NAME, VERSION_CURRENT);
+ CodecUtil.writeHeader(out, TERMS_INDEX_CODEC_NAME, TERMS_INDEX_VERSION_CURRENT);
out.writeLong(0); // leave space for end index pointer
}
- protected void writeTrailer(long dirStart) throws IOException {
- out.seek(CodecUtil.headerLength(CODEC_NAME));
+ protected void writeTrailer(IndexOutput out, long dirStart) throws IOException {
+ out.seek(CodecUtil.headerLength(TERMS_CODEC_NAME));
out.writeLong(dirStart);
}
- protected void writeIndexTrailer(long dirStart) throws IOException {
- indexOut.seek(CodecUtil.headerLength(CODEC_NAME));
+ protected void writeIndexTrailer(IndexOutput indexOut, long dirStart) throws IOException {
+ indexOut.seek(CodecUtil.headerLength(TERMS_INDEX_CODEC_NAME));
indexOut.writeLong(dirStart);
}
@@ -935,8 +938,8 @@ public class BlockTreeTermsWriter extend
indexOut.writeVLong(field.indexStartFP);
}
}
- writeTrailer(dirStart);
- writeIndexTrailer(indexDirStart);
+ writeTrailer(out, dirStart);
+ writeIndexTrailer(indexOut, indexDirStart);
} catch (IOException ioe2) {
ioe = ioe2;
} finally {
Modified: lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/appending/AppendingPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/appending/AppendingPostingsFormat.java?rev=1212008&r1=1212007&r2=1212008&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/appending/AppendingPostingsFormat.java (original)
+++ lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/appending/AppendingPostingsFormat.java Thu Dec 8 18:01:13 2011
@@ -23,19 +23,16 @@ import java.util.Set;
import org.apache.lucene.index.SegmentInfo;
import org.apache.lucene.index.SegmentReadState;
import org.apache.lucene.index.SegmentWriteState;
+import org.apache.lucene.index.codecs.BlockTreeTermsReader;
+import org.apache.lucene.index.codecs.BlockTreeTermsWriter;
import org.apache.lucene.index.codecs.PostingsFormat;
import org.apache.lucene.index.codecs.FieldsConsumer;
import org.apache.lucene.index.codecs.FieldsProducer;
-import org.apache.lucene.index.codecs.FixedGapTermsIndexReader;
-import org.apache.lucene.index.codecs.lucene40.Lucene40PostingsFormat;
import org.apache.lucene.index.codecs.lucene40.Lucene40PostingsReader;
import org.apache.lucene.index.codecs.lucene40.Lucene40PostingsWriter;
import org.apache.lucene.index.codecs.PostingsReaderBase;
import org.apache.lucene.index.codecs.PostingsWriterBase;
-import org.apache.lucene.index.codecs.BlockTermsReader;
-import org.apache.lucene.index.codecs.TermsIndexReaderBase;
import org.apache.lucene.store.Directory;
-import org.apache.lucene.util.BytesRef;
/**
* Appending postings impl
@@ -48,72 +45,39 @@ class AppendingPostingsFormat extends Po
}
@Override
- public FieldsConsumer fieldsConsumer(SegmentWriteState state)
- throws IOException {
+ public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
PostingsWriterBase docsWriter = new Lucene40PostingsWriter(state);
boolean success = false;
- AppendingTermsIndexWriter indexWriter = null;
try {
- indexWriter = new AppendingTermsIndexWriter(state);
- success = true;
- } finally {
- if (!success) {
- docsWriter.close();
- }
- }
- success = false;
- try {
- FieldsConsumer ret = new AppendingTermsDictWriter(indexWriter, state, docsWriter);
+ FieldsConsumer ret = new AppendingTermsWriter(state, docsWriter, BlockTreeTermsWriter.DEFAULT_MIN_BLOCK_SIZE, BlockTreeTermsWriter.DEFAULT_MAX_BLOCK_SIZE);
success = true;
return ret;
} finally {
if (!success) {
- try {
- docsWriter.close();
- } finally {
- indexWriter.close();
- }
+ docsWriter.close();
}
}
}
@Override
- public FieldsProducer fieldsProducer(SegmentReadState state)
- throws IOException {
- PostingsReaderBase docsReader = new Lucene40PostingsReader(state.dir, state.segmentInfo, state.context, state.segmentSuffix);
- TermsIndexReaderBase indexReader;
-
+ public FieldsProducer fieldsProducer(SegmentReadState state) throws IOException {
+ PostingsReaderBase postings = new Lucene40PostingsReader(state.dir, state.segmentInfo, state.context, state.segmentSuffix);
+
boolean success = false;
try {
- indexReader = new AppendingTermsIndexReader(state.dir,
- state.fieldInfos,
- state.segmentInfo.name,
- state.termsIndexDivisor,
- BytesRef.getUTF8SortedAsUnicodeComparator(),
- state.segmentSuffix, state.context);
- success = true;
- } finally {
- if (!success) {
- docsReader.close();
- }
- }
- success = false;
- try {
- FieldsProducer ret = new AppendingTermsDictReader(indexReader,
- state.dir, state.fieldInfos, state.segmentInfo.name,
- docsReader,
- state.context,
- Lucene40PostingsFormat.TERMS_CACHE_SIZE,
- state.segmentSuffix);
+ FieldsProducer ret = new AppendingTermsReader(
+ state.dir,
+ state.fieldInfos,
+ state.segmentInfo.name,
+ postings,
+ state.context,
+ state.segmentSuffix,
+ state.termsIndexDivisor);
success = true;
return ret;
} finally {
if (!success) {
- try {
- docsReader.close();
- } finally {
- indexReader.close();
- }
+ postings.close();
}
}
}
@@ -122,7 +86,6 @@ class AppendingPostingsFormat extends Po
public void files(Directory dir, SegmentInfo segmentInfo, String segmentSuffix, Set<String> files)
throws IOException {
Lucene40PostingsReader.files(dir, segmentInfo, segmentSuffix, files);
- BlockTermsReader.files(dir, segmentInfo, segmentSuffix, files);
- FixedGapTermsIndexReader.files(dir, segmentInfo, segmentSuffix, files);
+ BlockTreeTermsReader.files(dir, segmentInfo, segmentSuffix, files);
}
}
Modified: lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/search/FieldValueFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/search/FieldValueFilter.java?rev=1212008&r1=1212007&r2=1212008&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/search/FieldValueFilter.java (original)
+++ lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/search/FieldValueFilter.java Thu Dec 8 18:01:13 2011
@@ -56,6 +56,22 @@ public class FieldValueFilter extends Fi
this.field = field;
this.negate = negate;
}
+
+ /**
+ * Returns the field this filter is applied on.
+ * @return the field this filter is applied on.
+ */
+ public String field() {
+ return field;
+ }
+
+ /**
+ * Returns <code>true</code> iff this filter is negated, otherwise <code>false</code>
+ * @return <code>true</code> iff this filter is negated, otherwise <code>false</code>
+ */
+ public boolean negate() {
+ return negate;
+ }
@Override
public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs)
Modified: lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/store/MMapDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/store/MMapDirectory.java?rev=1212008&r1=1212007&r2=1212008&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/store/MMapDirectory.java (original)
+++ lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/store/MMapDirectory.java Thu Dec 8 18:01:13 2011
@@ -26,7 +26,7 @@ import java.nio.channels.ClosedChannelEx
import java.nio.channels.FileChannel;
import java.nio.channels.FileChannel.MapMode;
-import java.util.Map;
+import java.util.Set;
import java.util.WeakHashMap;
import java.security.AccessController;
@@ -34,6 +34,7 @@ import java.security.PrivilegedException
import java.security.PrivilegedActionException;
import java.lang.reflect.Method;
+import org.apache.lucene.util.MapBackedSet;
import org.apache.lucene.util.Constants;
/** File-based {@link Directory} implementation that uses
@@ -259,7 +260,7 @@ public class MMapDirectory extends FSDir
private ByteBuffer curBuf; // redundant for speed: buffers[curBufIndex]
private boolean isClone = false;
- private final Map<MMapIndexInput,Boolean> clones = new WeakHashMap<MMapIndexInput,Boolean>();
+ private final Set<MMapIndexInput> clones = new MapBackedSet<MMapIndexInput>(new WeakHashMap<MMapIndexInput,Boolean>());
MMapIndexInput(String resourceDescription, RandomAccessFile raf, long offset, long length, int chunkSizePower) throws IOException {
super(resourceDescription);
@@ -430,7 +431,7 @@ public class MMapDirectory extends FSDir
// register the new clone in our clone list to clean it up on closing:
synchronized(this.clones) {
- this.clones.put(clone, Boolean.TRUE);
+ this.clones.add(clone);
}
return clone;
@@ -449,7 +450,7 @@ public class MMapDirectory extends FSDir
// for extra safety unset also all clones' buffers:
synchronized(this.clones) {
- for (final MMapIndexInput clone : this.clones.keySet()) {
+ for (final MMapIndexInput clone : this.clones) {
assert clone.isClone;
clone.unsetBuffers();
}
Modified: lucene/dev/branches/lucene3606/modules/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/modules/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java?rev=1212008&r1=1212007&r2=1212008&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/modules/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java (original)
+++ lucene/dev/branches/lucene3606/modules/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java Thu Dec 8 18:01:13 2011
@@ -672,8 +672,7 @@ public class TestGrouping extends Lucene
do {
// B/c of DV based impl we can't see the difference between an empty string and a null value.
// For that reason we don't generate empty string groups.
-// randomValue = _TestUtil.randomRealisticUnicodeString(random);
- randomValue = _TestUtil.randomSimpleString(random);
+ randomValue = _TestUtil.randomRealisticUnicodeString(random);
} while ("".equals(randomValue));
groups.add(new BytesRef(randomValue));
Modified: lucene/dev/branches/lucene3606/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/solr/CHANGES.txt?rev=1212008&r1=1212007&r2=1212008&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/solr/CHANGES.txt (original)
+++ lucene/dev/branches/lucene3606/solr/CHANGES.txt Thu Dec 8 18:01:13 2011
@@ -288,6 +288,9 @@ Bug Fixes
* SOLR-2509: StringIndexOutOfBoundsException in the spellchecker collate when the term contains
a hyphen. (Thomas Gambier caught the bug, Steffen Godskesen did the patch, via Erick Erickson)
+
+* SOLR-1730: Made it clearer when a core failed to load as well as better logging when the
+ QueryElevationComponent fails to properly initialize (gsingers)
Other Changes
----------------------
Modified: lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/CoreContainer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/CoreContainer.java?rev=1212008&r1=1212007&r2=1212008&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/CoreContainer.java (original)
+++ lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/CoreContainer.java Thu Dec 8 18:01:13 2011
@@ -215,7 +215,6 @@ public class CoreContainer
}
/**
- * @exception generates an error if you attempt to set this value to false
* @deprecated all cores now abort on configuration error regardless of configuration
*/
@Deprecated
@@ -246,6 +245,9 @@ public class CoreContainer
}
solrConfigFilename = cores.getConfigFile().getName();
+ if (cores.cores.isEmpty()){
+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "No cores were created, please check the logs for errors");
+ }
return cores;
}
Modified: lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/SolrCore.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/SolrCore.java?rev=1212008&r1=1212007&r2=1212008&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/SolrCore.java (original)
+++ lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/SolrCore.java Thu Dec 8 18:01:13 2011
@@ -612,11 +612,14 @@ public final class SolrCore implements S
// Finally tell anyone who wants to know
resourceLoader.inform( resourceLoader );
resourceLoader.inform( this ); // last call before the latch is released.
- } catch (IOException e) {
- log.error("", e);
+ } catch (Throwable e) {
+ log.error("Error in constructing the core", e);
+ latch.countDown();//release the latch, otherwise we block trying to do the close. This should be fine, since counting down on a latch of 0 is still fine
+ //close down the searcher and any other resources, if it exists, as this is not recoverable
+ close();
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, null, e, false);
} finally {
- // allow firstSearcher events to fire
+ // allow firstSearcher events to fire and make sure it is released
latch.countDown();
}
Modified: lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java?rev=1212008&r1=1212007&r2=1212008&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java (original)
+++ lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java Thu Dec 8 18:01:13 2011
@@ -199,7 +199,7 @@ public class QueryElevationComponent ext
elevationCache.put(null, loadElevationMap( cfg ));
}
}
-
+ //in other words, we think this is in the data dir, not the conf dir
if (!exists){
// preload the first data
RefCounted<SolrIndexSearcher> searchHolder = null;
@@ -215,10 +215,10 @@ public class QueryElevationComponent ext
}
catch( Exception ex ) {
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,
- "Error initializing QueryElevationComponent.", ex );
+ "Error initializing QueryElevationComponent.", ex, false );
}
}
-
+ //get the elevation map from the data dir
Map<String, ElevationObj> getElevationMap( IndexReader reader, SolrCore core ) throws Exception
{
synchronized( elevationCache ) {
@@ -242,7 +242,7 @@ public class QueryElevationComponent ext
return map;
}
}
-
+ //load up the elevation map
private Map<String, ElevationObj> loadElevationMap( Config cfg ) throws IOException
{
XPath xpath = XPathFactory.newInstance().newXPath();
Modified: lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java?rev=1212008&r1=1212007&r2=1212008&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java (original)
+++ lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java Thu Dec 8 18:01:13 2011
@@ -96,7 +96,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/lucene3606/solr/core/src/test-files/solr/conf/solrconfig-elevate.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/solr/core/src/test-files/solr/conf/solrconfig-elevate.xml?rev=1212008&r1=1212007&r2=1212008&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/solr/core/src/test-files/solr/conf/solrconfig-elevate.xml (original)
+++ lucene/dev/branches/lucene3606/solr/core/src/test-files/solr/conf/solrconfig-elevate.xml Thu Dec 8 18:01:13 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/lucene3606/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java?rev=1212008&r1=1212007&r2=1212008&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java (original)
+++ lucene/dev/branches/lucene3606/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java Thu Dec 8 18:01:13 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