You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by yo...@apache.org on 2011/12/04 02:14:58 UTC
svn commit: r1210041 [4/4] - in /lucene/dev/branches/solrcloud: ./
dev-tools/eclipse/ dev-tools/idea/lucene/contrib/ dev-tools/maven/
dev-tools/maven/solr/core/ lucene/ lucene/contrib/
lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appendi...
Modified: lucene/dev/branches/solrcloud/lucene/src/test/org/apache/lucene/search/TestPrefixRandom.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/test/org/apache/lucene/search/TestPrefixRandom.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/test/org/apache/lucene/search/TestPrefixRandom.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/test/org/apache/lucene/search/TestPrefixRandom.java Sun Dec 4 01:14:52 2011
@@ -35,6 +35,7 @@ import org.apache.lucene.store.Directory
import org.apache.lucene.util.AttributeSource;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.StringHelper;
import org.apache.lucene.util._TestUtil;
/**
@@ -104,7 +105,7 @@ public class TestPrefixRandom extends Lu
@Override
protected AcceptStatus accept(BytesRef term) throws IOException {
- return term.startsWith(prefix) ? AcceptStatus.YES : AcceptStatus.NO;
+ return StringHelper.startsWith(term, prefix) ? AcceptStatus.YES : AcceptStatus.NO;
}
}
Modified: lucene/dev/branches/solrcloud/lucene/src/test/org/apache/lucene/search/TestSearcherManager.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/test/org/apache/lucene/search/TestSearcherManager.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/test/org/apache/lucene/search/TestSearcherManager.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/test/org/apache/lucene/search/TestSearcherManager.java Sun Dec 4 01:14:52 2011
@@ -237,9 +237,7 @@ public class TestSearcherManager extends
});
thread.start();
awaitEnterWarm.await();
- for (int i = 0; i < 2; i++) {
- searcherManager.close();
- }
+ searcherManager.close();
awaitClose.countDown();
thread.join();
try {
Modified: lucene/dev/branches/solrcloud/lucene/src/test/org/apache/lucene/store/TestFileSwitchDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/test/org/apache/lucene/store/TestFileSwitchDirectory.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/test/org/apache/lucene/store/TestFileSwitchDirectory.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/test/org/apache/lucene/store/TestFileSwitchDirectory.java Sun Dec 4 01:14:52 2011
@@ -24,13 +24,12 @@ import java.util.HashSet;
import java.util.Set;
import org.apache.lucene.analysis.MockAnalyzer;
-import org.apache.lucene.index.IndexFileNames;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.TestIndexWriterReader;
import org.apache.lucene.index.codecs.Codec;
-import org.apache.lucene.index.codecs.DefaultStoredFieldsWriter;
+import org.apache.lucene.index.codecs.lucene40.Lucene40StoredFieldsWriter;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util._TestUtil;
@@ -41,8 +40,8 @@ public class TestFileSwitchDirectory ext
*/
public void testBasic() throws IOException {
Set<String> fileExtensions = new HashSet<String>();
- fileExtensions.add(DefaultStoredFieldsWriter.FIELDS_EXTENSION);
- fileExtensions.add(DefaultStoredFieldsWriter.FIELDS_INDEX_EXTENSION);
+ fileExtensions.add(Lucene40StoredFieldsWriter.FIELDS_EXTENSION);
+ fileExtensions.add(Lucene40StoredFieldsWriter.FIELDS_INDEX_EXTENSION);
MockDirectoryWrapper primaryDir = new MockDirectoryWrapper(random, new RAMDirectory());
primaryDir.setCheckIndexOnClose(false); // only part of an index
Modified: lucene/dev/branches/solrcloud/modules/analysis/common/src/java/org/apache/lucene/analysis/charfilter/HTMLStripCharFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/modules/analysis/common/src/java/org/apache/lucene/analysis/charfilter/HTMLStripCharFilter.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/modules/analysis/common/src/java/org/apache/lucene/analysis/charfilter/HTMLStripCharFilter.java (original)
+++ lucene/dev/branches/solrcloud/modules/analysis/common/src/java/org/apache/lucene/analysis/charfilter/HTMLStripCharFilter.java Sun Dec 4 01:14:52 2011
@@ -124,8 +124,8 @@ public class HTMLStripCharFilter extends
private boolean isHex(int ch) {
return (ch>='0' && ch<='9') ||
- (ch>='A' && ch<='Z') ||
- (ch>='a' && ch<='z');
+ (ch>='A' && ch<='F') ||
+ (ch>='a' && ch<='f');
}
private boolean isAlpha(int ch) {
Modified: lucene/dev/branches/solrcloud/modules/queries/src/java/org/apache/lucene/queries/BooleanFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/modules/queries/src/java/org/apache/lucene/queries/BooleanFilter.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/modules/queries/src/java/org/apache/lucene/queries/BooleanFilter.java (original)
+++ lucene/dev/branches/solrcloud/modules/queries/src/java/org/apache/lucene/queries/BooleanFilter.java Sun Dec 4 01:14:52 2011
@@ -54,8 +54,10 @@ public class BooleanFilter extends Filte
FixedBitSet res = null;
final IndexReader reader = context.reader;
+ boolean hasShouldClauses = false;
for (final FilterClause fc : clauses) {
if (fc.getOccur() == Occur.SHOULD) {
+ hasShouldClauses = true;
final DocIdSetIterator disi = getDISI(fc.getFilter(), context);
if (disi == null) continue;
if (res == null) {
@@ -64,10 +66,13 @@ public class BooleanFilter extends Filte
res.or(disi);
}
}
+ if (hasShouldClauses && res == null)
+ return DocIdSet.EMPTY_DOCIDSET;
for (final FilterClause fc : clauses) {
if (fc.getOccur() == Occur.MUST_NOT) {
if (res == null) {
+ assert !hasShouldClauses;
res = new FixedBitSet(reader.maxDoc());
res.set(0, reader.maxDoc()); // NOTE: may set bits on deleted docs
}
Modified: lucene/dev/branches/solrcloud/modules/queries/src/test/org/apache/lucene/queries/BooleanFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/modules/queries/src/test/org/apache/lucene/queries/BooleanFilterTest.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/modules/queries/src/test/org/apache/lucene/queries/BooleanFilterTest.java (original)
+++ lucene/dev/branches/solrcloud/modules/queries/src/test/org/apache/lucene/queries/BooleanFilterTest.java Sun Dec 4 01:14:52 2011
@@ -36,6 +36,7 @@ import org.apache.lucene.search.TermQuer
import org.apache.lucene.search.QueryWrapperFilter;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.Bits;
+import org.apache.lucene.util.FixedBitSet;
import org.apache.lucene.util.LuceneTestCase;
import java.io.IOException;
@@ -92,6 +93,15 @@ public class BooleanFilterTest extends L
return new QueryWrapperFilter(new TermQuery(new Term(field, text)));
}
+ private Filter getEmptyFilter() {
+ return new Filter() {
+ @Override
+ public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) {
+ return new FixedBitSet(context.reader.maxDoc());
+ }
+ };
+ }
+
private Filter getNullDISFilter() {
return new Filter() {
@Override
@@ -309,4 +319,21 @@ public class BooleanFilterTest extends L
booleanFilter.add(getNullDISIFilter(), Occur.MUST_NOT);
tstFilterCard("A single MUST_NOT filter that returns a null DIS should be invisible", 5, booleanFilter);
}
+
+ public void testNonMatchingShouldsAndMusts() throws Exception {
+ BooleanFilter booleanFilter = new BooleanFilter();
+ booleanFilter.add(getEmptyFilter(), Occur.SHOULD);
+ booleanFilter.add(getTermsFilter("accessRights", "admin"), Occur.MUST);
+ tstFilterCard(">0 shoulds with no matches should return no docs", 0, booleanFilter);
+
+ booleanFilter = new BooleanFilter();
+ booleanFilter.add(getNullDISFilter(), Occur.SHOULD);
+ booleanFilter.add(getTermsFilter("accessRights", "admin"), Occur.MUST);
+ tstFilterCard(">0 shoulds with no matches should return no docs", 0, booleanFilter);
+
+ booleanFilter = new BooleanFilter();
+ booleanFilter.add(getNullDISIFilter(), Occur.SHOULD);
+ booleanFilter.add(getTermsFilter("accessRights", "admin"), Occur.MUST);
+ tstFilterCard(">0 shoulds with no matches should return no docs", 0, booleanFilter);
+ }
}
Modified: lucene/dev/branches/solrcloud/modules/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndPrefixQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/modules/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndPrefixQuery.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/modules/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndPrefixQuery.java (original)
+++ lucene/dev/branches/solrcloud/modules/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndPrefixQuery.java Sun Dec 4 01:14:52 2011
@@ -19,6 +19,7 @@ package org.apache.lucene.queryparser.su
import org.apache.lucene.index.Term;
import org.apache.lucene.index.Terms;
import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.StringHelper;
import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.MultiFields;
@@ -67,7 +68,7 @@ public class SrndPrefixQuery extends Sim
if (status == TermsEnum.SeekStatus.FOUND) {
mtv.visitMatchingTerm(getLucenePrefixTerm(fieldName));
} else if (status == TermsEnum.SeekStatus.NOT_FOUND) {
- if (termsEnum.term().startsWith(prefixRef)) {
+ if (StringHelper.startsWith(termsEnum.term(), prefixRef)) {
mtv.visitMatchingTerm(new Term(fieldName, termsEnum.term().utf8ToString()));
} else {
skip = true;
@@ -80,7 +81,7 @@ public class SrndPrefixQuery extends Sim
if (!skip) {
while(true) {
BytesRef text = termsEnum.next();
- if (text != null && text.startsWith(prefixRef)) {
+ if (text != null && StringHelper.startsWith(text, prefixRef)) {
mtv.visitMatchingTerm(new Term(fieldName, text.utf8ToString()));
} else {
break;
Modified: lucene/dev/branches/solrcloud/modules/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndTruncQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/modules/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndTruncQuery.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/modules/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndTruncQuery.java (original)
+++ lucene/dev/branches/solrcloud/modules/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndTruncQuery.java Sun Dec 4 01:14:52 2011
@@ -20,6 +20,7 @@ import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.index.Terms;
import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.StringHelper;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.MultiFields;
@@ -106,7 +107,7 @@ public class SrndTruncQuery extends Simp
}
while(text != null) {
- if (text != null && text.startsWith(prefixRef)) {
+ if (text != null && StringHelper.startsWith(text, prefixRef)) {
String textString = text.utf8ToString();
matcher.reset(textString.substring(prefixLength));
if (matcher.matches()) {
Modified: lucene/dev/branches/solrcloud/modules/suggest/src/test/org/apache/lucene/search/suggest/LookupBenchmarkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/modules/suggest/src/test/org/apache/lucene/search/suggest/LookupBenchmarkTest.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/modules/suggest/src/test/org/apache/lucene/search/suggest/LookupBenchmarkTest.java (original)
+++ lucene/dev/branches/solrcloud/modules/suggest/src/test/org/apache/lucene/search/suggest/LookupBenchmarkTest.java Sun Dec 4 01:14:52 2011
@@ -29,10 +29,9 @@ import java.util.Locale;
import java.util.Random;
import java.util.concurrent.Callable;
-import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util.RamUsageEstimator;
+import org.apache.lucene.util.*;
import org.apache.lucene.search.suggest.Lookup;
-import org.apache.lucene.search.suggest.fst.FSTLookup;
+import org.apache.lucene.search.suggest.fst.FSTCompletionLookup;
import org.apache.lucene.search.suggest.jaspell.JaspellLookup;
import org.apache.lucene.search.suggest.tst.TSTLookup;
@@ -48,7 +47,7 @@ public class LookupBenchmarkTest extends
private final List<Class<? extends Lookup>> benchmarkClasses = Arrays.asList(
JaspellLookup.class,
TSTLookup.class,
- FSTLookup.class);
+ FSTCompletionLookup.class);
private final static int rounds = 15;
private final static int warmup = 5;
Modified: lucene/dev/branches/solrcloud/modules/suggest/src/test/org/apache/lucene/search/suggest/PersistenceTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/modules/suggest/src/test/org/apache/lucene/search/suggest/PersistenceTest.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/modules/suggest/src/test/org/apache/lucene/search/suggest/PersistenceTest.java (original)
+++ lucene/dev/branches/solrcloud/modules/suggest/src/test/org/apache/lucene/search/suggest/PersistenceTest.java Sun Dec 4 01:14:52 2011
@@ -19,7 +19,7 @@ package org.apache.lucene.search.suggest
import java.io.File;
import org.apache.lucene.search.suggest.Lookup;
-import org.apache.lucene.search.suggest.fst.FSTLookup;
+import org.apache.lucene.search.suggest.fst.FSTCompletionLookup;
import org.apache.lucene.search.suggest.jaspell.JaspellLookup;
import org.apache.lucene.search.suggest.tst.TSTLookup;
import org.apache.lucene.util.LuceneTestCase;
@@ -51,9 +51,9 @@ public class PersistenceTest extends Luc
}
public void testFSTPersistence() throws Exception {
- runTest(FSTLookup.class, false);
+ runTest(FSTCompletionLookup.class, false);
}
-
+
private void runTest(Class<? extends Lookup> lookupClass,
boolean supportsExactWeights) throws Exception {
Modified: lucene/dev/branches/solrcloud/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/CHANGES.txt?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/CHANGES.txt (original)
+++ lucene/dev/branches/solrcloud/solr/CHANGES.txt Sun Dec 4 01:14:52 2011
@@ -199,6 +199,11 @@ New Features
Optimizations
----------------------
+* SOLR-2888: FSTSuggester refactoring: internal storage is now UTF-8,
+ external sorting (on disk) prevents OOMs even with large data sets
+ (the bottleneck is now FST construction), code cleanups and API cleanups.
+ (Dawid Weiss, Robert Muir)
+
* SOLR-1875: Per-segment field faceting for single valued string fields.
Enable with facet.method=fcs, control the number of threads used with
the "threads" local param on the facet.field param. This algorithm will
@@ -402,6 +407,13 @@ Bug Fixes
----------------------
* SOLR-2912: Fixed File descriptor leak in ShowFileRequestHandler (Michael Ryan, shalin)
+* SOLR-2819: Improved speed of parsing hex entities in HTMLStripCharFilter
+ (Bernhard Berger, hossman)
+
+Other Changes
+----------------------
+* SOLR-2922: Upgrade commons-io and commons-lang to 2.1 and 2.6, respectively. (koji)
+
================== 3.5.0 ==================
New Features
Modified: lucene/dev/branches/solrcloud/solr/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/build.xml?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/build.xml (original)
+++ lucene/dev/branches/solrcloud/solr/build.xml Sun Dec 4 01:14:52 2011
@@ -183,6 +183,13 @@
<delete dir="dist" />
<delete dir="package" />
<delete dir="example/solr/lib" />
+ <delete includeemptydirs="true">
+ <fileset dir="example" includes="**/data/**/*" excludes="**/.gitignore" />
+ <fileset dir="example/webapps" includes="**/*" excludes="**/.gitignore" />
+ <fileset dir="example/work" includes="**/*" excludes="**/.gitignore" />
+ </delete>
+ <echo message="TODO: fix tests to not write files to 'core/src/test-files/data'!" />
+ <delete dir="core/src/test-files/data" />
</target>
<target name="clean-dest"
@@ -298,6 +305,10 @@
value="${package.dir}/${fullnamever}-src.tgz"/>
<delete file="${source.package.file}" failonerror="false" />
<svn-export-source source.dir=".."/>
+
+ <!-- Exclude javadoc package-list files under licenses incompatible with the ASL -->
+ <delete dir="${svn.export.dir}/lucene/src/tools/javadoc/java6"/>
+
<tar destfile="${source.package.file}" compression="gzip" longfile="gnu">
<tarfileset dir="${svn.export.dir}"
prefix="${fullnamever}"
@@ -423,8 +434,9 @@
<fileset dir="${common-solr.dir}/site" />
</copy>
</target>
-
- <target name="javadocs-all" depends="prep-lucene-jars,javadocs-dep"
+
+ <target name="javadocs-all"
+ depends="prep-lucene-jars,javadocs-dep,lucene-javadocs-all,define-lucene-javadoc-url"
description="Generate javadoc for core, java client and contrib">
<sequential>
<mkdir dir="${dest}/docs/api"/>
@@ -449,6 +461,8 @@
<invoke-javadoc destdir="${dest}/docs/api"
overview="core/src/java/overview.html">
<sources>
+ <link offline="true" href="${lucene.javadoc.url}"
+ packagelistloc="${common.dir}/build/docs/api/all/"/>
<packageset dir="core/src/java" />
<packageset dir="solrj/src/java" />
<packageset dir="contrib/analysis-extras/src/java"/>
Modified: lucene/dev/branches/solrcloud/solr/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/common-build.xml?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/common-build.xml (original)
+++ lucene/dev/branches/solrcloud/solr/common-build.xml Sun Dec 4 01:14:52 2011
@@ -25,6 +25,9 @@
<property name="Name" value="Solr" />
<property name="version" value="4.0-SNAPSHOT"/>
+ <condition property="version.contains.SNAPSHOT">
+ <contains casesensitive="true" string="${version}" substring="-SNAPSHOT"/>
+ </condition>
<property name="fullname" value="apache-${ant.project.name}"/>
<property name="fullnamever" value="${fullname}-${version}"/>
<property name="final.name" value="${fullnamever}"/>
@@ -212,13 +215,19 @@
<copy file="${build.dir}/${fullnamever}.jar" todir="${dist}"/>
</target>
- <target name="javadocs" depends="compile-core">
+ <target name="lucene-javadocs-all">
+ <ant dir="${common.dir}" target="javadocs-all" inheritall="false"/>
+ </target>
+
+ <target name="javadocs" depends="compile-core,lucene-javadocs-all,define-lucene-javadoc-url">
<sequential>
<mkdir dir="${javadoc.dir}"/>
<mkdir dir="${dest}/META-INF/"/>
<invoke-javadoc destdir="${javadoc.dir}"
title="${Name} ${version} ${name} API">
<sources>
+ <link offline="true" href="${lucene.javadoc.url}"
+ packagelistloc="${common.dir}/build/docs/api/all/"/>
<link href=""/>
<packageset dir="${src.dir}"/>
</sources>
@@ -232,6 +241,26 @@
</sequential>
</target>
+ <target name="define-lucene-javadoc-url"
+ depends="define-lucene-javadoc-url-SNAPSHOT,define-lucene-javadoc-url-release"/>
+
+ <target name="define-lucene-javadoc-url-SNAPSHOT" if="version.contains.SNAPSHOT">
+ <property name="lucene.javadoc.url"
+ value="https://builds.apache.org/job/Lucene-3.x/javadoc/all/"/>
+ </target>
+
+ <target name="define-lucene-javadoc-url-release" unless="version.contains.SNAPSHOT">
+ <loadproperties>
+ <propertyresource name="version"/>
+ <filterchain>
+ <replaceregex pattern="[.]" replace="_" flags="g"/>
+ <prefixlines prefix="underscore.version="/>
+ </filterchain>
+ </loadproperties>
+ <property name="lucene.javadoc.url"
+ value="http://lucene.apache.org/java/${underscore.version}/api/all/"/>
+ </target>
+
<target name="jar-src" depends="init">
<jarify basedir="${src.dir}"
destfile="${build.dir}/${final.name}-src.jar"
Modified: lucene/dev/branches/solrcloud/solr/core/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/build.xml?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/build.xml (original)
+++ lucene/dev/branches/solrcloud/solr/core/build.xml Sun Dec 4 01:14:52 2011
@@ -27,6 +27,6 @@
jar.file="${common-solr.dir}/lib/commons-csv-1.0-SNAPSHOT-r966014.jar" />
<m2-deploy-with-pom-template pom.xml="${common-solr.dir}/lib/apache-solr-noggit-pom.xml.template"
- jar.file="${common-solr.dir}/lib/apache-solr-noggit-r1099557.jar" />
+ jar.file="${common-solr.dir}/lib/apache-solr-noggit-r1209632.jar" />
</target>
</project>
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/handler/component/TermsComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/handler/component/TermsComponent.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/handler/component/TermsComponent.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/handler/component/TermsComponent.java Sun Dec 4 01:14:52 2011
@@ -19,6 +19,7 @@ package org.apache.solr.handler.componen
import org.apache.lucene.index.*;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.CharsRef;
+import org.apache.lucene.util.StringHelper;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.*;
import org.apache.solr.common.util.NamedList;
@@ -183,7 +184,7 @@ public class TermsComponent extends Sear
boolean externalized = false; // did we fill in "external" yet for this term?
// stop if the prefix doesn't match
- if (prefixBytes != null && !term.startsWith(prefixBytes)) break;
+ if (prefixBytes != null && !StringHelper.startsWith(term, prefixBytes)) break;
if (pattern != null) {
// indexed text or external text?
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/request/SimpleFacets.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/request/SimpleFacets.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/request/SimpleFacets.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/request/SimpleFacets.java Sun Dec 4 01:14:52 2011
@@ -656,7 +656,7 @@ public class SimpleFacets {
if (docs.size() >= mincount) {
while (term != null) {
- if (startTermBytes != null && !term.startsWith(startTermBytes))
+ if (startTermBytes != null && !StringHelper.startsWith(term, startTermBytes))
break;
int df = termsEnum.docFreq();
@@ -696,31 +696,16 @@ public class SimpleFacets {
for (int subindex = 0; subindex<numSubs; subindex++) {
MultiDocsEnum.EnumWithSlice sub = subs[subindex];
if (sub.docsEnum == null) continue;
- DocsEnum.BulkReadResult bulk = sub.docsEnum.getBulkResult();
int base = sub.slice.start;
- for (;;) {
- int nDocs = sub.docsEnum.read();
- if (nDocs == 0) break;
- int[] docArr = bulk.docs.ints; // this might be movable outside the loop, but perhaps not worth the risk.
- int end = bulk.docs.offset + nDocs;
- for (int i=bulk.docs.offset; i<end; i++) {
- if (fastForRandomSet.exists(docArr[i]+base)) c++;
- }
+ int docid;
+ while ((docid = sub.docsEnum.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
+ if (fastForRandomSet.exists(docid+base)) c++;
}
}
} else {
-
- // this should be the same bulk result object if sharing of the docsEnum succeeded
- DocsEnum.BulkReadResult bulk = docsEnum.getBulkResult();
-
- for (;;) {
- int nDocs = docsEnum.read();
- if (nDocs == 0) break;
- int[] docArr = bulk.docs.ints; // this might be movable outside the loop, but perhaps not worth the risk.
- int end = bulk.docs.offset + nDocs;
- for (int i=bulk.docs.offset; i<end; i++) {
- if (fastForRandomSet.exists(docArr[i])) c++;
- }
+ int docid;
+ while ((docid = docsEnum.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
+ if (fastForRandomSet.exists(docid)) c++;
}
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/JoinQParserPlugin.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/JoinQParserPlugin.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/JoinQParserPlugin.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/JoinQParserPlugin.java Sun Dec 4 01:14:52 2011
@@ -23,6 +23,7 @@ import org.apache.lucene.search.similari
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.OpenBitSet;
+import org.apache.lucene.util.StringHelper;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.NamedList;
@@ -301,7 +302,7 @@ class JoinQuery extends Query {
toDeState.minSetSizeCached = minDocFreqTo;
while (term != null) {
- if (prefix != null && !term.startsWith(prefix))
+ if (prefix != null && !StringHelper.startsWith(term, prefix))
break;
fromTermCount++;
@@ -322,35 +323,21 @@ class JoinQuery extends Query {
outer: for (int subindex = 0; subindex<numSubs; subindex++) {
MultiDocsEnum.EnumWithSlice sub = subs[subindex];
if (sub.docsEnum == null) continue;
- DocsEnum.BulkReadResult bulk = sub.docsEnum.getBulkResult();
int base = sub.slice.start;
- for (;;) {
- int nDocs = sub.docsEnum.read();
- if (nDocs == 0) break;
- int[] docArr = bulk.docs.ints; // this might be movable outside the loop, but perhaps not worth the risk.
- int end = bulk.docs.offset + nDocs;
- for (int i=bulk.docs.offset; i<end; i++) {
- if (fastForRandomSet.exists(docArr[i]+base)) {
- intersects = true;
- break outer;
- }
+ int docid;
+ while ((docid = sub.docsEnum.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
+ if (fastForRandomSet.exists(docid+base)) {
+ intersects = true;
+ break outer;
}
}
}
} else {
- // this should be the same bulk result object if sharing of the docsEnum succeeded
- DocsEnum.BulkReadResult bulk = docsEnum.getBulkResult();
-
- outer: for (;;) {
- int nDocs = docsEnum.read();
- if (nDocs == 0) break;
- int[] docArr = bulk.docs.ints; // this might be movable outside the loop, but perhaps not worth the risk.
- int end = bulk.docs.offset + nDocs;
- for (int i=bulk.docs.offset; i<end; i++) {
- if (fastForRandomSet.exists(docArr[i])) {
- intersects = true;
- break outer;
- }
+ int docid;
+ while ((docid = docsEnum.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
+ if (fastForRandomSet.exists(docid)) {
+ intersects = true;
+ break;
}
}
}
@@ -401,32 +388,18 @@ class JoinQuery extends Query {
for (int subindex = 0; subindex<numSubs; subindex++) {
MultiDocsEnum.EnumWithSlice sub = subs[subindex];
if (sub.docsEnum == null) continue;
- DocsEnum.BulkReadResult bulk = sub.docsEnum.getBulkResult();
int base = sub.slice.start;
- for (;;) {
- int nDocs = sub.docsEnum.read();
- if (nDocs == 0) break;
- resultListDocs += nDocs;
- int[] docArr = bulk.docs.ints; // this might be movable outside the loop, but perhaps not worth the risk.
- int end = bulk.docs.offset + nDocs;
- for (int i=bulk.docs.offset; i<end; i++) {
- resultBits.fastSet(docArr[i]+base);
- }
+ int docid;
+ while ((docid = sub.docsEnum.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
+ resultListDocs++;
+ resultBits.fastSet(docid + base);
}
}
} else {
- // this should be the same bulk result object if sharing of the docsEnum succeeded
- DocsEnum.BulkReadResult bulk = docsEnum.getBulkResult();
-
- for (;;) {
- int nDocs = docsEnum.read();
- if (nDocs == 0) break;
- resultListDocs += nDocs;
- int[] docArr = bulk.docs.ints; // this might be movable outside the loop, but perhaps not worth the risk.
- int end = bulk.docs.offset + nDocs;
- for (int i=bulk.docs.offset; i<end; i++) {
- resultBits.fastSet(docArr[i]);
- }
+ int docid;
+ while ((docid = docsEnum.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
+ resultListDocs++;
+ resultBits.fastSet(docid);
}
}
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java Sun Dec 4 01:14:52 2011
@@ -903,47 +903,34 @@ public class SolrIndexSearcher extends I
for (int subindex = 0; subindex<numSubs; subindex++) {
MultiDocsEnum.EnumWithSlice sub = subs[subindex];
if (sub.docsEnum == null) continue;
- DocsEnum.BulkReadResult bulk = sub.docsEnum.getBulkResult();
int base = sub.slice.start;
-
- for (;;) {
- int nDocs = sub.docsEnum.read();
- if (nDocs == 0) break;
- int[] docArr = bulk.docs.ints;
- int end = bulk.docs.offset + nDocs;
- if (upto + nDocs > docs.length) {
- if (obs == null) obs = new OpenBitSet(maxDoc());
- for (int i=bulk.docs.offset; i<end; i++) {
- obs.fastSet(docArr[i]+base);
- }
- bitsSet += nDocs;
- } else {
- for (int i=bulk.docs.offset; i<end; i++) {
- docs[upto++] = docArr[i]+base;
- }
- }
- }
- }
- } else {
- DocsEnum.BulkReadResult bulk = docsEnum.getBulkResult();
- for (;;) {
- int nDocs = docsEnum.read();
- if (nDocs == 0) break;
- int[] docArr = bulk.docs.ints;
- int end = bulk.docs.offset + nDocs;
-
- if (upto + nDocs > docs.length) {
+ int docid;
+
+ if (largestPossible > docs.length) {
if (obs == null) obs = new OpenBitSet(maxDoc());
- for (int i=bulk.docs.offset; i<end; i++) {
- obs.fastSet(docArr[i]);
+ while ((docid = sub.docsEnum.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
+ obs.fastSet(docid + base);
+ bitsSet++;
}
- bitsSet += nDocs;
} else {
- for (int i=bulk.docs.offset; i<end; i++) {
- docs[upto++] = docArr[i];
+ while ((docid = sub.docsEnum.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
+ docs[upto++] = docid + base;
}
}
}
+ } else {
+ int docid;
+ if (largestPossible > docs.length) {
+ if (obs == null) obs = new OpenBitSet(maxDoc());
+ while ((docid = docsEnum.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
+ obs.fastSet(docid);
+ bitsSet++;
+ }
+ } else {
+ while ((docid = docsEnum.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
+ docs[upto++] = docid;
+ }
+ }
}
DocSet result;
@@ -991,15 +978,9 @@ public class SolrIndexSearcher extends I
}
if (docsEnum != null) {
- DocsEnum.BulkReadResult readResult = docsEnum.getBulkResult();
- for (;;) {
- int n = docsEnum.read();
- if (n==0) break;
- int[] arr = readResult.docs.ints;
- int end = readResult.docs.offset + n;
- for (int j=readResult.docs.offset; j<end; j++) {
- collector.collect(arr[j]);
- }
+ int docid;
+ while ((docid = docsEnum.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
+ collector.collect(docid);
}
}
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/function/distance/HaversineFunction.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/function/distance/HaversineFunction.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/function/distance/HaversineFunction.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/function/distance/HaversineFunction.java Sun Dec 4 01:14:52 2011
@@ -76,22 +76,22 @@ public class HaversineFunction extends V
double[] p2D = new double[2];
p1DV.doubleVal(doc, p1D);
p2DV.doubleVal(doc, p2D);
- double x1;
double y1;
- double x2;
+ double x1;
double y2;
+ double x2;
if (convertToRadians) {
- x1 = p1D[0] * DistanceUtils.DEGREES_TO_RADIANS;
- y1 = p1D[1] * DistanceUtils.DEGREES_TO_RADIANS;
- x2 = p2D[0] * DistanceUtils.DEGREES_TO_RADIANS;
- y2 = p2D[1] * DistanceUtils.DEGREES_TO_RADIANS;
+ y1 = p1D[0] * DistanceUtils.DEGREES_TO_RADIANS;
+ x1 = p1D[1] * DistanceUtils.DEGREES_TO_RADIANS;
+ y2 = p2D[0] * DistanceUtils.DEGREES_TO_RADIANS;
+ x2 = p2D[1] * DistanceUtils.DEGREES_TO_RADIANS;
} else {
- x1 = p1D[0];
- y1 = p1D[1];
- x2 = p2D[0];
- y2 = p2D[1];
+ y1 = p1D[0];
+ x1 = p1D[1];
+ y2 = p2D[0];
+ x2 = p2D[1];
}
- return DistanceUtils.haversine(x1, y1, x2, y2, radius);
+ return DistanceUtils.haversine(y1, x1, y2, x2, radius);
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/spelling/suggest/fst/FSTLookupFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/spelling/suggest/fst/FSTLookupFactory.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/spelling/suggest/fst/FSTLookupFactory.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/spelling/suggest/fst/FSTLookupFactory.java Sun Dec 4 01:14:52 2011
@@ -18,16 +18,15 @@ package org.apache.solr.spelling.suggest
*/
import org.apache.lucene.search.suggest.Lookup;
-import org.apache.lucene.search.suggest.fst.FSTLookup;
+import org.apache.lucene.search.suggest.fst.*;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.core.SolrCore;
import org.apache.solr.spelling.suggest.LookupFactory;
/**
- * Factory for {@link FSTLookup}
+ * Factory for {@link FSTCompletionLookup}
*/
public class FSTLookupFactory extends LookupFactory {
-
/**
* The number of separate buckets for weights (discretization). The more buckets,
* the more fine-grained term weights (priorities) can be assigned. The speed of lookup
@@ -55,6 +54,6 @@ public class FSTLookupFactory extends Lo
? Boolean.valueOf(params.get(EXACT_MATCH_FIRST).toString())
: true;
- return new FSTLookup(buckets, exactMatchFirst);
+ return new FSTCompletionLookup(buckets, exactMatchFirst);
}
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/SolrIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/SolrIndexWriter.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/SolrIndexWriter.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/SolrIndexWriter.java Sun Dec 4 01:14:52 2011
@@ -74,9 +74,9 @@ public class SolrIndexWriter extends Ind
File parent = f.getParentFile();
if (parent != null) parent.mkdirs();
FileOutputStream fos = new FileOutputStream(f, true);
- return new PrintStreamInfoStream(new TimeLoggingPrintStream(fos, true));
+ return new PrintStreamInfoStream(new PrintStream(fos, true));
} else {
- return null;
+ return InfoStream.NO_OUTPUT;
}
}
@@ -155,23 +155,4 @@ public class SolrIndexWriter extends Ind
}
}
-
- // Helper class for adding timestamps to infoStream logging
- static class TimeLoggingPrintStream extends PrintStream {
- private DateFormat dateFormat;
- public TimeLoggingPrintStream(OutputStream underlyingOutputStream,
- boolean autoFlush) {
- super(underlyingOutputStream, autoFlush);
- this.dateFormat = DateFormat.getDateTimeInstance();
- }
-
- // We might ideally want to override print(String) as well, but
- // looking through the code that writes to infoStream, it appears
- // that all the classes except CheckIndex just use println.
- @Override
- public void println(String x) {
- print(dateFormat.format(new Date()) + " ");
- super.println(x);
- }
- }
}
Modified: lucene/dev/branches/solrcloud/solr/lib/apache-solr-noggit-pom.xml.template
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/lib/apache-solr-noggit-pom.xml.template?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/lib/apache-solr-noggit-pom.xml.template (original)
+++ lucene/dev/branches/solrcloud/solr/lib/apache-solr-noggit-pom.xml.template Sun Dec 4 01:14:52 2011
@@ -31,6 +31,6 @@
<artifactId>solr-noggit</artifactId>
<name>Solr Specific Noggit</name>
<version>@version@</version>
- <description>Solr Specific Noggit r1099557</description>
+ <description>Solr Specific Noggit r1209632</description>
<packaging>jar</packaging>
</project>
Modified: lucene/dev/branches/solrcloud/solr/test-framework/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/test-framework/build.xml?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/test-framework/build.xml (original)
+++ lucene/dev/branches/solrcloud/solr/test-framework/build.xml Sun Dec 4 01:14:52 2011
@@ -39,11 +39,37 @@
</compile>
</target>
- <target name="javadocs" depends="common-solr.javadocs">
- <mkdir dir="${dest}/docs/api/test-framework"/>
- <copy todir="${dest}/docs/api/test-framework">
- <fileset dir="${javadoc.dir}"/>
- </copy>
+ <!-- Override common-solr.javadocs to include a JUnit javadoc link -->
+ <!-- and to copy the built javadocs to ${dest}/docs/api/test-framework -->
+ <target name="javadocs"
+ depends="compile-core,lucene-javadocs-all,define-lucene-javadoc-url">
+ <sequential>
+ <mkdir dir="${javadoc.dir}"/>
+ <mkdir dir="${dest}/META-INF/"/>
+ <invoke-javadoc destdir="${javadoc.dir}"
+ title="${Name} ${version} ${name} API">
+ <sources>
+ <link offline="true" href="${lucene.javadoc.url}"
+ packagelistloc="${common.dir}/build/docs/api/all/"/>
+ <link offline="true" href="${lucene-javadoc-url}"
+ packagelistloc="${common.dir}/build/docs/api/all/"/>
+ <link offline="true" href="${javadoc.link.junit}"
+ packagelistLoc="${javadoc.packagelist.dir}/junit"/>
+ <link href=""/>
+ <packageset dir="${src.dir}"/>
+ </sources>
+ </invoke-javadoc>
+ <jarify basedir="${javadoc.dir}"
+ destfile="${build.dir}/${final.name}-javadoc.jar"
+ title="Apache Solr Search Server: ${ant.project.name}"
+ metainf.source.dir="${common-solr.dir}"
+ implementation.title="org.apache.solr"
+ spec.version="${solr.spec.version}"/>
+ <mkdir dir="${dest}/docs/api/test-framework"/>
+ <copy todir="${dest}/docs/api/test-framework">
+ <fileset dir="${javadoc.dir}"/>
+ </copy>
+ </sequential>
</target>
</project>
Modified: lucene/dev/branches/solrcloud/solr/test-framework/src/java/org/apache/solr/core/MockDirectoryFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/test-framework/src/java/org/apache/solr/core/MockDirectoryFactory.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/test-framework/src/java/org/apache/solr/core/MockDirectoryFactory.java (original)
+++ lucene/dev/branches/solrcloud/solr/test-framework/src/java/org/apache/solr/core/MockDirectoryFactory.java Sun Dec 4 01:14:52 2011
@@ -21,6 +21,7 @@ import java.io.File;
import java.io.IOException;
import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.MockDirectoryWrapper;
import org.apache.lucene.util.LuceneTestCase;
/**
@@ -30,6 +31,12 @@ public class MockDirectoryFactory extend
@Override
public Directory create(String path) throws IOException {
- return LuceneTestCase.newFSDirectory(new File(path));
+ MockDirectoryWrapper dir = LuceneTestCase.newFSDirectory(new File(path));
+ // Somehow removing unref'd files in Solr tests causes
+ // problems... there's some interaction w/
+ // CachingDirectoryFactory. Once we track down where Solr
+ // isn't closing an IW, we can re-enable this:
+ dir.setAssertNoUnrefencedFilesOnClose(false);
+ return dir;
}
}