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 2011/04/23 10:07:32 UTC
svn commit: r1096120 [1/3] - in /lucene/dev/branches/realtime_search: ./
lucene/ lucene/contrib/ lucene/contrib/db/bdb-je/lib/
lucene/contrib/db/bdb/lib/
lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/
lucene/contrib/highlighter...
Author: simonw
Date: Sat Apr 23 08:07:28 2011
New Revision: 1096120
URL: http://svn.apache.org/viewvc?rev=1096120&view=rev
Log:
LUCENE-3023: merged with trunk
Added:
lucene/dev/branches/realtime_search/lucene/contrib/db/bdb-je/lib/
- copied from r1096112, lucene/dev/trunk/lucene/contrib/db/bdb-je/lib/
lucene/dev/branches/realtime_search/lucene/contrib/db/bdb-je/lib/je-LICENSE-FAKE.txt
- copied unchanged from r1096112, lucene/dev/trunk/lucene/contrib/db/bdb-je/lib/je-LICENSE-FAKE.txt
lucene/dev/branches/realtime_search/lucene/contrib/db/bdb-je/lib/je-NOTICE-FAKE.txt
- copied unchanged from r1096112, lucene/dev/trunk/lucene/contrib/db/bdb-je/lib/je-NOTICE-FAKE.txt
lucene/dev/branches/realtime_search/lucene/contrib/db/bdb/lib/
- copied from r1096112, lucene/dev/trunk/lucene/contrib/db/bdb/lib/
lucene/dev/branches/realtime_search/lucene/contrib/db/bdb/lib/db--NOTICE-FAKE.txt
- copied unchanged from r1096112, lucene/dev/trunk/lucene/contrib/db/bdb/lib/db--NOTICE-FAKE.txt
lucene/dev/branches/realtime_search/lucene/contrib/db/bdb/lib/db-LICENSE-FAKE.txt
- copied unchanged from r1096112, lucene/dev/trunk/lucene/contrib/db/bdb/lib/db-LICENSE-FAKE.txt
lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/OffsetLimitTokenFilter.java
- copied unchanged from r1096112, lucene/dev/trunk/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/OffsetLimitTokenFilter.java
lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/OffsetLimitTokenFilterTest.java
- copied unchanged from r1096112, lucene/dev/trunk/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/OffsetLimitTokenFilterTest.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/DoubleDocValues.java
- copied unchanged from r1096112, lucene/dev/trunk/solr/src/java/org/apache/solr/search/function/DoubleDocValues.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/FloatDocValues.java
- copied unchanged from r1096112, lucene/dev/trunk/solr/src/java/org/apache/solr/search/function/FloatDocValues.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/IntDocValues.java
- copied unchanged from r1096112, lucene/dev/trunk/solr/src/java/org/apache/solr/search/function/IntDocValues.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/LongDocValues.java
- copied unchanged from r1096112, lucene/dev/trunk/solr/src/java/org/apache/solr/search/function/LongDocValues.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/StrDocValues.java
- copied unchanged from r1096112, lucene/dev/trunk/solr/src/java/org/apache/solr/search/function/StrDocValues.java
lucene/dev/branches/realtime_search/solr/src/test/org/apache/solr/update/UpdateParamsTest.java
- copied unchanged from r1096112, lucene/dev/trunk/solr/src/test/org/apache/solr/update/UpdateParamsTest.java
Modified:
lucene/dev/branches/realtime_search/ (props changed)
lucene/dev/branches/realtime_search/build.xml
lucene/dev/branches/realtime_search/lucene/ (props changed)
lucene/dev/branches/realtime_search/lucene/CHANGES.txt
lucene/dev/branches/realtime_search/lucene/common-build.xml
lucene/dev/branches/realtime_search/lucene/contrib/CHANGES.txt
lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/Highlighter.java
lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/QueryScorer.java
lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/WeightedSpanTermExtractor.java
lucene/dev/branches/realtime_search/lucene/contrib/lucli/build.xml (props changed)
lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/index/codecs/MultiLevelSkipListReader.java
lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/index/codecs/MultiLevelSkipListWriter.java
lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/util/AttributeSource.java
lucene/dev/branches/realtime_search/lucene/src/test-framework/org/apache/lucene/analysis/BaseTokenStreamTestCase.java
lucene/dev/branches/realtime_search/lucene/src/test-framework/org/apache/lucene/index/codecs/mockrandom/MockRandomCodec.java
lucene/dev/branches/realtime_search/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java
lucene/dev/branches/realtime_search/lucene/src/test-framework/org/apache/lucene/util/_TestUtil.java
lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/analysis/TestMockAnalyzer.java
lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestCompoundFile.java
lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestDoc.java
lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestFieldsReader.java
lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexReader.java
lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java
lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java
lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexWriterLockRelease.java
lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnJRECrash.java
lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestLongPostings.java
lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestBufferedIndexInput.java
lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestDirectory.java
lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestMultiMMap.java
lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestRAMDirectory.java
lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestWindowsMMap.java
lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/util/TestAttributeSource.java
lucene/dev/branches/realtime_search/lucene/src/tools/java/org/apache/lucene/validation/LicenseType.java
lucene/dev/branches/realtime_search/modules/ (props changed)
lucene/dev/branches/realtime_search/solr/ (props changed)
lucene/dev/branches/realtime_search/solr/CHANGES.txt
lucene/dev/branches/realtime_search/solr/build.xml
lucene/dev/branches/realtime_search/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImportHandler.java
lucene/dev/branches/realtime_search/solr/contrib/uima/src/test/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java
lucene/dev/branches/realtime_search/solr/contrib/uima/src/test/resources/solr-uima/conf/solrconfig.xml
lucene/dev/branches/realtime_search/solr/example/solr/conf/solrconfig.xml
lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/VM_global_library.vm
lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/facet_dates.vm
lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/facet_ranges.vm
lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/main.css
lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/query.vm
lucene/dev/branches/realtime_search/solr/src/common/org/apache/solr/common/SolrDocumentList.java
lucene/dev/branches/realtime_search/solr/src/common/org/apache/solr/common/params/UpdateParams.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/core/AbstractSolrEventListener.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/core/CoreContainer.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/core/QuerySenderListener.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/handler/ContentStreamHandlerBase.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/handler/ReplicationHandler.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/handler/component/FacetComponent.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/response/JSONResponseWriter.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/response/transform/ValueSourceAugmenter.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/schema/DateField.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/schema/RandomSortField.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/schema/SortableDoubleField.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/schema/SortableFloatField.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/schema/SortableIntField.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/schema/SortableLongField.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/schema/StrFieldSource.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/schema/TrieField.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/QueryParsing.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/ValueSourceParser.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/ByteFieldSource.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/ConstValueSource.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/DocFreqValueSource.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/DocValues.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/DoubleConstValueSource.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/DoubleFieldSource.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/DualFloatFunction.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/FileFloatSource.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/FloatFieldSource.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/IntFieldSource.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/JoinDocFreqValueSource.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/LinearFloatFunction.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/LiteralValueSource.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/LongFieldSource.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/MultiFloatFunction.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/OrdFieldSource.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/QueryValueSource.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/RangeMapFloatFunction.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/ReciprocalFloatFunction.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/ReverseOrdFieldSource.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/ScaleFloatFunction.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/SimpleFloatFunction.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/StringIndexDocValues.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/distance/GeohashHaversineFunction.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/distance/HaversineConstFunction.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/distance/HaversineFunction.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/distance/StringDistanceFunction.java
lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/search/function/distance/VectorDistanceFunction.java
lucene/dev/branches/realtime_search/solr/src/solrj/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.java
lucene/dev/branches/realtime_search/solr/src/test-files/solr/shared/solr.xml
lucene/dev/branches/realtime_search/solr/src/test-framework/org/apache/solr/BaseDistributedSearchTestCase.java
lucene/dev/branches/realtime_search/solr/src/test/org/apache/solr/TestDistributedSearch.java
lucene/dev/branches/realtime_search/solr/src/test/org/apache/solr/client/solrj/embedded/TestSolrProperties.java
lucene/dev/branches/realtime_search/solr/src/test/org/apache/solr/search/QueryParsingTest.java
lucene/dev/branches/realtime_search/solr/src/test/org/apache/solr/search/TestExtendedDismaxParser.java
lucene/dev/branches/realtime_search/solr/src/test/org/apache/solr/search/TestQueryTypes.java
lucene/dev/branches/realtime_search/solr/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java
lucene/dev/branches/realtime_search/solr/src/webapp/web/admin/analysis.jsp
lucene/dev/branches/realtime_search/solr/src/webapp/web/admin/form.jsp
Modified: lucene/dev/branches/realtime_search/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/build.xml?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/build.xml (original)
+++ lucene/dev/branches/realtime_search/build.xml Sat Apr 23 08:07:28 2011
@@ -19,7 +19,7 @@
<project name="lucene-solr" default="test" basedir=".">
<import file="common-build.xml"/>
- <target name="test" description="Test both Lucene and Solr">
+ <target name="test" description="Test both Lucene and Solr" depends="validate">
<sequential>
<subant target="test" inheritall="false" failonerror="true">
<fileset dir="lucene" includes="build.xml" />
@@ -35,7 +35,7 @@
<fileset dir="solr" includes="build.xml" />
</subant></sequential>
</target>
- <target name="compile" depends="validate" description="Compile Lucene and Solr">
+ <target name="compile" description="Compile Lucene and Solr">
<sequential>
<subant target="compile" inheritall="false" failonerror="true">
Modified: lucene/dev/branches/realtime_search/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/CHANGES.txt?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/realtime_search/lucene/CHANGES.txt Sat Apr 23 08:07:28 2011
@@ -387,8 +387,8 @@ Test Cases
Build
-* LUCENE-3006: Building javadocs will fail on warnings by default. Override with -Dfailonjavadocwarning=false (sarowe, gsingers)
-
+* LUCENE-3006: Building javadocs will fail on warnings by default.
+ Override with -Dfailonjavadocwarning=false (sarowe, gsingers)
======================= Lucene 3.x (not yet released) =======================
@@ -410,6 +410,14 @@ Bug fixes
seeking TermEnum (eg used by Solr's faceting) (Tom Burton-West, Mike
McCandless)
+* LUCENE-3042: When a filter or consumer added Attributes to a TokenStream
+ chain after it was already (partly) consumed [or clearAttributes(),
+ captureState(), cloneAttributes(),... was called by the Tokenizer],
+ the Tokenizer calling clearAttributes() or capturing state after addition
+ may not do this on the newly added Attribute. This bug affected only
+ very special use cases of the TokenStream-API, most users would not
+ have recognized it. (Uwe Schindler, Robert Muir)
+
======================= Lucene 3.1.0 =======================
Changes in backwards compatibility policy
Modified: lucene/dev/branches/realtime_search/lucene/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/common-build.xml?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/common-build.xml (original)
+++ lucene/dev/branches/realtime_search/lucene/common-build.xml Sat Apr 23 08:07:28 2011
@@ -308,7 +308,7 @@
</copy>
</target>
- <target name="compile" depends="compile-core, validate-lucene">
+ <target name="compile" depends="compile-core">
<!-- convenience target to compile core -->
</target>
@@ -565,7 +565,7 @@
</sequential>
</macrodef>
- <target name="test" depends="compile-test,junit-mkdir,junit-sequential,junit-parallel" description="Runs unit tests"/>
+ <target name="test" depends="compile-test,validate-lucene,junit-mkdir,junit-sequential,junit-parallel" description="Runs unit tests"/>
<target name="junit-mkdir">
<mkdir dir="${junit.output.dir}"/>
Modified: lucene/dev/branches/realtime_search/lucene/contrib/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/CHANGES.txt?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/CHANGES.txt (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/CHANGES.txt Sat Apr 23 08:07:28 2011
@@ -45,10 +45,15 @@ API Changes
======================= Lucene 3.x (not yet released) =======================
-Bug fixes
+Bug Fixes
* LUCENE-3026: SmartChineseAnalyzer's WordTokenFilter threw NullPointerException
on sentences longer than 32,767 characters. (wangzhenghang via Robert Muir)
+
+ * LUCENE-2939: Highlighter should try and use maxDocCharsToAnalyze in
+ WeightedSpanTermExtractor when adding a new field to MemoryIndex as well as
+ when using CachingTokenStream. This can be a significant performance bug for
+ large documents. (Mark Miller)
New Features
Modified: lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/Highlighter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/Highlighter.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/Highlighter.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/Highlighter.java Sat Apr 23 08:07:28 2011
@@ -197,6 +197,11 @@ public class Highlighter
tokenStream.reset();
TextFragment currentFrag = new TextFragment(newText,newText.length(), docFrags.size());
+
+ if (fragmentScorer instanceof QueryScorer) {
+ ((QueryScorer) fragmentScorer).setMaxDocCharsToAnalyze(maxDocCharsToAnalyze);
+ }
+
TokenStream newStream = fragmentScorer.init(tokenStream);
if(newStream != null) {
tokenStream = newStream;
Modified: lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/QueryScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/QueryScorer.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/QueryScorer.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/QueryScorer.java Sat Apr 23 08:07:28 2011
@@ -54,6 +54,7 @@ public class QueryScorer implements Scor
private IndexReader reader;
private boolean skipInitExtractor;
private boolean wrapToCaching = true;
+ private int maxCharsToAnalyze;
/**
* @param query Query to use for highlighting
@@ -209,7 +210,7 @@ public class QueryScorer implements Scor
private TokenStream initExtractor(TokenStream tokenStream) throws IOException {
WeightedSpanTermExtractor qse = defaultField == null ? new WeightedSpanTermExtractor()
: new WeightedSpanTermExtractor(defaultField);
-
+ qse.setMaxDocCharsToAnalyze(maxCharsToAnalyze);
qse.setExpandMultiTermQuery(expandMultiTermQuery);
qse.setWrapIfNotCachingTokenFilter(wrapToCaching);
if (reader == null) {
@@ -265,4 +266,8 @@ public class QueryScorer implements Scor
public void setWrapIfNotCachingTokenFilter(boolean wrap) {
this.wrapToCaching = wrap;
}
+
+ public void setMaxDocCharsToAnalyze(int maxDocCharsToAnalyze) {
+ this.maxCharsToAnalyze = maxDocCharsToAnalyze;
+ }
}
Modified: lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/WeightedSpanTermExtractor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/WeightedSpanTermExtractor.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/WeightedSpanTermExtractor.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/WeightedSpanTermExtractor.java Sat Apr 23 08:07:28 2011
@@ -56,6 +56,7 @@ public class WeightedSpanTermExtractor {
private boolean expandMultiTermQuery;
private boolean cachedTokenStream;
private boolean wrapToCaching = true;
+ private int maxDocCharsToAnalyze;
public WeightedSpanTermExtractor() {
}
@@ -320,13 +321,13 @@ public class WeightedSpanTermExtractor {
private AtomicReaderContext getLeafContextForField(String field) throws IOException {
if(wrapToCaching && !cachedTokenStream && !(tokenStream instanceof CachingTokenFilter)) {
- tokenStream = new CachingTokenFilter(tokenStream);
+ tokenStream = new CachingTokenFilter(new OffsetLimitTokenFilter(tokenStream, maxDocCharsToAnalyze));
cachedTokenStream = true;
}
AtomicReaderContext context = readers.get(field);
if (context == null) {
MemoryIndex indexer = new MemoryIndex();
- indexer.addField(field, tokenStream);
+ indexer.addField(field, new OffsetLimitTokenFilter(tokenStream, maxDocCharsToAnalyze));
tokenStream.reset();
IndexSearcher searcher = indexer.createSearcher();
// MEM index has only atomic ctx
@@ -545,4 +546,8 @@ public class WeightedSpanTermExtractor {
public void setWrapIfNotCachingTokenFilter(boolean wrap) {
this.wrapToCaching = wrap;
}
+
+ protected final void setMaxDocCharsToAnalyze(int maxDocCharsToAnalyze) {
+ this.maxDocCharsToAnalyze = maxDocCharsToAnalyze;
+ }
}
Modified: lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/index/codecs/MultiLevelSkipListReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/index/codecs/MultiLevelSkipListReader.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/index/codecs/MultiLevelSkipListReader.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/index/codecs/MultiLevelSkipListReader.java Sat Apr 23 08:07:28 2011
@@ -184,9 +184,21 @@ public abstract class MultiLevelSkipList
}
}
+ /** returns x == 0 ? 0 : Math.floor(Math.log(x) / Math.log(base)) */
+ static int log(int x, int base) {
+ assert base >= 2;
+ int ret = 0;
+ long n = base; // needs to be a long to avoid overflow
+ while (x >= n) {
+ n *= base;
+ ret++;
+ }
+ return ret;
+ }
+
/** Loads the skip levels */
private void loadSkipLevels() throws IOException {
- numberOfSkipLevels = docCount == 0 ? 0 : (int) Math.floor(Math.log(docCount) / Math.log(skipInterval[0]));
+ numberOfSkipLevels = log(docCount, skipInterval[0]);
if (numberOfSkipLevels > maxNumberOfSkipLevels) {
numberOfSkipLevels = maxNumberOfSkipLevels;
}
Modified: lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/index/codecs/MultiLevelSkipListWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/index/codecs/MultiLevelSkipListWriter.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/index/codecs/MultiLevelSkipListWriter.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/index/codecs/MultiLevelSkipListWriter.java Sat Apr 23 08:07:28 2011
@@ -61,7 +61,7 @@ public abstract class MultiLevelSkipList
this.skipInterval = skipInterval;
// calculate the maximum number of skip levels for this document frequency
- numberOfSkipLevels = df == 0 ? 0 : (int) Math.floor(Math.log(df) / Math.log(skipInterval));
+ numberOfSkipLevels = MultiLevelSkipListReader.log(df, skipInterval);
// make sure it does not exceed maxSkipLevels
if (numberOfSkipLevels > maxSkipLevels) {
Modified: lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/util/AttributeSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/util/AttributeSource.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/util/AttributeSource.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/util/AttributeSource.java Sat Apr 23 08:07:28 2011
@@ -93,10 +93,33 @@ public class AttributeSource {
}
}
+ /**
+ * This class holds the state of an AttributeSource.
+ * @see #captureState
+ * @see #restoreState
+ */
+ public static final class State implements Cloneable {
+ AttributeImpl attribute;
+ State next;
+
+ @Override
+ public Object clone() {
+ State clone = new State();
+ clone.attribute = (AttributeImpl) attribute.clone();
+
+ if (next != null) {
+ clone.next = (State) next.clone();
+ }
+
+ return clone;
+ }
+ }
+
// These two maps must always be in sync!!!
// So they are private, final and read-only from the outside (read-only iterators)
private final Map<Class<? extends Attribute>, AttributeImpl> attributes;
private final Map<Class<? extends AttributeImpl>, AttributeImpl> attributeImpls;
+ private final State[] currentState;
private AttributeFactory factory;
@@ -116,6 +139,7 @@ public class AttributeSource {
}
this.attributes = input.attributes;
this.attributeImpls = input.attributeImpls;
+ this.currentState = input.currentState;
this.factory = input.factory;
}
@@ -125,6 +149,7 @@ public class AttributeSource {
public AttributeSource(AttributeFactory factory) {
this.attributes = new LinkedHashMap<Class<? extends Attribute>, AttributeImpl>();
this.attributeImpls = new LinkedHashMap<Class<? extends AttributeImpl>, AttributeImpl>();
+ this.currentState = new State[1];
this.factory = factory;
}
@@ -147,11 +172,8 @@ public class AttributeSource {
* if one instance implements more than one Attribute interface.
*/
public final Iterator<AttributeImpl> getAttributeImplsIterator() {
- if (hasAttributes()) {
- if (currentState == null) {
- computeCurrentState();
- }
- final State initState = currentState;
+ final State initState = getCurrentState();
+ if (initState != null) {
return new Iterator<AttributeImpl>() {
private State state = initState;
@@ -225,7 +247,7 @@ public class AttributeSource {
// Attribute is a superclass of this interface
if (!attributes.containsKey(curInterface)) {
// invalidate state to force recomputation in captureState()
- this.currentState = null;
+ this.currentState[0] = null;
attributes.put(curInterface, att);
attributeImpls.put(clazz, att);
}
@@ -283,41 +305,21 @@ public class AttributeSource {
}
return attClass.cast(attImpl);
}
-
- /**
- * This class holds the state of an AttributeSource.
- * @see #captureState
- * @see #restoreState
- */
- public static final class State implements Cloneable {
- AttributeImpl attribute;
- State next;
- @Override
- public Object clone() {
- State clone = new State();
- clone.attribute = (AttributeImpl) attribute.clone();
-
- if (next != null) {
- clone.next = (State) next.clone();
- }
-
- return clone;
+ private State getCurrentState() {
+ State s = currentState[0];
+ if (s != null || !hasAttributes()) {
+ return s;
}
- }
-
- private State currentState = null;
-
- private void computeCurrentState() {
- currentState = new State();
- State c = currentState;
+ State c = s = currentState[0] = new State();
final Iterator<AttributeImpl> it = attributeImpls.values().iterator();
c.attribute = it.next();
while (it.hasNext()) {
c.next = new State();
c = c.next;
c.attribute = it.next();
- }
+ }
+ return s;
}
/**
@@ -325,13 +327,8 @@ public class AttributeSource {
* {@link AttributeImpl#clear()} on each Attribute implementation.
*/
public final void clearAttributes() {
- if (hasAttributes()) {
- if (currentState == null) {
- computeCurrentState();
- }
- for (State state = currentState; state != null; state = state.next) {
- state.attribute.clear();
- }
+ for (State state = getCurrentState(); state != null; state = state.next) {
+ state.attribute.clear();
}
}
@@ -340,14 +337,8 @@ public class AttributeSource {
* {@link #restoreState} to restore the state of this or another AttributeSource.
*/
public final State captureState() {
- if (!hasAttributes()) {
- return null;
- }
-
- if (currentState == null) {
- computeCurrentState();
- }
- return (State) this.currentState.clone();
+ final State state = this.getCurrentState();
+ return (state == null) ? null : (State) state.clone();
}
/**
@@ -382,15 +373,9 @@ public class AttributeSource {
@Override
public int hashCode() {
int code = 0;
- if (hasAttributes()) {
- if (currentState == null) {
- computeCurrentState();
- }
- for (State state = currentState; state != null; state = state.next) {
- code = code * 31 + state.attribute.hashCode();
- }
+ for (State state = getCurrentState(); state != null; state = state.next) {
+ code = code * 31 + state.attribute.hashCode();
}
-
return code;
}
@@ -413,14 +398,8 @@ public class AttributeSource {
}
// it is only equal if all attribute impls are the same in the same order
- if (this.currentState == null) {
- this.computeCurrentState();
- }
- State thisState = this.currentState;
- if (other.currentState == null) {
- other.computeCurrentState();
- }
- State otherState = other.currentState;
+ State thisState = this.getCurrentState();
+ State otherState = other.getCurrentState();
while (thisState != null && otherState != null) {
if (otherState.attribute.getClass() != thisState.attribute.getClass() || !otherState.attribute.equals(thisState.attribute)) {
return false;
@@ -473,13 +452,8 @@ public class AttributeSource {
* @see AttributeImpl#reflectWith
*/
public final void reflectWith(AttributeReflector reflector) {
- if (hasAttributes()) {
- if (currentState == null) {
- computeCurrentState();
- }
- for (State state = currentState; state != null; state = state.next) {
- state.attribute.reflectWith(reflector);
- }
+ for (State state = getCurrentState(); state != null; state = state.next) {
+ state.attribute.reflectWith(reflector);
}
}
@@ -495,10 +469,7 @@ public class AttributeSource {
if (hasAttributes()) {
// first clone the impls
- if (currentState == null) {
- computeCurrentState();
- }
- for (State state = currentState; state != null; state = state.next) {
+ for (State state = getCurrentState(); state != null; state = state.next) {
clone.attributeImpls.put(state.attribute.getClass(), (AttributeImpl) state.attribute.clone());
}
@@ -520,18 +491,13 @@ public class AttributeSource {
* {@link #cloneAttributes} instead of {@link #captureState}.
*/
public final void copyTo(AttributeSource target) {
- if (hasAttributes()) {
- if (currentState == null) {
- computeCurrentState();
- }
- for (State state = currentState; state != null; state = state.next) {
- final AttributeImpl targetImpl = target.attributeImpls.get(state.attribute.getClass());
- if (targetImpl == null) {
- throw new IllegalArgumentException("This AttributeSource contains AttributeImpl of type " +
- state.attribute.getClass().getName() + " that is not in the target");
- }
- state.attribute.copyTo(targetImpl);
+ for (State state = getCurrentState(); state != null; state = state.next) {
+ final AttributeImpl targetImpl = target.attributeImpls.get(state.attribute.getClass());
+ if (targetImpl == null) {
+ throw new IllegalArgumentException("This AttributeSource contains AttributeImpl of type " +
+ state.attribute.getClass().getName() + " that is not in the target");
}
+ state.attribute.copyTo(targetImpl);
}
}
Modified: lucene/dev/branches/realtime_search/lucene/src/test-framework/org/apache/lucene/analysis/BaseTokenStreamTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/test-framework/org/apache/lucene/analysis/BaseTokenStreamTestCase.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/test-framework/org/apache/lucene/analysis/BaseTokenStreamTestCase.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/test-framework/org/apache/lucene/analysis/BaseTokenStreamTestCase.java Sat Apr 23 08:07:28 2011
@@ -117,11 +117,24 @@ public abstract class BaseTokenStreamTes
assertEquals("type "+i, types[i], typeAtt.type());
if (posIncrements != null)
assertEquals("posIncrement "+i, posIncrements[i], posIncrAtt.getPositionIncrement());
+
+ // we can enforce some basic things about a few attributes even if the caller doesn't check:
+ if (offsetAtt != null) {
+ assertTrue("startOffset must be >= 0", offsetAtt.startOffset() >= 0);
+ assertTrue("endOffset must be >= 0", offsetAtt.endOffset() >= 0);
+ assertTrue("endOffset must be >= startOffset", offsetAtt.endOffset() >= offsetAtt.startOffset());
+ }
+ if (posIncrAtt != null) {
+ assertTrue("posIncrement must be >= 0", posIncrAtt.getPositionIncrement() >= 0);
+ }
}
assertFalse("end of stream", ts.incrementToken());
ts.end();
if (finalOffset != null)
assertEquals("finalOffset ", finalOffset.intValue(), offsetAtt.endOffset());
+ if (offsetAtt != null) {
+ assertTrue("finalOffset must be >= 0", offsetAtt.endOffset() >= 0);
+ }
ts.close();
}
Modified: lucene/dev/branches/realtime_search/lucene/src/test-framework/org/apache/lucene/index/codecs/mockrandom/MockRandomCodec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/test-framework/org/apache/lucene/index/codecs/mockrandom/MockRandomCodec.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/test-framework/org/apache/lucene/index/codecs/mockrandom/MockRandomCodec.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/test-framework/org/apache/lucene/index/codecs/mockrandom/MockRandomCodec.java Sat Apr 23 08:07:28 2011
@@ -122,7 +122,7 @@ public class MockRandomCodec extends Cod
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
// we pull this before the seed intentionally: because its not consumed at runtime
// (the skipInterval is written into postings header)
- int skipInterval = _TestUtil.nextInt(seedRandom, 2, 64);
+ int skipInterval = _TestUtil.nextInt(seedRandom, 2, 10);
if (LuceneTestCase.VERBOSE) {
System.out.println("MockRandomCodec: skipInterval=" + skipInterval);
Modified: lucene/dev/branches/realtime_search/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java Sat Apr 23 08:07:28 2011
@@ -128,6 +128,9 @@ public abstract class LuceneTestCase ext
TEMP_DIR = new File(s);
TEMP_DIR.mkdirs();
}
+
+ /** set of directories we created, in afterclass we try to clean these up */
+ static final Set<String> tempDirs = Collections.synchronizedSet(new HashSet<String>());
// by default we randomly pick a different codec for
// each test case (non-J4 tests) and each test class (J4
@@ -323,6 +326,7 @@ public abstract class LuceneTestCase ext
public static void beforeClassLuceneTestCaseJ4() {
staticSeed = "random".equals(TEST_SEED) ? seedRand.nextLong() : TwoLongs.fromString(TEST_SEED).l1;
random.setSeed(staticSeed);
+ tempDirs.clear();
stores = Collections.synchronizedMap(new IdentityHashMap<MockDirectoryWrapper,StackTraceElement[]>());
savedCodecProvider = CodecProvider.getDefault();
if ("randomPerField".equals(TEST_CODEC)) {
@@ -411,6 +415,16 @@ public abstract class LuceneTestCase ext
+ "free=" + Runtime.getRuntime().freeMemory() + ","
+ "total=" + Runtime.getRuntime().totalMemory());
}
+ // clear out any temp directories if we can
+ if (!testsFailed) {
+ for (String path : tempDirs) {
+ try {
+ _TestUtil.rmDir(new File(path));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
}
private static boolean testsFailed; /* true if any tests failed */
@@ -1058,6 +1072,7 @@ public abstract class LuceneTestCase ext
final File tmpFile = File.createTempFile("test", "tmp", TEMP_DIR);
tmpFile.delete();
tmpFile.mkdir();
+ tempDirs.add(tmpFile.getAbsolutePath());
return newFSDirectoryImpl(clazz.asSubclass(FSDirectory.class), tmpFile, null);
}
Modified: lucene/dev/branches/realtime_search/lucene/src/test-framework/org/apache/lucene/util/_TestUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/test-framework/org/apache/lucene/util/_TestUtil.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/test-framework/org/apache/lucene/util/_TestUtil.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/test-framework/org/apache/lucene/util/_TestUtil.java Sat Apr 23 08:07:28 2011
@@ -54,7 +54,9 @@ public class _TestUtil {
/** Returns temp dir, containing String arg in its name;
* does not create the directory. */
public static File getTempDir(String desc) {
- return new File(LuceneTestCase.TEMP_DIR, desc + "." + new Random().nextLong());
+ File f = new File(LuceneTestCase.TEMP_DIR, desc + "." + new Random().nextLong());
+ LuceneTestCase.tempDirs.add(f.getAbsolutePath());
+ return f;
}
/**
@@ -89,7 +91,8 @@ public class _TestUtil {
rmDir(destDir);
destDir.mkdir();
-
+ LuceneTestCase.tempDirs.add(destDir.getAbsolutePath());
+
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
Modified: lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/analysis/TestMockAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/analysis/TestMockAnalyzer.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/analysis/TestMockAnalyzer.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/analysis/TestMockAnalyzer.java Sat Apr 23 08:07:28 2011
@@ -1,5 +1,6 @@
package org.apache.lucene.analysis;
+import java.io.StringReader;
import java.util.Arrays;
import org.apache.lucene.util.automaton.Automaton;
@@ -95,4 +96,19 @@ public class TestMockAnalyzer extends Ba
new String[] { "ok", "fine" },
new int[] { 1, 2 });
}
+
+ public void testLUCENE_3042() throws Exception {
+ String testString = "t";
+
+ Analyzer analyzer = new MockAnalyzer(random);
+ TokenStream stream = analyzer.reusableTokenStream("dummy", new StringReader(testString));
+ stream.reset();
+ while (stream.incrementToken()) {
+ // consume
+ }
+ stream.end();
+
+ assertAnalyzesToReuse(analyzer, testString, new String[] { "t" });
+ }
+
}
Modified: lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestCompoundFile.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestCompoundFile.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestCompoundFile.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestCompoundFile.java Sat Apr 23 08:07:28 2011
@@ -57,8 +57,7 @@ public class TestCompoundFile extends Lu
@Override
public void setUp() throws Exception {
super.setUp();
- File file = new File(TEMP_DIR, "testIndex");
- _TestUtil.rmDir(file);
+ File file = _TestUtil.getTempDir("testIndex");
// use a simple FSDir here, to be sure to have SimpleFSInputs
dir = new SimpleFSDirectory(file,null);
}
@@ -66,7 +65,6 @@ public class TestCompoundFile extends Lu
@Override
public void tearDown() throws Exception {
dir.close();
- _TestUtil.rmDir(new File(TEMP_DIR, "testIndex"));
super.tearDown();
}
Modified: lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestDoc.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestDoc.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestDoc.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestDoc.java Sat Apr 23 08:07:28 2011
@@ -36,6 +36,7 @@ import org.apache.lucene.index.IndexWrit
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util._TestUtil;
import org.apache.lucene.index.codecs.CodecProvider;
@@ -60,10 +61,10 @@ public class TestDoc extends LuceneTestC
if (VERBOSE) {
System.out.println("TEST: setUp");
}
- workDir = new File(TEMP_DIR,"TestDoc");
+ workDir = _TestUtil.getTempDir("TestDoc");
workDir.mkdirs();
- indexDir = new File(workDir, "testIndex");
+ indexDir = _TestUtil.getTempDir("testIndex");
indexDir.mkdirs();
Directory directory = newFSDirectory(indexDir);
Modified: lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestFieldsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestFieldsReader.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestFieldsReader.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestFieldsReader.java Sat Apr 23 08:07:28 2011
@@ -286,8 +286,7 @@ public class TestFieldsReader extends Lu
*/
public void testLazyPerformance() throws Exception {
String userName = System.getProperty("user.name");
- File file = new File(TEMP_DIR, "lazyDir" + userName);
- _TestUtil.rmDir(file);
+ File file = _TestUtil.getTempDir("lazyDir" + userName);
Directory tmpDir = newFSDirectory(file);
assertTrue(tmpDir != null);
@@ -473,7 +472,7 @@ public class TestFieldsReader extends Lu
// LUCENE-1262
public void testExceptions() throws Throwable {
- File indexDir = new File(TEMP_DIR, "testfieldswriterexceptions");
+ File indexDir = _TestUtil.getTempDir("testfieldswriterexceptions");
try {
Directory dir = new FaultyFSDirectory(indexDir);
Modified: lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexReader.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexReader.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexReader.java Sat Apr 23 08:07:28 2011
@@ -1139,7 +1139,7 @@ public class TestIndexReader extends Luc
}
public void testOpenReaderAfterDelete() throws IOException {
- File dirFile = new File(TEMP_DIR, "deletetest");
+ File dirFile = _TestUtil.getTempDir("deletetest");
Directory dir = newFSDirectory(dirFile);
try {
IndexReader.open(dir, false);
Modified: lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java Sat Apr 23 08:07:28 2011
@@ -1090,7 +1090,7 @@ public class TestIndexReaderReopen exten
@Override
public void setUp() throws Exception {
super.setUp();
- indexDir = new File(TEMP_DIR, "IndexReaderReopen");
+ indexDir = _TestUtil.getTempDir("IndexReaderReopen");
}
public void testCloseOrig() throws Throwable {
Modified: lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java Sat Apr 23 08:07:28 2011
@@ -2756,7 +2756,7 @@ public class TestIndexWriter extends Luc
// Tests that if FSDir is opened w/ a NoLockFactory (or SingleInstanceLF),
// then IndexWriter ctor succeeds. Previously (LUCENE-2386) it failed
// when listAll() was called in IndexFileDeleter.
- Directory dir = newFSDirectory(new File(TEMP_DIR, "emptyFSDirNoLock"), NoLockFactory.getNoLockFactory());
+ Directory dir = newFSDirectory(_TestUtil.getTempDir("emptyFSDirNoLock"), NoLockFactory.getNoLockFactory());
new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random))).close();
dir.close();
}
Modified: lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexWriterLockRelease.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexWriterLockRelease.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexWriterLockRelease.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexWriterLockRelease.java Sat Apr 23 08:07:28 2011
@@ -21,6 +21,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util._TestUtil;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
@@ -39,7 +40,7 @@ public class TestIndexWriterLockRelease
public void setUp() throws Exception {
super.setUp();
if (this.__test_dir == null) {
- this.__test_dir = new File(TEMP_DIR, "testIndexWriter");
+ this.__test_dir = _TestUtil.getTempDir("testIndexWriter");
if (this.__test_dir.exists()) {
throw new IOException("test directory \"" + this.__test_dir.getPath() + "\" already exists (please remove by hand)");
Modified: lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnJRECrash.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnJRECrash.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnJRECrash.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnJRECrash.java Sat Apr 23 08:07:28 2011
@@ -41,7 +41,7 @@ public class TestIndexWriterOnJRECrash e
@Override
public void setUp() throws Exception {
super.setUp();
- tempDir = File.createTempFile("jrecrash", "tmp", TEMP_DIR);
+ tempDir = _TestUtil.getTempDir("jrecrash");
tempDir.delete();
tempDir.mkdir();
}
Modified: lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestLongPostings.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestLongPostings.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestLongPostings.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/index/TestLongPostings.java Sat Apr 23 08:07:28 2011
@@ -67,7 +67,7 @@ public class TestLongPostings extends Lu
// Don't use _TestUtil.getTempDir so that we own the
// randomness (ie same seed will point to same dir):
- Directory dir = newFSDirectory(new File(LuceneTestCase.TEMP_DIR, "longpostings" + "." + random.nextLong()));
+ Directory dir = newFSDirectory(_TestUtil.getTempDir("longpostings" + "." + random.nextLong()));
final int NUM_DOCS = (int) ((TEST_NIGHTLY ? 4e6 : (RANDOM_MULTIPLIER*2e4)) * (1+random.nextDouble()));
Modified: lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestBufferedIndexInput.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestBufferedIndexInput.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestBufferedIndexInput.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestBufferedIndexInput.java Sat Apr 23 08:07:28 2011
@@ -240,7 +240,7 @@ public class TestBufferedIndexInput exte
}
public void testSetBufferSize() throws IOException {
- File indexDir = new File(TEMP_DIR, "testSetBufferSize");
+ File indexDir = _TestUtil.getTempDir("testSetBufferSize");
MockFSDirectory dir = new MockFSDirectory(indexDir, random);
try {
IndexWriter writer = new IndexWriter(
Modified: lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestDirectory.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestDirectory.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestDirectory.java Sat Apr 23 08:07:28 2011
@@ -42,7 +42,7 @@ public class TestDirectory extends Lucen
// Test that different instances of FSDirectory can coexist on the same
// path, can read, write, and lock files.
public void testDirectInstantiation() throws Exception {
- File path = new File(TEMP_DIR, "testDirectInstantiation");
+ File path = _TestUtil.getTempDir("testDirectInstantiation");
int sz = 3;
Directory[] dirs = new Directory[sz];
@@ -134,7 +134,7 @@ public class TestDirectory extends Lucen
// LUCENE-1468
public void testFSDirectoryFilter() throws IOException {
- checkDirectoryFilter(newFSDirectory(new File(TEMP_DIR,"test")));
+ checkDirectoryFilter(newFSDirectory(_TestUtil.getTempDir("test")));
}
// LUCENE-1468
@@ -151,7 +151,7 @@ public class TestDirectory extends Lucen
// LUCENE-1468
public void testCopySubdir() throws Throwable {
- File path = new File(TEMP_DIR, "testsubdir");
+ File path = _TestUtil.getTempDir("testsubdir");
try {
path.mkdirs();
new File(path, "subdir").mkdirs();
@@ -164,7 +164,7 @@ public class TestDirectory extends Lucen
// LUCENE-1468
public void testNotDirectory() throws Throwable {
- File path = new File(TEMP_DIR, "testnotdir");
+ File path = _TestUtil.getTempDir("testnotdir");
Directory fsDir = new SimpleFSDirectory(path, null);
try {
IndexOutput out = fsDir.createOutput("afile");
Modified: lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestMultiMMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestMultiMMap.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestMultiMMap.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestMultiMMap.java Sat Apr 23 08:07:28 2011
@@ -41,7 +41,7 @@ public class TestMultiMMap extends Lucen
@Override
public void setUp() throws Exception {
super.setUp();
- workDir = new File(TEMP_DIR, "TestMultiMMap");
+ workDir = _TestUtil.getTempDir("TestMultiMMap");
workDir.mkdirs();
}
Modified: lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestRAMDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestRAMDirectory.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestRAMDirectory.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestRAMDirectory.java Sat Apr 23 08:07:28 2011
@@ -24,6 +24,7 @@ import java.io.ObjectOutputStream;
import java.io.ByteArrayOutputStream;
import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util._TestUtil;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
@@ -49,7 +50,7 @@ public class TestRAMDirectory extends Lu
@Override
public void setUp() throws Exception {
super.setUp();
- indexDir = new File(TEMP_DIR, "RAMDirIndex");
+ indexDir = _TestUtil.getTempDir("RAMDirIndex");
Directory dir = newFSDirectory(indexDir);
IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
Modified: lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestWindowsMMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestWindowsMMap.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestWindowsMMap.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/store/TestWindowsMMap.java Sat Apr 23 08:07:28 2011
@@ -20,6 +20,7 @@ package org.apache.lucene.store;
import java.io.File;
import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util._TestUtil;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
@@ -59,7 +60,7 @@ public class TestWindowsMMap extends Luc
}
private final static String storePathname =
- new File(TEMP_DIR,"testLuceneMmap").getAbsolutePath();
+ _TestUtil.getTempDir("testLuceneMmap").getAbsolutePath();
public void testMmapIndex() throws Exception {
// sometimes the directory is not cleaned by rmDir, because on Windows it
Modified: lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/util/TestAttributeSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/util/TestAttributeSource.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/util/TestAttributeSource.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/util/TestAttributeSource.java Sat Apr 23 08:07:28 2011
@@ -147,4 +147,14 @@ public class TestAttributeSource extends
fail("Should throw IllegalArgumentException");
} catch (IllegalArgumentException iae) {}
}
+
+ public void testLUCENE_3042() throws Exception {
+ final AttributeSource src1 = new AttributeSource();
+ src1.addAttribute(CharTermAttribute.class).append("foo");
+ int hash1 = src1.hashCode(); // this triggers a cached state
+ final AttributeSource src2 = new AttributeSource(src1);
+ src2.addAttribute(TypeAttribute.class).setType("bar");
+ assertTrue("The hashCode is identical, so the captured state was preserved.", hash1 != src1.hashCode());
+ assertEquals(src2.hashCode(), src1.hashCode());
+ }
}
Modified: lucene/dev/branches/realtime_search/lucene/src/tools/java/org/apache/lucene/validation/LicenseType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/tools/java/org/apache/lucene/validation/LicenseType.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/tools/java/org/apache/lucene/validation/LicenseType.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/tools/java/org/apache/lucene/validation/LicenseType.java Sat Apr 23 08:07:28 2011
@@ -33,7 +33,8 @@ public enum LicenseType {
MPL("Mozilla Public License", false), //NOT SURE on the required notice
PD("Public Domain", false),
//SUNBCLA("Sun Binary Code License Agreement"),
- SUN("Sun Open Source License", false)
+ SUN("Sun Open Source License", false),
+ FAKE("FAKE license - not needed", false)
;
private String display;
Modified: lucene/dev/branches/realtime_search/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/CHANGES.txt?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/CHANGES.txt (original)
+++ lucene/dev/branches/realtime_search/solr/CHANGES.txt Sat Apr 23 08:07:28 2011
@@ -105,8 +105,10 @@ New Features
levenshtein automata. (rmuir)
* SOLR-1873: SolrCloud - added shared/central config and core/shard managment via zookeeper,
- built-in load balancing, and infrastructure for future SolrCloud work.
- (yonik, Mark Miller)
+ built-in load balancing, and infrastructure for future SolrCloud work. (yonik, Mark Miller)
+ Additional Work:
+ SOLR-2324: SolrCloud solr.xml parameters are not persisted by CoreContainer.
+ (Massimo Schiavon, Mark Miller)
* SOLR-1729: Evaluation of NOW for date math is done only once per request for
consistency, and is also propagated to shards in distributed search.
@@ -129,6 +131,14 @@ New Features
* SOLR-2335: New 'field("...")' function syntax for refering to complex
field names (containing whitespace or special characters) in functions.
+* SOLR-1709: Distributed support for Date and Numeric Range Faceting
+ (Peter Sturge, David Smiley, hossman)
+
+* SOLR-2383: /browse improvements: generalize range and date facet display
+ (Jan Høydahl via yonik)
+
+
+
Optimizations
----------------------
@@ -218,6 +228,8 @@ Other Changes
and publish binary, javadoc, and source test-framework jars.
(Drew Farris, Robert Muir, Steve Rowe)
+* SOLR-2461: QuerySenderListener and AbstractSolrEventListener are
+ now public (hossman)
Documentation
----------------------
@@ -237,6 +249,10 @@ Carrot2 3.4.2
Upgrading from Solr 3.1
----------------------
+
+* The updateRequestProcessorChain for a RequestHandler is now defined
+ with update.chain rather than update.processor. The latter still works,
+ but has been deprecated.
Detailed Change List
----------------------
@@ -256,9 +272,42 @@ Bug Fixes
* SOLR-2455: Prevent double submit of forms in admin interface.
(Jeffrey Chang via uschindler)
+* SOLR-2464: Fix potential slowness in QueryValueSource (the query() function) when
+ the query is very sparse and may not match any documents in a segment. (yonik)
+
+* SOLR-2469: When using java replication with replicateAfter=startup, the first
+ commit point on server startup is never removed. (yonik)
+
+* SOLR-2466: SolrJ's CommonsHttpSolrServer would retry requests on failure, regardless
+ of the configured maxRetries, due to HttpClient having it's own retry mechanism
+ by default. The retryCount of HttpClient is now set to 0, and SolrJ does
+ the retry. (yonik)
+
+* SOLR-2409: edismax parser - treat the text of a fielded query as a literal if the
+ fieldname does not exist. For example Mission: Impossible should not search on
+ the "Mission" field unless it's a valid field in the schema. (Ryan McKinley, yonik)
+
+* SOLR-2403: facet.sort=index reported incorrect results for distributed search
+ in a number of scenarios when facet.mincount>0. This patch also adds some
+ performance/algorithmic improvements when (facet.sort=count && facet.mincount=1
+ && facet.limit=-1) and when (facet.sort=index && facet.mincount>0) (yonik)
+
+* SOLR-2333: The "rename" core admin action does not persist the new name to solr.xml
+ (Rasmus Hahn, Paul R. Brown via Mark Miller)
+
+* SOLR-2390: Performance of usePhraseHighlighter is terrible on very large Documents,
+ regardless of hl.maxDocCharsToAnalyze. (Mark Miller)
+
+* SOLR-2474: The helper TokenStreams in analysis.jsp and AnalysisRequestHandlerBase
+ did not clear all attributes so they displayed incorrect attribute values for tokens
+ in later filter stages. (uschindler, rmuir, yonik)
+
Other Changes
----------------------
+* SOLR-2105: Rename RequestHandler param 'update.processor' to 'update.chain'.
+ (Jan Høydahl via Mark Miller)
+
Build
----------------------
Modified: lucene/dev/branches/realtime_search/solr/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/build.xml?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/build.xml (original)
+++ lucene/dev/branches/realtime_search/solr/build.xml Sat Apr 23 08:07:28 2011
@@ -120,7 +120,7 @@
<!-- Compile the project. -->
<target name="compile"
description="Compile the source code."
- depends="validate-solr, compile-solrj">
+ depends="compile-solrj">
<solr-javac destdir="${dest}/solr"
classpathref="compile.classpath.solrj">
@@ -394,7 +394,7 @@
<!-- Run contrib unit tests. -->
<target name="test"
description="Runs the core unit tests."
- depends="test-core, test-contrib, test-jsp" />
+ depends="validate-solr, test-core, test-contrib, test-jsp" />
<target name="junit" depends="compileTests,junit-mkdir,junit-sequential,junit-parallel"/>
Modified: lucene/dev/branches/realtime_search/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImportHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImportHandler.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImportHandler.java (original)
+++ lucene/dev/branches/realtime_search/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImportHandler.java Sat Apr 23 08:07:28 2011
@@ -194,7 +194,7 @@ public class DataImportHandler extends R
IMPORT_CMD.equals(command)) {
UpdateRequestProcessorChain processorChain =
- req.getCore().getUpdateProcessingChain(params.get(UpdateParams.UPDATE_PROCESSOR));
+ req.getCore().getUpdateProcessingChain(params.get(UpdateParams.UPDATE_CHAIN));
UpdateRequestProcessor processor = processorChain.createProcessor(req, rsp);
SolrResourceLoader loader = req.getCore().getResourceLoader();
SolrWriter sw = getSolrWriter(processor, loader, requestParams, req);
Modified: lucene/dev/branches/realtime_search/solr/contrib/uima/src/test/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/contrib/uima/src/test/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/contrib/uima/src/test/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java (original)
+++ lucene/dev/branches/realtime_search/solr/contrib/uima/src/test/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java Sat Apr 23 08:07:28 2011
@@ -108,7 +108,7 @@ public class UIMAUpdateRequestProcessorT
private void addDoc(String doc) throws Exception {
Map<String, String[]> params = new HashMap<String, String[]>();
- params.put(UpdateParams.UPDATE_PROCESSOR, new String[] { "uima" });
+ params.put(UpdateParams.UPDATE_CHAIN, new String[] { "uima" });
MultiMapSolrParams mmparams = new MultiMapSolrParams(params);
SolrQueryRequestBase req = new SolrQueryRequestBase(h.getCore(), (SolrParams) mmparams) {
};
Modified: lucene/dev/branches/realtime_search/solr/contrib/uima/src/test/resources/solr-uima/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/contrib/uima/src/test/resources/solr-uima/conf/solrconfig.xml?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/contrib/uima/src/test/resources/solr-uima/conf/solrconfig.xml (original)
+++ lucene/dev/branches/realtime_search/solr/contrib/uima/src/test/resources/solr-uima/conf/solrconfig.xml Sat Apr 23 08:07:28 2011
@@ -855,7 +855,7 @@
-->
<requestHandler name="/update" class="solr.XmlUpdateRequestHandler">
<lst name="defaults">
- <str name="update.processor">uima</str>
+ <str name="update.chain">uima</str>
</lst>
</requestHandler>
@@ -997,7 +997,7 @@
anyway. You have to link the chain to an update handler above to use
it ie: <requestHandler name="/update
"class="solr.XmlUpdateRequestHandler"> <lst name="defaults"> <str
- name="update.processor">dedupe</str> </lst> </requestHandler>
+ name="update.chain">dedupe</str> </lst> </requestHandler>
-->
<updateRequestProcessorChain name="uima">
Modified: lucene/dev/branches/realtime_search/solr/example/solr/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/example/solr/conf/solrconfig.xml?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/example/solr/conf/solrconfig.xml (original)
+++ lucene/dev/branches/realtime_search/solr/example/solr/conf/solrconfig.xml Sat Apr 23 08:07:28 2011
@@ -774,6 +774,7 @@
<str name="q.alt">*:*</str>
<str name="rows">10</str>
<str name="fl">*,score</str>
+
<str name="mlt.qf">
text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
</str>
@@ -792,6 +793,8 @@
<int name="facet.range.start">0</int>
<int name="facet.range.end">600</int>
<int name="facet.range.gap">50</int>
+ <str name="facet.range">popularity</str>
+ <int name="f.popularity.facet.range.gap">3</int>
<str name="facet.range.other">after</str>
<str name="facet.date">manufacturedate_dt</str>
<str name="facet.date.start">NOW/YEAR-10YEARS</str>
@@ -841,7 +844,7 @@
-->
<!--
<lst name="defaults">
- <str name="update.processor">dedupe</str>
+ <str name="update.chain">dedupe</str>
</lst>
-->
</requestHandler>
Modified: lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/VM_global_library.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/VM_global_library.vm?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/VM_global_library.vm (original)
+++ lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/VM_global_library.vm Sat Apr 23 08:07:28 2011
@@ -88,13 +88,13 @@
<ul>
#foreach ($facet in $field)
#set($theDate = $date.toDate("yyyy-MM-dd'T'HH:mm:ss'Z'", $facet.key))
- #set($value = '["' + $facet.key + '" TO "' + $facet.key + $gap + '"]')
+ #set($value = '["' + $facet.key + '" TO "' + $facet.key + $gap + '"}')
#set($facetURL = "#url_for_facet_date_filter($fieldName, $value)")
#if ($facetURL != '')
#if ($facet.key != "gap" && $facet.key != "start" && $facet.key != "end" && $facet.key != "before" && $facet.key != "after")
- <li><a href="$facetURL">$date.format('MMM yyyy', $theDate)</a> ($facet.value)</li>
+ <li><a href="$facetURL">$date.format('MMM yyyy', $theDate) $gap</a> ($facet.value)</li>
#end
#if ($facet.key == "before" && $facet.value > 0)
<li><a href="$facetURL">Before</a> ($facet.value)</li>
@@ -113,20 +113,20 @@
<span class="facet-field">$display</span>
<ul>
#if($before && $before != "")
- #set($value = "[* TO " + $start + "]")
+ #set($value = "[* TO " + $start + "}")
#set($facetURL = "#url_for_facet_range_filter($fieldName, $value)")
<li><a href="$facetURL">Less than $start</a> ($before)</li>
#end
#foreach ($facet in $field)
#set($rangeEnd = $math.add($facet.key, $gap))
- #set($value = "[" + $facet.key + " TO " + $rangeEnd + "]")
+ #set($value = "[" + $facet.key + " TO " + $rangeEnd + "}")
#set($facetURL = "#url_for_facet_range_filter($fieldName, $value)")
#if ($facetURL != '')
- <li><a href="$facetURL">$facet.key</a> ($facet.value)</li>
+ <li><a href="$facetURL">$facet.key - $rangeEnd</a> ($facet.value)</li>
#end
#end
- #if($end && $end != "")
- #set($value = "[" + $end + " TO *]")
+ #if($end && $end != "" && $after > 0)
+ #set($value = "[" + $end + " TO *}")
#set($facetURL = "#url_for_facet_range_filter($fieldName, $value)")
<li><a href="$facetURL">More than $math.toNumber($end)</a> ($after)</li>
#end
@@ -180,4 +180,8 @@
$v
#end
#end
-#end
\ No newline at end of file
+#end
+
+#macro(capitalize $name)
+ ${name.substring(0,1).toUpperCase()}${name.substring(1)}
+#end
\ No newline at end of file
Modified: lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/facet_dates.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/facet_dates.vm?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/facet_dates.vm (original)
+++ lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/facet_dates.vm Sat Apr 23 08:07:28 2011
@@ -1,5 +1,9 @@
##TODO: Generically deal with all dates
<h2 #annTitle("Facets generated by adding &facet.date= to the request")>Date Facets</h2>
-#set($field = $response.response.facet_counts.facet_dates.manufacturedate_dt)
-#set($gap = $response.response.facet_counts.facet_dates.manufacturedate_dt.gap)
-#display_facet_date($field, "Manufacture Date", "manufacturedate_dt", $gap)
+#foreach ($field in $response.response.facet_counts.facet_dates)
+ #set($name = $field.key)
+ #set($display = "#capitalize($name)")
+ #set($f = $field.value)
+ #set($gap = $field.value.gap)
+ #display_facet_date($f, $display, $name, $gap)
+#end
\ No newline at end of file
Modified: lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/facet_ranges.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/facet_ranges.vm?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/facet_ranges.vm (original)
+++ lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/facet_ranges.vm Sat Apr 23 08:07:28 2011
@@ -1,10 +1,12 @@
<h2 #annTitle("Facets generated by adding &facet.range= to the request")>Range Facets</h2>
-#set($field = $response.response.facet_counts.facet_ranges.price.counts)
-#set($start = $response.response.facet_counts.facet_ranges.price.start)
-#set($end = $response.response.facet_counts.facet_ranges.price.end)
-#set($gap = $response.response.facet_counts.facet_ranges.price.gap)
-#set($before = $response.response.facet_counts.facet_ranges.price.before)
-#set($after = $response.response.facet_counts.facet_ranges.price.after)
-##TODO: Make this display the "range", not just the lower value
-##TODO: Have a generic way to deal with ranges
-#display_facet_range($field, "Price (in $)", "price", $start, $end, $gap, $before, $after)
+#foreach ($field in $response.response.facet_counts.facet_ranges)
+ #set($name = $field.key)
+ #set($display = "#capitalize($name)")
+ #set($f = $field.value.counts)
+ #set($start = $field.value.start)
+ #set($end = $field.value.end)
+ #set($gap = $field.value.gap)
+ #set($before = $field.value.before)
+ #set($after = $field.value.after)
+ #display_facet_range($f, $display, $name, $start, $end, $gap, $before, $after)
+#end
\ No newline at end of file
Modified: lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/main.css
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/main.css?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/main.css (original)
+++ lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/main.css Sat Apr 23 08:07:28 2011
@@ -18,6 +18,18 @@
margin-left: 20px;
}
+.parsed_query_header {
+ font-family: Helvetica, Arial, sans-serif;
+ font-size: 10pt;
+ font-weight: bold;
+}
+
+.parsed_query {
+ font-family: Courier, Courier New, monospaced;
+ font-size: 10pt;
+ font-weight: normal;
+}
+
body {
font-family: Helvetica, Arial, sans-serif;
font-size: 10pt;
Modified: lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/query.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/query.vm?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/query.vm (original)
+++ lucene/dev/branches/realtime_search/solr/example/solr/conf/velocity/query.vm Sat Apr 23 08:07:28 2011
@@ -27,14 +27,16 @@
#end
#end
</div>
+ <div class="parsed_query_header">
#if($request.params.get('debugQuery'))
- <a href="#" onclick='jQuery(this).siblings("pre").toggle(); return false;'>toggle parsed query</a>
- <pre style="display:none">$response.response.debug.parsedquery</pre>
+ <a href="#" onclick='jQuery(this).siblings("div").toggle(); return false;'>toggle parsed query</a>
+ <div class="parsed_query" style="display:none">$response.response.debug.parsedquery</div>
#end
#set($queryOpts = $request.params.get("queryOpts"))
#if($queryOpts && $queryOpts != "")
<input type="hidden" name="queryOpts" value="$queryOpts"/>
#end
+ </div>
</form>
</div>
Modified: lucene/dev/branches/realtime_search/solr/src/common/org/apache/solr/common/SolrDocumentList.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/src/common/org/apache/solr/common/SolrDocumentList.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/src/common/org/apache/solr/common/SolrDocumentList.java (original)
+++ lucene/dev/branches/realtime_search/solr/src/common/org/apache/solr/common/SolrDocumentList.java Sat Apr 23 08:07:28 2011
@@ -61,7 +61,7 @@ public class SolrDocumentList extends Ar
public String toString() {
return "{numFound="+numFound
+",start="+start
- + (maxScore!=null ? ""+maxScore : "")
+ + (maxScore!=null ? ",maxScore="+maxScore : "")
+",docs="+super.toString()
+"}";
}
Modified: lucene/dev/branches/realtime_search/solr/src/common/org/apache/solr/common/params/UpdateParams.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/src/common/org/apache/solr/common/params/UpdateParams.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/src/common/org/apache/solr/common/params/UpdateParams.java (original)
+++ lucene/dev/branches/realtime_search/solr/src/common/org/apache/solr/common/params/UpdateParams.java Sat Apr 23 08:07:28 2011
@@ -43,8 +43,11 @@ public interface UpdateParams
/** Rollback update commands */
public static String ROLLBACK = "rollback";
- /** Select the update processor to use. A RequestHandler may or may not respect this parameter */
- public static final String UPDATE_PROCESSOR = "update.processor";
+ /** Select the update processor chain to use. A RequestHandler may or may not respect this parameter */
+ public static final String UPDATE_CHAIN = "update.chain";
+ // TODO: Include the old deprecated param, for removal in Solr 4.0
+ public static final String UPDATE_CHAIN_DEPRECATED = "update.processor";
+
/**
* If optimizing, set the maximum number of segments left in the index after optimization. 1 is the default (and is equivalent to calling IndexWriter.optimize() in Lucene).
*/
Modified: lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/core/AbstractSolrEventListener.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/core/AbstractSolrEventListener.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/core/AbstractSolrEventListener.java (original)
+++ lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/core/AbstractSolrEventListener.java Sat Apr 23 08:07:28 2011
@@ -23,7 +23,7 @@ import org.apache.solr.search.SolrIndexS
/**
*/
-class AbstractSolrEventListener implements SolrEventListener {
+public class AbstractSolrEventListener implements SolrEventListener {
protected final SolrCore core;
public AbstractSolrEventListener(SolrCore core) {
this.core = core;
Modified: lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/core/CoreContainer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/core/CoreContainer.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/core/CoreContainer.java (original)
+++ lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/core/CoreContainer.java Sat Apr 23 08:07:28 2011
@@ -79,6 +79,7 @@ public class CoreContainer
protected Map<String ,IndexSchema> indexSchemaCache;
protected String adminHandler;
protected boolean shareSchema;
+ protected Integer zkClientTimeout;
protected String solrHome;
protected String defaultCoreName = "";
private ZkController zkController;
@@ -313,7 +314,7 @@ public class CoreContainer
zkHost = cfg.get("solr/@zkHost" , null);
adminPath = cfg.get("solr/cores/@adminPath", null);
shareSchema = cfg.getBool("solr/cores/@shareSchema", false);
- int zkClientTimeout = cfg.getInt("solr/cores/@zkClientTimeout", 10000);
+ zkClientTimeout = cfg.getInt("solr/cores/@zkClientTimeout", 10000);
hostPort = System.getProperty("hostPort");
if (hostPort == null) {
@@ -500,7 +501,12 @@ public class CoreContainer
SolrCore old = null;
synchronized (cores) {
old = cores.put(name, core);
+ /*
+ * set both the name of the descriptor and the name of the
+ * core, since the descriptors name is used for persisting.
+ */
core.setName(name);
+ core.getCoreDescriptor().name = name;
}
if (zkController != null) {
@@ -884,6 +890,7 @@ public class CoreContainer
if (this.libDir != null) {
writeAttribute(w,"sharedLib",libDir);
}
+ if(zkHost != null) writeAttribute(w, "zkHost", zkHost);
writeAttribute(w,"persistent",isPersistent());
w.write(">\n");
@@ -892,9 +899,13 @@ public class CoreContainer
}
w.write(" <cores");
writeAttribute(w, "adminPath",adminPath);
- if(adminHandler != null) writeAttribute(w, "adminHandler",adminHandler);
- if(shareSchema) writeAttribute(w, "shareSchema","true");
- if(!defaultCoreName.equals("")) writeAttribute(w, "defaultCoreName",defaultCoreName);
+ if(adminHandler != null) writeAttribute(w, "adminHandler", adminHandler);
+ if(shareSchema) writeAttribute(w, "shareSchema", "true");
+ if(!defaultCoreName.equals("")) writeAttribute(w, "defaultCoreName", defaultCoreName);
+ if(host != null) writeAttribute(w, "host", host);
+ if(hostPort != null) writeAttribute(w, "hostPort", hostPort);
+ if(zkClientTimeout != null) writeAttribute(w, "zkClientTimeout", zkClientTimeout);
+ if(hostContext != null) writeAttribute(w, "hostContext", hostContext);
w.write(">\n");
synchronized(cores) {
Modified: lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/core/QuerySenderListener.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/core/QuerySenderListener.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/core/QuerySenderListener.java (original)
+++ lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/core/QuerySenderListener.java Sat Apr 23 08:07:28 2011
@@ -32,7 +32,7 @@ import java.util.List;
/**
* @version $Id$
*/
-class QuerySenderListener extends AbstractSolrEventListener {
+public class QuerySenderListener extends AbstractSolrEventListener {
public QuerySenderListener(SolrCore core) {
super(core);
}
Modified: lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java?rev=1096120&r1=1096119&r2=1096120&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java (original)
+++ lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java Sat Apr 23 08:07:28 2011
@@ -337,6 +337,7 @@ public abstract class AnalysisRequestHan
@Override
public boolean incrementToken() throws IOException {
if (tokenIterator.hasNext()) {
+ clearAttributes();
AttributeSource next = tokenIterator.next();
Iterator<Class<? extends Attribute>> atts = next.getAttributeClassesIterator();
while (atts.hasNext()) // make sure all att impls in the token exist here