You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2014/11/01 10:32:12 UTC
svn commit: r1635908 [5/7] - in /lucene/dev/branches/lucene6005: ./
dev-tools/ dev-tools/idea/.idea/libraries/ dev-tools/scripts/ lucene/
lucene/backward-codecs/
lucene/backward-codecs/src/test/org/apache/lucene/index/ lucene/codecs/
lucene/codecs/src/...
Modified: lucene/dev/branches/lucene6005/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java (original)
+++ lucene/dev/branches/lucene6005/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java Sat Nov 1 09:32:06 2014
@@ -64,6 +64,7 @@ import org.apache.lucene.search.TermQuer
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.search.TopScoreDocCollector;
import org.apache.lucene.store.Directory;
+import org.apache.lucene.util.BitSet;
import org.apache.lucene.util.BitSetIterator;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
@@ -452,7 +453,7 @@ public class TestJoinUtil extends Lucene
int r = random().nextInt(context.randomUniqueValues.length);
boolean from = context.randomFrom[r];
String randomValue = context.randomUniqueValues[r];
- FixedBitSet expectedResult = createExpectedResult(randomValue, from, indexSearcher.getIndexReader(), context);
+ BitSet expectedResult = createExpectedResult(randomValue, from, indexSearcher.getIndexReader(), context);
final Query actualQuery = new TermQuery(new Term("value", randomValue));
if (VERBOSE) {
@@ -474,7 +475,7 @@ public class TestJoinUtil extends Lucene
}
// Need to know all documents that have matches. TopDocs doesn't give me that and then I'd be also testing TopDocsCollector...
- final FixedBitSet actualResult = new FixedBitSet(indexSearcher.getIndexReader().maxDoc());
+ final BitSet actualResult = new FixedBitSet(indexSearcher.getIndexReader().maxDoc());
final TopScoreDocCollector topScoreDocCollector = TopScoreDocCollector.create(10, false);
indexSearcher.search(joinQuery, new SimpleCollector() {
@@ -859,7 +860,7 @@ public class TestJoinUtil extends Lucene
return new TopDocs(hits.size(), scoreDocs, hits.isEmpty() ? Float.NaN : hits.get(0).getValue().score(scoreMode));
}
- private FixedBitSet createExpectedResult(String queryValue, boolean from, IndexReader topLevelReader, IndexIterationContext context) throws IOException {
+ private BitSet createExpectedResult(String queryValue, boolean from, IndexReader topLevelReader, IndexIterationContext context) throws IOException {
final Map<String, List<RandomDoc>> randomValueDocs;
final Map<String, List<RandomDoc>> linkValueDocuments;
if (from) {
@@ -870,7 +871,7 @@ public class TestJoinUtil extends Lucene
linkValueDocuments = context.fromDocuments;
}
- FixedBitSet expectedResult = new FixedBitSet(topLevelReader.maxDoc());
+ BitSet expectedResult = new FixedBitSet(topLevelReader.maxDoc());
List<RandomDoc> matchingDocs = randomValueDocs.get(queryValue);
if (matchingDocs == null) {
return new FixedBitSet(topLevelReader.maxDoc());
Modified: lucene/dev/branches/lucene6005/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java (original)
+++ lucene/dev/branches/lucene6005/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java Sat Nov 1 09:32:06 2014
@@ -17,21 +17,31 @@ package org.apache.lucene.index.memory;
* limitations under the License.
*/
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import org.apache.lucene.analysis.tokenattributes.TermToBytesRefAttribute;
-import org.apache.lucene.index.LeafReader;
import org.apache.lucene.index.BinaryDocValues;
+import org.apache.lucene.index.DocValuesType;
import org.apache.lucene.index.DocsAndPositionsEnum;
import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.FieldInfo;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.FieldInvertState;
import org.apache.lucene.index.Fields;
+import org.apache.lucene.index.IndexOptions;
+import org.apache.lucene.index.LeafReader;
import org.apache.lucene.index.NumericDocValues;
import org.apache.lucene.index.OrdTermState;
import org.apache.lucene.index.SortedDocValues;
@@ -51,25 +61,16 @@ import org.apache.lucene.util.ArrayUtil;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.ByteBlockPool;
import org.apache.lucene.util.BytesRef;
-import org.apache.lucene.util.BytesRefHash;
import org.apache.lucene.util.BytesRefHash.DirectBytesStartArray;
+import org.apache.lucene.util.BytesRefHash;
import org.apache.lucene.util.Counter;
-import org.apache.lucene.util.IntBlockPool;
import org.apache.lucene.util.IntBlockPool.SliceReader;
import org.apache.lucene.util.IntBlockPool.SliceWriter;
+import org.apache.lucene.util.IntBlockPool;
import org.apache.lucene.util.RamUsageEstimator;
import org.apache.lucene.util.RecyclingByteBlockAllocator;
import org.apache.lucene.util.RecyclingIntBlockAllocator;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.NoSuchElementException;
-
/**
* High-performance single-document main memory Apache Lucene fulltext search index.
@@ -447,7 +448,9 @@ public class MemoryIndex {
if (!fieldInfos.containsKey(fieldName)) {
fieldInfos.put(fieldName,
- new FieldInfo(fieldName, fieldInfos.size(), false, false, false, this.storeOffsets ? IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS : IndexOptions.DOCS_AND_FREQS_AND_POSITIONS, null, -1, null));
+ new FieldInfo(fieldName, fieldInfos.size(), false, false, false,
+ this.storeOffsets ? IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS : IndexOptions.DOCS_AND_FREQS_AND_POSITIONS,
+ DocValuesType.NONE, -1, null));
}
TermToBytesRefAttribute termAtt = stream.getAttribute(TermToBytesRefAttribute.class);
PositionIncrementAttribute posIncrAttribute = stream.addAttribute(PositionIncrementAttribute.class);
Modified: lucene/dev/branches/lucene6005/lucene/memory/src/test/org/apache/lucene/index/memory/TestMemoryIndexAgainstRAMDir.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/memory/src/test/org/apache/lucene/index/memory/TestMemoryIndexAgainstRAMDir.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/memory/src/test/org/apache/lucene/index/memory/TestMemoryIndexAgainstRAMDir.java (original)
+++ lucene/dev/branches/lucene6005/lucene/memory/src/test/org/apache/lucene/index/memory/TestMemoryIndexAgainstRAMDir.java Sat Nov 1 09:32:06 2014
@@ -40,16 +40,17 @@ import org.apache.lucene.document.Docume
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.LeafReader;
import org.apache.lucene.index.CompositeReader;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.DocsAndPositionsEnum;
import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.Fields;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.IndexableField;
+import org.apache.lucene.index.LeafReader;
import org.apache.lucene.index.NumericDocValues;
import org.apache.lucene.index.SlowCompositeReaderWrapper;
import org.apache.lucene.index.Term;
@@ -432,7 +433,7 @@ public class TestMemoryIndexAgainstRAMDi
Document nextDoc = lineFileDocs.nextDoc();
Document doc = new Document();
for (IndexableField field : nextDoc.getFields()) {
- if (field.fieldType().indexOptions() != null) {
+ if (field.fieldType().indexOptions() != IndexOptions.NONE) {
doc.add(field);
if (random().nextInt(3) == 0) {
doc.add(field); // randomly add the same field twice
Modified: lucene/dev/branches/lucene6005/lucene/misc/src/java/org/apache/lucene/index/sorter/SortingLeafReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/misc/src/java/org/apache/lucene/index/sorter/SortingLeafReader.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/misc/src/java/org/apache/lucene/index/sorter/SortingLeafReader.java (original)
+++ lucene/dev/branches/lucene6005/lucene/misc/src/java/org/apache/lucene/index/sorter/SortingLeafReader.java Sat Nov 1 09:32:06 2014
@@ -25,7 +25,7 @@ import org.apache.lucene.index.LeafReade
import org.apache.lucene.index.BinaryDocValues;
import org.apache.lucene.index.DocsAndPositionsEnum;
import org.apache.lucene.index.DocsEnum;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.Fields;
import org.apache.lucene.index.NumericDocValues;
Modified: lucene/dev/branches/lucene6005/lucene/misc/src/java/org/apache/lucene/uninverting/UninvertingReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/misc/src/java/org/apache/lucene/uninverting/UninvertingReader.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/misc/src/java/org/apache/lucene/uninverting/UninvertingReader.java (original)
+++ lucene/dev/branches/lucene6005/lucene/misc/src/java/org/apache/lucene/uninverting/UninvertingReader.java Sat Nov 1 09:32:06 2014
@@ -32,6 +32,7 @@ import org.apache.lucene.document.Sorted
import org.apache.lucene.document.StringField; // javadocs
import org.apache.lucene.index.BinaryDocValues;
import org.apache.lucene.index.DirectoryReader;
+import org.apache.lucene.index.DocValuesType;
import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.FilterDirectoryReader;
@@ -183,7 +184,7 @@ public class UninvertingReader extends F
this.mapping = mapping;
ArrayList<FieldInfo> filteredInfos = new ArrayList<>();
for (FieldInfo fi : in.getFieldInfos()) {
- FieldInfo.DocValuesType type = fi.getDocValuesType();
+ DocValuesType type = fi.getDocValuesType();
if (fi.isIndexed() && !fi.hasDocValues()) {
Type t = mapping.get(fi.name);
if (t != null) {
@@ -192,20 +193,20 @@ public class UninvertingReader extends F
case LONG:
case FLOAT:
case DOUBLE:
- type = FieldInfo.DocValuesType.NUMERIC;
+ type = DocValuesType.NUMERIC;
break;
case BINARY:
- type = FieldInfo.DocValuesType.BINARY;
+ type = DocValuesType.BINARY;
break;
case SORTED:
- type = FieldInfo.DocValuesType.SORTED;
+ type = DocValuesType.SORTED;
break;
case SORTED_SET_BINARY:
case SORTED_SET_INTEGER:
case SORTED_SET_FLOAT:
case SORTED_SET_LONG:
case SORTED_SET_DOUBLE:
- type = FieldInfo.DocValuesType.SORTED_SET;
+ type = DocValuesType.SORTED_SET;
break;
default:
throw new AssertionError();
Modified: lucene/dev/branches/lucene6005/lucene/misc/src/test/org/apache/lucene/index/sorter/SorterTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/misc/src/test/org/apache/lucene/index/sorter/SorterTestBase.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/misc/src/test/org/apache/lucene/index/sorter/SorterTestBase.java (original)
+++ lucene/dev/branches/lucene6005/lucene/misc/src/test/org/apache/lucene/index/sorter/SorterTestBase.java Sat Nov 1 09:32:06 2014
@@ -31,8 +31,8 @@ import org.apache.lucene.analysis.tokena
import org.apache.lucene.analysis.tokenattributes.PayloadAttribute;
import org.apache.lucene.document.BinaryDocValuesField;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
import org.apache.lucene.document.Field.Store;
+import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.NumericDocValuesField;
import org.apache.lucene.document.SortedDocValuesField;
@@ -40,15 +40,15 @@ import org.apache.lucene.document.Sorted
import org.apache.lucene.document.SortedSetDocValuesField;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.LeafReader;
-import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.BinaryDocValues;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.DocsAndPositionsEnum;
import org.apache.lucene.index.DocsEnum;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.index.FieldInvertState;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.LeafReader;
+import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.NumericDocValues;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.SlowCompositeReaderWrapper;
@@ -57,8 +57,8 @@ import org.apache.lucene.index.SortedNum
import org.apache.lucene.index.SortedSetDocValues;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.Terms;
-import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.index.TermsEnum.SeekStatus;
+import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.index.sorter.SortingLeafReader.SortingDocsAndPositionsEnum;
import org.apache.lucene.index.sorter.SortingLeafReader.SortingDocsEnum;
import org.apache.lucene.search.CollectionStatistics;
Modified: lucene/dev/branches/lucene6005/lucene/queries/src/java/org/apache/lucene/queries/BooleanFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/queries/src/java/org/apache/lucene/queries/BooleanFilter.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/queries/src/java/org/apache/lucene/queries/BooleanFilter.java (original)
+++ lucene/dev/branches/lucene6005/lucene/queries/src/java/org/apache/lucene/queries/BooleanFilter.java Sat Nov 1 09:32:06 2014
@@ -19,8 +19,8 @@ package org.apache.lucene.queries;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.List;
import java.util.Iterator;
+import java.util.List;
import org.apache.lucene.index.LeafReader;
import org.apache.lucene.index.LeafReaderContext;
@@ -29,8 +29,8 @@ import org.apache.lucene.search.BooleanC
import org.apache.lucene.search.DocIdSet;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.Filter;
+import org.apache.lucene.util.BitDocIdSet;
import org.apache.lucene.util.Bits;
-import org.apache.lucene.util.DocIdSetBuilder;
/**
* A container Filter that allows Boolean composition of Filters.
@@ -51,7 +51,7 @@ public class BooleanFilter extends Filte
*/
@Override
public DocIdSet getDocIdSet(LeafReaderContext context, Bits acceptDocs) throws IOException {
- DocIdSetBuilder res = null;
+ BitDocIdSet.Builder res = null;
final LeafReader reader = context.reader();
boolean hasShouldClauses = false;
@@ -61,7 +61,7 @@ public class BooleanFilter extends Filte
final DocIdSetIterator disi = getDISI(fc.getFilter(), context);
if (disi == null) continue;
if (res == null) {
- res = new DocIdSetBuilder(reader.maxDoc());
+ res = new BitDocIdSet.Builder(reader.maxDoc());
}
res.or(disi);
}
@@ -73,7 +73,7 @@ public class BooleanFilter extends Filte
if (fc.getOccur() == Occur.MUST_NOT) {
if (res == null) {
assert !hasShouldClauses;
- res = new DocIdSetBuilder(reader.maxDoc(), true); // NOTE: may set bits on deleted docs
+ res = new BitDocIdSet.Builder(reader.maxDoc(), true); // NOTE: may set bits on deleted docs
}
final DocIdSetIterator disi = getDISI(fc.getFilter(), context);
if (disi != null) {
@@ -89,7 +89,7 @@ public class BooleanFilter extends Filte
return null; // no documents can match
}
if (res == null) {
- res = new DocIdSetBuilder(reader.maxDoc());
+ res = new BitDocIdSet.Builder(reader.maxDoc());
res.or(disi);
} else {
res.and(disi);
Modified: lucene/dev/branches/lucene6005/lucene/queries/src/java/org/apache/lucene/queries/TermsFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/queries/src/java/org/apache/lucene/queries/TermsFilter.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/queries/src/java/org/apache/lucene/queries/TermsFilter.java (original)
+++ lucene/dev/branches/lucene6005/lucene/queries/src/java/org/apache/lucene/queries/TermsFilter.java Sat Nov 1 09:32:06 2014
@@ -34,9 +34,9 @@ import org.apache.lucene.index.TermsEnum
import org.apache.lucene.search.DocIdSet;
import org.apache.lucene.search.Filter;
import org.apache.lucene.util.ArrayUtil;
+import org.apache.lucene.util.BitDocIdSet;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
-import org.apache.lucene.util.DocIdSetBuilder;
/**
* Constructs a filter for docs matching any of the terms added to this class.
@@ -183,7 +183,7 @@ public final class TermsFilter extends F
@Override
public DocIdSet getDocIdSet(LeafReaderContext context, Bits acceptDocs) throws IOException {
final LeafReader reader = context.reader();
- DocIdSetBuilder builder = new DocIdSetBuilder(reader.maxDoc());
+ BitDocIdSet.Builder builder = new BitDocIdSet.Builder(reader.maxDoc());
final Fields fields = reader.fields();
final BytesRef spare = new BytesRef(this.termsBytes);
if (fields == null) {
Modified: lucene/dev/branches/lucene6005/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/BytesRefFieldSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/BytesRefFieldSource.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/BytesRefFieldSource.java (original)
+++ lucene/dev/branches/lucene6005/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/BytesRefFieldSource.java Sat Nov 1 09:32:06 2014
@@ -23,7 +23,7 @@ import java.util.Map;
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.BinaryDocValues;
import org.apache.lucene.index.DocValues;
-import org.apache.lucene.index.FieldInfo.DocValuesType;
+import org.apache.lucene.index.DocValuesType;
import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.queries.function.FunctionValues;
import org.apache.lucene.queries.function.docvalues.DocTermsIndexDocValues;
Modified: lucene/dev/branches/lucene6005/lucene/queries/src/java/org/apache/lucene/queries/mlt/MoreLikeThis.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/queries/src/java/org/apache/lucene/queries/mlt/MoreLikeThis.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/queries/src/java/org/apache/lucene/queries/mlt/MoreLikeThis.java (original)
+++ lucene/dev/branches/lucene6005/lucene/queries/src/java/org/apache/lucene/queries/mlt/MoreLikeThis.java Sat Nov 1 09:32:06 2014
@@ -42,10 +42,8 @@ import org.apache.lucene.search.TermQuer
import org.apache.lucene.search.similarities.DefaultSimilarity;
import org.apache.lucene.search.similarities.TFIDFSimilarity;
import org.apache.lucene.util.BytesRef;
-import org.apache.lucene.util.CharsRef;
import org.apache.lucene.util.CharsRefBuilder;
import org.apache.lucene.util.PriorityQueue;
-import org.apache.lucene.util.UnicodeUtil;
/**
@@ -589,6 +587,20 @@ public final class MoreLikeThis {
}
/**
+ *
+ * @param filteredDocument Document with field values extracted for selected fields.
+ * @return More Like This query for the passed document.
+ */
+ public Query like(Map<String, ArrayList<String>> filteredDocument) throws IOException {
+ if (fieldNames == null) {
+ // gather list of valid fields from lucene
+ Collection<String> fields = MultiFields.getIndexedFields(ir);
+ fieldNames = fields.toArray(new String[fields.size()]);
+ }
+ return createQuery(retrieveTerms(filteredDocument));
+ }
+
+ /**
* Return a query that will return docs like the passed Readers.
* This was added in order to treat multi-value fields.
*
@@ -740,6 +752,24 @@ public final class MoreLikeThis {
return createQueue(termFreqMap);
}
+
+ private PriorityQueue<ScoreTerm> retrieveTerms(Map<String, ArrayList<String>> fields) throws
+ IOException {
+ HashMap<String,Int> termFreqMap = new HashMap();
+ for (String fieldName : fieldNames) {
+
+ for (String field : fields.keySet()) {
+ ArrayList<String> fieldValues = fields.get(field);
+ for(String fieldValue:fieldValues) {
+ if (fieldValue != null) {
+ addTermFrequencies(new StringReader(fieldValue), termFreqMap,
+ fieldName);
+ }
+ }
+ }
+ }
+ return createQueue(termFreqMap);
+ }
/**
* Adds terms and frequencies found in vector into the Map termFreqMap
*
Modified: lucene/dev/branches/lucene6005/lucene/queries/src/test/org/apache/lucene/queries/function/TestDocValuesFieldSources.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/queries/src/test/org/apache/lucene/queries/function/TestDocValuesFieldSources.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/queries/src/test/org/apache/lucene/queries/function/TestDocValuesFieldSources.java (original)
+++ lucene/dev/branches/lucene6005/lucene/queries/src/test/org/apache/lucene/queries/function/TestDocValuesFieldSources.java Sat Nov 1 09:32:06 2014
@@ -27,7 +27,7 @@ import org.apache.lucene.document.Numeri
import org.apache.lucene.document.SortedDocValuesField;
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.DirectoryReader;
-import org.apache.lucene.index.FieldInfo.DocValuesType;
+import org.apache.lucene.index.DocValuesType;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.queries.function.valuesource.BytesRefFieldSource;
@@ -146,7 +146,7 @@ public class TestDocValuesFieldSources e
public void test() throws IOException {
for (DocValuesType type : DocValuesType.values()) {
- if (type != DocValuesType.SORTED_SET && type != DocValuesType.SORTED_NUMERIC) {
+ if (type != DocValuesType.SORTED_SET && type != DocValuesType.SORTED_NUMERIC && type != DocValuesType.NONE) {
test(type);
}
}
Modified: lucene/dev/branches/lucene6005/lucene/queryparser/src/test/org/apache/lucene/queryparser/analyzing/TestAnalyzingQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/queryparser/src/test/org/apache/lucene/queryparser/analyzing/TestAnalyzingQueryParser.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/queryparser/src/test/org/apache/lucene/queryparser/analyzing/TestAnalyzingQueryParser.java (original)
+++ lucene/dev/branches/lucene6005/lucene/queryparser/src/test/org/apache/lucene/queryparser/analyzing/TestAnalyzingQueryParser.java Sat Nov 1 09:32:06 2014
@@ -34,7 +34,7 @@ import org.apache.lucene.document.Docume
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.index.DirectoryReader;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.queryparser.classic.ParseException;
import org.apache.lucene.queryparser.classic.QueryParser;
Modified: lucene/dev/branches/lucene6005/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionPostingsWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionPostingsWriter.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionPostingsWriter.java (original)
+++ lucene/dev/branches/lucene6005/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionPostingsWriter.java Sat Nov 1 09:32:06 2014
@@ -23,6 +23,7 @@ import org.apache.lucene.codecs.BlockTer
import org.apache.lucene.codecs.CodecUtil;
import org.apache.lucene.codecs.PushPostingsWriterBase;
import org.apache.lucene.index.FieldInfo;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.SegmentWriteState;
import org.apache.lucene.store.DataOutput;
import org.apache.lucene.store.IndexOutput;
@@ -63,7 +64,7 @@ final class IDVersionPostingsWriter exte
@Override
public int setField(FieldInfo fieldInfo) {
super.setField(fieldInfo);
- if (fieldInfo.getIndexOptions() != FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) {
+ if (fieldInfo.getIndexOptions() != IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) {
throw new IllegalArgumentException("field must be index using IndexOptions.DOCS_AND_FREQS_AND_POSITIONS");
}
// LUCENE-5693: because CheckIndex cross-checks term vectors with postings even for deleted docs, and because our PF only indexes the
Modified: lucene/dev/branches/lucene6005/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionSegmentTermsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionSegmentTermsEnum.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionSegmentTermsEnum.java (original)
+++ lucene/dev/branches/lucene6005/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionSegmentTermsEnum.java Sat Nov 1 09:32:06 2014
@@ -23,7 +23,7 @@ import java.io.PrintStream;
import org.apache.lucene.codecs.BlockTermState;
import org.apache.lucene.index.DocsAndPositionsEnum;
import org.apache.lucene.index.DocsEnum;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.TermState;
import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.store.ByteArrayDataInput;
Modified: lucene/dev/branches/lucene6005/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionSegmentTermsEnumFrame.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionSegmentTermsEnumFrame.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionSegmentTermsEnumFrame.java (original)
+++ lucene/dev/branches/lucene6005/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionSegmentTermsEnumFrame.java Sat Nov 1 09:32:06 2014
@@ -20,7 +20,6 @@ package org.apache.lucene.codecs.idversi
import java.io.IOException;
import org.apache.lucene.codecs.BlockTermState;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.index.TermsEnum.SeekStatus;
import org.apache.lucene.store.ByteArrayDataInput;
import org.apache.lucene.util.ArrayUtil;
Modified: lucene/dev/branches/lucene6005/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/VersionBlockTreeTermsWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/VersionBlockTreeTermsWriter.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/VersionBlockTreeTermsWriter.java (original)
+++ lucene/dev/branches/lucene6005/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/VersionBlockTreeTermsWriter.java Sat Nov 1 09:32:06 2014
@@ -26,11 +26,11 @@ import org.apache.lucene.codecs.CodecUti
import org.apache.lucene.codecs.FieldsConsumer;
import org.apache.lucene.codecs.PostingsWriterBase;
import org.apache.lucene.codecs.blocktree.BlockTreeTermsWriter;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.Fields;
import org.apache.lucene.index.IndexFileNames;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.SegmentWriteState;
import org.apache.lucene.index.Terms;
import org.apache.lucene.index.TermsEnum;
@@ -748,7 +748,7 @@ public final class VersionBlockTreeTerms
// TODO: LUCENE-5693: we don't need this check if we fix IW to not send deleted docs to us on flush:
if (state != null && ((IDVersionPostingsWriter) postingsWriter).lastDocID != -1) {
assert state.docFreq != 0;
- assert fieldInfo.getIndexOptions() == IndexOptions.DOCS_ONLY || state.totalTermFreq >= state.docFreq: "postingsWriter=" + postingsWriter;
+ assert fieldInfo.getIndexOptions() == IndexOptions.DOCS || state.totalTermFreq >= state.docFreq: "postingsWriter=" + postingsWriter;
pushTerm(text);
PendingTerm term = new PendingTerm(BytesRef.deepCopyOf(text), state);
Modified: lucene/dev/branches/lucene6005/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/VersionFieldReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/VersionFieldReader.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/VersionFieldReader.java (original)
+++ lucene/dev/branches/lucene6005/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/VersionFieldReader.java Sat Nov 1 09:32:06 2014
@@ -21,7 +21,7 @@ import java.io.IOException;
import java.util.Collections;
import org.apache.lucene.index.FieldInfo;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.Terms;
import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.store.ByteArrayDataInput;
Modified: lucene/dev/branches/lucene6005/lucene/sandbox/src/test/org/apache/lucene/codecs/idversion/StringAndPayloadField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/sandbox/src/test/org/apache/lucene/codecs/idversion/StringAndPayloadField.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/sandbox/src/test/org/apache/lucene/codecs/idversion/StringAndPayloadField.java (original)
+++ lucene/dev/branches/lucene6005/lucene/sandbox/src/test/org/apache/lucene/codecs/idversion/StringAndPayloadField.java Sat Nov 1 09:32:06 2014
@@ -25,7 +25,7 @@ import org.apache.lucene.analysis.tokena
import org.apache.lucene.analysis.tokenattributes.PayloadAttribute;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.util.BytesRef;
// TODO: can we take a BytesRef token instead?
Modified: lucene/dev/branches/lucene6005/lucene/spatial/src/java/org/apache/lucene/spatial/bbox/BBoxStrategy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/spatial/src/java/org/apache/lucene/spatial/bbox/BBoxStrategy.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/spatial/src/java/org/apache/lucene/spatial/bbox/BBoxStrategy.java (original)
+++ lucene/dev/branches/lucene6005/lucene/spatial/src/java/org/apache/lucene/spatial/bbox/BBoxStrategy.java Sat Nov 1 09:32:06 2014
@@ -17,15 +17,11 @@ package org.apache.lucene.spatial.bbox;
* limitations under the License.
*/
-import com.spatial4j.core.context.SpatialContext;
-import com.spatial4j.core.shape.Point;
-import com.spatial4j.core.shape.Rectangle;
-import com.spatial4j.core.shape.Shape;
-
import org.apache.lucene.document.DoubleField;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.StringField;
+import org.apache.lucene.index.DocValuesType;
import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.Term;
import org.apache.lucene.queries.function.ValueSource;
@@ -44,6 +40,10 @@ import org.apache.lucene.spatial.query.U
import org.apache.lucene.spatial.util.DistanceToShapeValueSource;
import org.apache.lucene.util.BytesRefBuilder;
import org.apache.lucene.util.NumericUtils;
+import com.spatial4j.core.context.SpatialContext;
+import com.spatial4j.core.shape.Point;
+import com.spatial4j.core.shape.Rectangle;
+import com.spatial4j.core.shape.Shape;
/**
@@ -106,7 +106,7 @@ public class BBoxStrategy extends Spatia
FieldType fieldType = new FieldType(DoubleField.TYPE_NOT_STORED);
fieldType.setNumericPrecisionStep(8);//Solr's default
- fieldType.setDocValueType(FieldInfo.DocValuesType.NUMERIC);
+ fieldType.setDocValueType(DocValuesType.NUMERIC);
setFieldType(fieldType);
}
Modified: lucene/dev/branches/lucene6005/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/PrefixTreeStrategy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/PrefixTreeStrategy.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/PrefixTreeStrategy.java (original)
+++ lucene/dev/branches/lucene6005/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/PrefixTreeStrategy.java Sat Nov 1 09:32:06 2014
@@ -17,22 +17,23 @@ package org.apache.lucene.spatial.prefix
* limitations under the License.
*/
-import com.spatial4j.core.shape.Point;
-import com.spatial4j.core.shape.Shape;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.index.FieldInfo;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.queries.function.ValueSource;
import org.apache.lucene.spatial.SpatialStrategy;
import org.apache.lucene.spatial.prefix.tree.Cell;
import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree;
import org.apache.lucene.spatial.query.SpatialArgs;
import org.apache.lucene.spatial.util.ShapeFieldCacheDistanceValueSource;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
+import com.spatial4j.core.shape.Point;
+import com.spatial4j.core.shape.Shape;
/**
* An abstract SpatialStrategy based on {@link SpatialPrefixTree}. The two
@@ -144,7 +145,7 @@ public abstract class PrefixTreeStrategy
static {
FIELD_TYPE.setTokenized(true);
FIELD_TYPE.setOmitNorms(true);
- FIELD_TYPE.setIndexOptions(FieldInfo.IndexOptions.DOCS_ONLY);
+ FIELD_TYPE.setIndexOptions(IndexOptions.DOCS);
FIELD_TYPE.freeze();
}
Modified: lucene/dev/branches/lucene6005/lucene/spatial/src/test/org/apache/lucene/spatial/DistanceStrategyTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/spatial/src/test/org/apache/lucene/spatial/DistanceStrategyTest.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/spatial/src/test/org/apache/lucene/spatial/DistanceStrategyTest.java (original)
+++ lucene/dev/branches/lucene6005/lucene/spatial/src/test/org/apache/lucene/spatial/DistanceStrategyTest.java Sat Nov 1 09:32:06 2014
@@ -17,12 +17,13 @@ package org.apache.lucene.spatial;
* limitations under the License.
*/
-import com.carrotsearch.randomizedtesting.annotations.Name;
-import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
-import com.spatial4j.core.context.SpatialContext;
-import com.spatial4j.core.shape.Point;
-import com.spatial4j.core.shape.Shape;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
import org.apache.lucene.document.FieldType;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.spatial.bbox.BBoxStrategy;
import org.apache.lucene.spatial.prefix.RecursivePrefixTreeStrategy;
import org.apache.lucene.spatial.prefix.TermQueryPrefixTreeStrategy;
@@ -32,11 +33,11 @@ import org.apache.lucene.spatial.prefix.
import org.apache.lucene.spatial.serialized.SerializedDVStrategy;
import org.apache.lucene.spatial.vector.PointVectorStrategy;
import org.junit.Test;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import com.carrotsearch.randomizedtesting.annotations.Name;
+import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
+import com.spatial4j.core.context.SpatialContext;
+import com.spatial4j.core.shape.Point;
+import com.spatial4j.core.shape.Shape;
public class DistanceStrategyTest extends StrategyTestCase {
@@ -96,7 +97,7 @@ public class DistanceStrategyTest extend
if (strategy instanceof BBoxStrategy && random().nextBoolean()) {//disable indexing sometimes
BBoxStrategy bboxStrategy = (BBoxStrategy)strategy;
final FieldType fieldType = new FieldType(bboxStrategy.getFieldType());
- fieldType.setIndexOptions(null);
+ fieldType.setIndexOptions(IndexOptions.NONE);
bboxStrategy.setFieldType(fieldType);
}
}
Modified: lucene/dev/branches/lucene6005/lucene/spatial/src/test/org/apache/lucene/spatial/bbox/TestBBoxStrategy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/spatial/src/test/org/apache/lucene/spatial/bbox/TestBBoxStrategy.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/spatial/src/test/org/apache/lucene/spatial/bbox/TestBBoxStrategy.java (original)
+++ lucene/dev/branches/lucene6005/lucene/spatial/src/test/org/apache/lucene/spatial/bbox/TestBBoxStrategy.java Sat Nov 1 09:32:06 2014
@@ -17,14 +17,11 @@ package org.apache.lucene.spatial.bbox;
* limitations under the License.
*/
-import com.carrotsearch.randomizedtesting.annotations.Repeat;
-import com.spatial4j.core.context.SpatialContext;
-import com.spatial4j.core.context.SpatialContextFactory;
-import com.spatial4j.core.distance.DistanceUtils;
-import com.spatial4j.core.shape.Rectangle;
-import com.spatial4j.core.shape.Shape;
-import com.spatial4j.core.shape.impl.RectangleImpl;
+import java.io.IOException;
+
import org.apache.lucene.document.FieldType;
+import org.apache.lucene.index.DocValuesType;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.search.Query;
import org.apache.lucene.spatial.SpatialMatchConcern;
import org.apache.lucene.spatial.prefix.RandomSpatialOpStrategyTestCase;
@@ -33,8 +30,13 @@ import org.apache.lucene.spatial.query.S
import org.apache.lucene.spatial.util.ShapeAreaValueSource;
import org.junit.Ignore;
import org.junit.Test;
-
-import java.io.IOException;
+import com.carrotsearch.randomizedtesting.annotations.Repeat;
+import com.spatial4j.core.context.SpatialContext;
+import com.spatial4j.core.context.SpatialContextFactory;
+import com.spatial4j.core.distance.DistanceUtils;
+import com.spatial4j.core.shape.Rectangle;
+import com.spatial4j.core.shape.Shape;
+import com.spatial4j.core.shape.impl.RectangleImpl;
public class TestBBoxStrategy extends RandomSpatialOpStrategyTestCase {
@@ -110,7 +112,7 @@ public class TestBBoxStrategy extends Ra
if (random().nextBoolean()) {
BBoxStrategy bboxStrategy = (BBoxStrategy) strategy;
FieldType fieldType = new FieldType(bboxStrategy.getFieldType());
- fieldType.setDocValueType(null);
+ fieldType.setDocValueType(DocValuesType.NONE);
bboxStrategy.setFieldType(fieldType);
}
for (SpatialOperation operation : SpatialOperation.values()) {
@@ -292,7 +294,7 @@ public class TestBBoxStrategy extends Ra
BBoxStrategy bboxStrategy = (BBoxStrategy) strategy;
if (random().nextBoolean()) {
FieldType fieldType = new FieldType(bboxStrategy.getFieldType());
- fieldType.setIndexOptions(null);
+ fieldType.setIndexOptions(IndexOptions.NONE);
bboxStrategy.setFieldType(fieldType);
}
Modified: lucene/dev/branches/lucene6005/lucene/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java (original)
+++ lucene/dev/branches/lucene6005/lucene/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java Sat Nov 1 09:32:06 2014
@@ -25,15 +25,15 @@ import java.util.List;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.document.StringField;
-import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.DirectoryReader;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.Term;
-import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.index.Terms;
import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.search.BooleanClause;
Modified: lucene/dev/branches/lucene6005/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingInfixSuggester.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingInfixSuggester.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingInfixSuggester.java (original)
+++ lucene/dev/branches/lucene6005/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingInfixSuggester.java Sat Nov 1 09:32:06 2014
@@ -41,15 +41,14 @@ import org.apache.lucene.document.Numeri
import org.apache.lucene.document.SortedSetDocValuesField;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.FilterLeafReader;
-import org.apache.lucene.index.LeafReader;
-import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.BinaryDocValues;
import org.apache.lucene.index.DirectoryReader;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.index.FilterLeafReader;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.LeafReader;
+import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.MultiDocValues;
import org.apache.lucene.index.ReaderUtil;
import org.apache.lucene.index.SegmentReader;
@@ -378,7 +377,7 @@ public class AnalyzingInfixSuggester ext
*/
protected FieldType getTextFieldType(){
FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
- ft.setIndexOptions(IndexOptions.DOCS_ONLY);
+ ft.setIndexOptions(IndexOptions.DOCS);
ft.setOmitNorms(true);
return ft;
Modified: lucene/dev/branches/lucene6005/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/BlendedInfixSuggester.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/BlendedInfixSuggester.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/BlendedInfixSuggester.java (original)
+++ lucene/dev/branches/lucene6005/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/BlendedInfixSuggester.java Sat Nov 1 09:32:06 2014
@@ -29,7 +29,7 @@ import org.apache.lucene.document.FieldT
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.BinaryDocValues;
import org.apache.lucene.index.DocsAndPositionsEnum;
-import org.apache.lucene.index.FieldInfo;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.MultiDocValues;
import org.apache.lucene.index.Terms;
import org.apache.lucene.index.TermsEnum;
@@ -149,7 +149,7 @@ public class BlendedInfixSuggester exten
@Override
protected FieldType getTextFieldType() {
FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
- ft.setIndexOptions(FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
+ ft.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
ft.setStoreTermVectors(true);
ft.setStoreTermVectorPositions(true);
ft.setOmitNorms(true);
Modified: lucene/dev/branches/lucene6005/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FreeTextSuggester.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FreeTextSuggester.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FreeTextSuggester.java (original)
+++ lucene/dev/branches/lucene6005/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FreeTextSuggester.java Sat Nov 1 09:32:06 2014
@@ -21,6 +21,17 @@ package org.apache.lucene.search.suggest
// - test w/ syns
// - add pruning of low-freq ngrams?
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.AnalyzerWrapper;
import org.apache.lucene.analysis.TokenStream;
@@ -35,7 +46,7 @@ import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.DirectoryReader;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
@@ -58,25 +69,14 @@ import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.IntsRef;
import org.apache.lucene.util.IntsRefBuilder;
import org.apache.lucene.util.fst.Builder;
-import org.apache.lucene.util.fst.FST;
import org.apache.lucene.util.fst.FST.Arc;
import org.apache.lucene.util.fst.FST.BytesReader;
+import org.apache.lucene.util.fst.FST;
import org.apache.lucene.util.fst.Outputs;
import org.apache.lucene.util.fst.PositiveIntOutputs;
-import org.apache.lucene.util.fst.Util;
import org.apache.lucene.util.fst.Util.Result;
import org.apache.lucene.util.fst.Util.TopResults;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
+import org.apache.lucene.util.fst.Util;
//import java.io.PrintWriter;
Modified: lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java (original)
+++ lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java Sat Nov 1 09:32:06 2014
@@ -36,7 +36,7 @@ import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.FieldTypes;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.Attribute;
@@ -579,21 +579,21 @@ public abstract class BaseTokenStreamTes
IndexOptions indexOptions;
switch(random.nextInt(4)) {
- case 0:
- indexOptions = IndexOptions.DOCS_ONLY;
- break;
- case 1:
- indexOptions = IndexOptions.DOCS_AND_FREQS;
- break;
- case 2:
+ case 0:
+ indexOptions = IndexOptions.DOCS;
+ break;
+ case 1:
+ indexOptions = IndexOptions.DOCS_AND_FREQS;
+ break;
+ case 2:
+ indexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
+ break;
+ default:
+ if (offsetsAreCorrect) {
+ indexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
+ } else {
indexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
- break;
- default:
- if (offsetsAreCorrect) {
- indexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
- } else {
- indexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
- }
+ }
}
fieldTypes.disableHighlighting("dummy");
fieldTypes.disableStored("dummy");
Modified: lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingDocValuesFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingDocValuesFormat.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingDocValuesFormat.java (original)
+++ lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingDocValuesFormat.java Sat Nov 1 09:32:06 2014
@@ -23,8 +23,11 @@ import java.util.Iterator;
import org.apache.lucene.codecs.DocValuesConsumer;
import org.apache.lucene.codecs.DocValuesFormat;
import org.apache.lucene.codecs.DocValuesProducer;
+import org.apache.lucene.index.AssertingLeafReader.AssertingRandomAccessOrds;
+import org.apache.lucene.index.AssertingLeafReader.AssertingSortedSetDocValues;
import org.apache.lucene.index.AssertingLeafReader;
import org.apache.lucene.index.BinaryDocValues;
+import org.apache.lucene.index.DocValuesType;
import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.NumericDocValues;
import org.apache.lucene.index.RandomAccessOrds;
@@ -33,8 +36,6 @@ import org.apache.lucene.index.SegmentWr
import org.apache.lucene.index.SortedDocValues;
import org.apache.lucene.index.SortedNumericDocValues;
import org.apache.lucene.index.SortedSetDocValues;
-import org.apache.lucene.index.AssertingLeafReader.AssertingRandomAccessOrds;
-import org.apache.lucene.index.AssertingLeafReader.AssertingSortedSetDocValues;
import org.apache.lucene.util.Accountable;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
@@ -225,7 +226,7 @@ public class AssertingDocValuesFormat ex
@Override
public NumericDocValues getNumeric(FieldInfo field) throws IOException {
- assert field.getDocValuesType() == FieldInfo.DocValuesType.NUMERIC;
+ assert field.getDocValuesType() == DocValuesType.NUMERIC;
NumericDocValues values = in.getNumeric(field);
assert values != null;
return new AssertingLeafReader.AssertingNumericDocValues(values, maxDoc);
@@ -233,7 +234,7 @@ public class AssertingDocValuesFormat ex
@Override
public BinaryDocValues getBinary(FieldInfo field) throws IOException {
- assert field.getDocValuesType() == FieldInfo.DocValuesType.BINARY;
+ assert field.getDocValuesType() == DocValuesType.BINARY;
BinaryDocValues values = in.getBinary(field);
assert values != null;
return new AssertingLeafReader.AssertingBinaryDocValues(values, maxDoc);
@@ -241,7 +242,7 @@ public class AssertingDocValuesFormat ex
@Override
public SortedDocValues getSorted(FieldInfo field) throws IOException {
- assert field.getDocValuesType() == FieldInfo.DocValuesType.SORTED;
+ assert field.getDocValuesType() == DocValuesType.SORTED;
SortedDocValues values = in.getSorted(field);
assert values != null;
return new AssertingLeafReader.AssertingSortedDocValues(values, maxDoc);
@@ -249,7 +250,7 @@ public class AssertingDocValuesFormat ex
@Override
public SortedNumericDocValues getSortedNumeric(FieldInfo field) throws IOException {
- assert field.getDocValuesType() == FieldInfo.DocValuesType.SORTED_NUMERIC;
+ assert field.getDocValuesType() == DocValuesType.SORTED_NUMERIC;
SortedNumericDocValues values = in.getSortedNumeric(field);
assert values != null;
return new AssertingLeafReader.AssertingSortedNumericDocValues(values, maxDoc);
@@ -257,7 +258,7 @@ public class AssertingDocValuesFormat ex
@Override
public SortedSetDocValues getSortedSet(FieldInfo field) throws IOException {
- assert field.getDocValuesType() == FieldInfo.DocValuesType.SORTED_SET;
+ assert field.getDocValuesType() == DocValuesType.SORTED_SET;
SortedSetDocValues values = in.getSortedSet(field);
assert values != null;
if (values instanceof RandomAccessOrds) {
@@ -269,7 +270,7 @@ public class AssertingDocValuesFormat ex
@Override
public Bits getDocsWithField(FieldInfo field) throws IOException {
- assert field.getDocValuesType() != null;
+ assert field.getDocValuesType() != DocValuesType.NONE;
Bits bits = in.getDocsWithField(field);
assert bits != null;
assert bits.length() == maxDoc;
Modified: lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingPostingsFormat.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingPostingsFormat.java (original)
+++ lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingPostingsFormat.java Sat Nov 1 09:32:06 2014
@@ -28,6 +28,7 @@ import org.apache.lucene.index.DocsAndPo
import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.Fields;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.SegmentReadState;
import org.apache.lucene.index.SegmentWriteState;
import org.apache.lucene.index.Terms;
@@ -160,9 +161,9 @@ public final class AssertingPostingsForm
DocsEnum docsEnum = null;
DocsAndPositionsEnum posEnum = null;
- boolean hasFreqs = fieldInfo.getIndexOptions().compareTo(FieldInfo.IndexOptions.DOCS_AND_FREQS) >= 0;
- boolean hasPositions = fieldInfo.getIndexOptions().compareTo(FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
- boolean hasOffsets = fieldInfo.getIndexOptions().compareTo(FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
+ boolean hasFreqs = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS) >= 0;
+ boolean hasPositions = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
+ boolean hasOffsets = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
boolean hasPayloads = terms.hasPayloads();
assert hasPositions == terms.hasPositions();
Modified: lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java (original)
+++ lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java Sat Nov 1 09:32:06 2014
@@ -35,10 +35,10 @@ import org.apache.lucene.codecs.Postings
import org.apache.lucene.codecs.TermStats;
import org.apache.lucene.index.DocsAndPositionsEnum;
import org.apache.lucene.index.DocsEnum;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.Fields;
import org.apache.lucene.index.IndexFileNames;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.SegmentReadState;
import org.apache.lucene.index.SegmentWriteState;
import org.apache.lucene.index.Terms;
@@ -142,7 +142,7 @@ public final class RAMOnlyPostingsFormat
public long getSumTotalTermFreq() {
return sumTotalTermFreq;
}
-
+
@Override
public long getSumDocFreq() throws IOException {
return sumDocFreq;
Modified: lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/AssertingLeafReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/AssertingLeafReader.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/AssertingLeafReader.java (original)
+++ lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/AssertingLeafReader.java Sat Nov 1 09:32:06 2014
@@ -679,10 +679,10 @@ public class AssertingLeafReader extends
FieldInfo fi = getFieldInfos().fieldInfo(field);
if (dv != null) {
assert fi != null;
- assert fi.getDocValuesType() == FieldInfo.DocValuesType.NUMERIC;
+ assert fi.getDocValuesType() == DocValuesType.NUMERIC;
return new AssertingNumericDocValues(dv, maxDoc());
} else {
- assert fi == null || fi.getDocValuesType() != FieldInfo.DocValuesType.NUMERIC;
+ assert fi == null || fi.getDocValuesType() != DocValuesType.NUMERIC;
return null;
}
}
@@ -693,10 +693,10 @@ public class AssertingLeafReader extends
FieldInfo fi = getFieldInfos().fieldInfo(field);
if (dv != null) {
assert fi != null;
- assert fi.getDocValuesType() == FieldInfo.DocValuesType.BINARY;
+ assert fi.getDocValuesType() == DocValuesType.BINARY;
return new AssertingBinaryDocValues(dv, maxDoc());
} else {
- assert fi == null || fi.getDocValuesType() != FieldInfo.DocValuesType.BINARY;
+ assert fi == null || fi.getDocValuesType() != DocValuesType.BINARY;
return null;
}
}
@@ -707,10 +707,10 @@ public class AssertingLeafReader extends
FieldInfo fi = getFieldInfos().fieldInfo(field);
if (dv != null) {
assert fi != null;
- assert fi.getDocValuesType() == FieldInfo.DocValuesType.SORTED;
+ assert fi.getDocValuesType() == DocValuesType.SORTED;
return new AssertingSortedDocValues(dv, maxDoc());
} else {
- assert fi == null || fi.getDocValuesType() != FieldInfo.DocValuesType.SORTED;
+ assert fi == null || fi.getDocValuesType() != DocValuesType.SORTED;
return null;
}
}
@@ -721,10 +721,10 @@ public class AssertingLeafReader extends
FieldInfo fi = getFieldInfos().fieldInfo(field);
if (dv != null) {
assert fi != null;
- assert fi.getDocValuesType() == FieldInfo.DocValuesType.SORTED_NUMERIC;
+ assert fi.getDocValuesType() == DocValuesType.SORTED_NUMERIC;
return new AssertingSortedNumericDocValues(dv, maxDoc());
} else {
- assert fi == null || fi.getDocValuesType() != FieldInfo.DocValuesType.SORTED_NUMERIC;
+ assert fi == null || fi.getDocValuesType() != DocValuesType.SORTED_NUMERIC;
return null;
}
}
@@ -735,14 +735,14 @@ public class AssertingLeafReader extends
FieldInfo fi = getFieldInfos().fieldInfo(field);
if (dv != null) {
assert fi != null;
- assert fi.getDocValuesType() == FieldInfo.DocValuesType.SORTED_SET;
+ assert fi.getDocValuesType() == DocValuesType.SORTED_SET;
if (dv instanceof RandomAccessOrds) {
return new AssertingRandomAccessOrds((RandomAccessOrds) dv, maxDoc());
} else {
return new AssertingSortedSetDocValues(dv, maxDoc());
}
} else {
- assert fi == null || fi.getDocValuesType() != FieldInfo.DocValuesType.SORTED_SET;
+ assert fi == null || fi.getDocValuesType() != DocValuesType.SORTED_SET;
return null;
}
}
Modified: lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/BaseFieldInfoFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/BaseFieldInfoFormatTestCase.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/BaseFieldInfoFormatTestCase.java (original)
+++ lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/BaseFieldInfoFormatTestCase.java Sat Nov 1 09:32:06 2014
@@ -27,8 +27,6 @@ import org.apache.lucene.document.Docume
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.StoredField;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.FieldInfo.DocValuesType;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IOContext;
import org.apache.lucene.util.StringHelper;
@@ -84,7 +82,7 @@ public abstract class BaseFieldInfoForma
for (String field : fieldNames) {
IndexableFieldType fieldType = randomFieldType(random());
FieldInfo fi = builder.addOrUpdate(field, fieldType);
- if (fieldType.indexOptions() != null && fieldType.indexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0) {
+ if (fieldType.indexOptions() != IndexOptions.NONE && fieldType.indexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0) {
if (random().nextBoolean()) {
fi.setStorePayloads();
}
Modified: lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/BaseNormsFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/BaseNormsFormatTestCase.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/BaseNormsFormatTestCase.java (original)
+++ lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/BaseNormsFormatTestCase.java Sat Nov 1 09:32:06 2014
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
+import com.carrotsearch.randomizedtesting.annotations.Seed;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.analysis.MockTokenizer;
@@ -43,6 +44,7 @@ import org.apache.lucene.util.TestUtil;
* test passes, then all Lucene/Solr tests should also pass. Ie,
* if there is some bug in a given NormsFormat that this
* test fails to catch then this test needs to be improved! */
+@Seed(value = "AD2222476BCB8800")
public abstract class BaseNormsFormatTestCase extends BaseIndexFileFormatTestCase {
public void testByteRange() throws Exception {
@@ -182,6 +184,32 @@ public abstract class BaseNormsFormatTes
}
}
+ public void testNCommon() throws Exception {
+ final int iterations = atLeast(1);
+ final Random r = random();
+ for (int i = 0; i < iterations; ++i) {
+ // 16 is 4 bpv, the max before we jump to 8bpv
+ for (int n = 2; n < 16; ++n) {
+ final int N = n;
+ final long[] commonValues = new long[N];
+ for (int j = 0; j < N; ++j) {
+ commonValues[j] = TestUtil.nextLong(r, Byte.MIN_VALUE, Byte.MAX_VALUE);
+ }
+ final int numOtherValues = TestUtil.nextInt(r, 2, 256 - N);
+ final long[] otherValues = new long[numOtherValues];
+ for (int j = 0; j < numOtherValues; ++j) {
+ otherValues[j] = TestUtil.nextLong(r, Byte.MIN_VALUE, Byte.MAX_VALUE);
+ }
+ doTestNormsVersusStoredFields(new LongProducer() {
+ @Override
+ long next() {
+ return r.nextInt(100) == 0 ? otherValues[r.nextInt(numOtherValues - 1)] : commonValues[r.nextInt(N - 1)];
+ }
+ });
+ }
+ }
+ }
+
private void doTestNormsVersusStoredFields(LongProducer longs) throws Exception {
int numDocs = atLeast(500);
long norms[] = new long[numDocs];
@@ -226,7 +254,7 @@ public abstract class BaseNormsFormatTes
NumericDocValues docValues = r.getNormValues("stored");
for (int i = 0; i < r.maxDoc(); i++) {
long storedValue = Long.parseLong(r.document(i).getString("stored"));
- assertEquals(storedValue, docValues.get(i));
+ assertEquals("doc " + i, storedValue, docValues.get(i));
}
}
ir.close();
Modified: lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java (original)
+++ lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java Sat Nov 1 09:32:06 2014
@@ -45,7 +45,6 @@ import org.apache.lucene.codecs.perfield
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.index.TermsEnum.SeekStatus;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FlushInfo;
@@ -372,7 +371,7 @@ public abstract class BasePostingsFormat
fieldInfoArray[fieldUpto] = new FieldInfo(field, fieldUpto, false, false, true,
IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS,
- null, -1, null);
+ DocValuesType.NONE, -1, null);
fieldUpto++;
SortedMap<BytesRef,SeedAndOrd> postings = new TreeMap<>();
@@ -414,7 +413,7 @@ public abstract class BasePostingsFormat
// NOTE: sort of silly: we enum all the docs just to
// get the maxDoc
- DocsEnum docsEnum = getSeedPostings(term, termSeed, false, IndexOptions.DOCS_ONLY, true);
+ DocsEnum docsEnum = getSeedPostings(term, termSeed, false, IndexOptions.DOCS, true);
int doc;
int lastDoc = 0;
while((doc = docsEnum.nextDoc()) != DocsEnum.NO_MORE_DOCS) {
@@ -690,7 +689,7 @@ public abstract class BasePostingsFormat
// Randomly picked the IndexOptions to index this
// field with:
- IndexOptions indexOptions = IndexOptions.values()[alwaysTestMax ? maxIndexOption : random().nextInt(1+maxIndexOption)];
+ IndexOptions indexOptions = IndexOptions.values()[alwaysTestMax ? maxIndexOption : TestUtil.nextInt(random(), 1, maxIndexOption)];
boolean doPayloads = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0 && allowPayloads;
newFieldInfoArray[fieldUpto] = new FieldInfo(oldFieldInfo.name,
@@ -699,7 +698,7 @@ public abstract class BasePostingsFormat
false,
doPayloads,
indexOptions,
- null,
+ DocValuesType.NONE,
-1,
null);
}
@@ -1358,7 +1357,7 @@ public abstract class BasePostingsFormat
}
public void testDocsOnly() throws Exception {
- testFull(IndexOptions.DOCS_ONLY, false);
+ testFull(IndexOptions.DOCS, false);
}
public void testDocsAndFreqs() throws Exception {
@@ -1736,6 +1735,9 @@ public abstract class BasePostingsFormat
@Override
protected void addRandomFields(Document doc) {
for (IndexOptions opts : IndexOptions.values()) {
+ if (opts == IndexOptions.NONE) {
+ continue;
+ }
FieldType ft = new FieldType();
ft.setIndexOptions(opts);
ft.freeze();
Modified: lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java (original)
+++ lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java Sat Nov 1 09:32:06 2014
@@ -245,7 +245,7 @@ public abstract class BaseStoredFieldsFo
w.addDocument(doc);
IndexReader r = w.getReader();
w.close();
- assertNull(r.document(0).getField("field").fieldType().indexOptions());
+ assertEquals(IndexOptions.NONE, r.document(0).getField("field").fieldType().indexOptions());
assertNotNull(r.document(0).getField("field2").fieldType().indexOptions());
r.close();
dir.close();
@@ -522,7 +522,7 @@ public abstract class BaseStoredFieldsFo
bigDoc2.add(idField);
final FieldType onlyStored = new FieldType(StringField.TYPE_STORED);
- onlyStored.setIndexOptions(null);
+ onlyStored.setIndexOptions(IndexOptions.NONE);
final Field smallField = new Field("fld", randomByteArray(random().nextInt(10), 256), onlyStored);
final int numFields = RandomInts.randomIntBetween(random(), 500000, 1000000);
Modified: lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/DocHelper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/DocHelper.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/DocHelper.java (original)
+++ lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/index/DocHelper.java Sat Nov 1 09:32:06 2014
@@ -38,7 +38,6 @@ import org.apache.lucene.document.FieldT
import org.apache.lucene.document.StoredField;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.similarities.Similarity;
import org.apache.lucene.store.Directory;
@@ -148,7 +147,7 @@ class DocHelper {
// Otherwise large text:
fieldTypes.disableHighlighting(NO_TF_KEY);
- fieldTypes.setIndexOptions(NO_TF_KEY, IndexOptions.DOCS_ONLY);
+ fieldTypes.setIndexOptions(NO_TF_KEY, IndexOptions.DOCS);
// Otherwise large text:
fieldTypes.disableStored(UNSTORED_FIELD_1_KEY);
@@ -186,7 +185,7 @@ class DocHelper {
public static Set<String> getIndexed(FieldTypes fieldTypes) {
Set<String> indexed = new HashSet<>();
for(String fieldName : fieldTypes.getFieldNames()) {
- if (fieldTypes.getIndexOptions(fieldName) != null) {
+ if (fieldTypes.getIndexOptions(fieldName) != IndexOptions.NONE) {
indexed.add(fieldName);
}
}
@@ -196,7 +195,7 @@ class DocHelper {
public static Set<String> getNotIndexed(FieldTypes fieldTypes) {
Set<String> notIndexed = new HashSet<>();
for(String fieldName : fieldTypes.getFieldNames()) {
- if (fieldTypes.getIndexOptions(fieldName) == null) {
+ if (fieldTypes.getIndexOptions(fieldName) == IndexOptions.NONE) {
notIndexed.add(fieldName);
}
}
@@ -216,7 +215,7 @@ class DocHelper {
public static Set<String> getNoTermVectorFields(FieldTypes fieldTypes) {
Set<String> noTVFields = new HashSet<>();
for(String fieldName : fieldTypes.getFieldNames()) {
- if (fieldTypes.getIndexOptions(fieldName) != null && fieldTypes.getTermVectors(fieldName) == false) {
+ if (fieldTypes.getIndexOptions(fieldName) != IndexOptions.NONE && fieldTypes.getTermVectors(fieldName) == false) {
noTVFields.add(fieldName);
}
}
Modified: lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/util/BaseBitSetTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/util/BaseBitSetTestCase.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/util/BaseBitSetTestCase.java (original)
+++ lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/util/BaseBitSetTestCase.java Sat Nov 1 09:32:06 2014
@@ -74,6 +74,30 @@ public abstract class BaseBitSetTestCase
}
}
+ /** Test {@link BitSet#prevSetBit(int)}. */
+ public void testPrevSetBit() throws IOException {
+ final int numBits = 1 + random().nextInt(100000);
+ for (float percentSet : new float[] {0, 0.01f, 0.1f, 0.5f, 0.9f, 0.99f, 1f}) {
+ BitSet set1 = new JavaUtilBitSet(randomSet(numBits, percentSet), numBits);
+ T set2 = copyOf(set1, numBits);
+ for (int i = 0; i < numBits; ++i) {
+ assertEquals(Integer.toString(i), set1.prevSetBit(i), set2.prevSetBit(i));
+ }
+ }
+ }
+
+ /** Test {@link BitSet#nextSetBit(int)}. */
+ public void testNextSetBit() throws IOException {
+ final int numBits = 1 + random().nextInt(100000);
+ for (float percentSet : new float[] {0, 0.01f, 0.1f, 0.5f, 0.9f, 0.99f, 1f}) {
+ BitSet set1 = new JavaUtilBitSet(randomSet(numBits, percentSet), numBits);
+ T set2 = copyOf(set1, numBits);
+ for (int i = 0; i < numBits; ++i) {
+ assertEquals(set1.nextSetBit(i), set2.nextSetBit(i));
+ }
+ }
+ }
+
/** Test the {@link BitSet#set} method. */
public void testSet() throws IOException {
final int numBits = 1 + random().nextInt(100000);
@@ -240,6 +264,11 @@ public abstract class BaseBitSetTestCase
}
@Override
+ public int prevSetBit(int index) {
+ return bitSet.previousSetBit(index);
+ }
+
+ @Override
public int nextSetBit(int i) {
int next = bitSet.nextSetBit(i);
if (next == -1) {
Modified: lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.java (original)
+++ lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.java Sat Nov 1 09:32:06 2014
@@ -41,7 +41,7 @@ import org.apache.lucene.document.IntFie
import org.apache.lucene.document.SortedDocValuesField;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
+import org.apache.lucene.index.IndexOptions;
/** Minimal port of benchmark's LneDocSource +
* DocMaker, so tests can enum docs from a line file created
Modified: lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java (original)
+++ lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java Sat Nov 1 09:32:06 2014
@@ -76,6 +76,7 @@ import org.apache.lucene.index.FieldFilt
import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.Fields;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexReader.ReaderClosedListener;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
@@ -1345,7 +1346,7 @@ public abstract class LuceneTestCase ext
/** Returns a FieldType derived from newType but whose
* term vector options match the old type */
private static FieldType mergeTermVectorOptions(FieldType newType, FieldType oldType) {
- if (newType.indexOptions() != null && oldType.storeTermVectors() == true && newType.storeTermVectors() == false) {
+ if (newType.indexOptions() != IndexOptions.NONE && oldType.storeTermVectors() == true && newType.storeTermVectors() == false) {
newType = new FieldType(newType);
newType.setStoreTermVectors(oldType.storeTermVectors());
newType.setStoreTermVectorPositions(oldType.storeTermVectorPositions());
@@ -1372,7 +1373,7 @@ public abstract class LuceneTestCase ext
FieldType prevType = fieldToType.get(name);
- if (usually(random) || type.indexOptions() == null || prevType != null) {
+ if (usually(random) || type.indexOptions() == IndexOptions.NONE || prevType != null) {
// most of the time, don't modify the params
if (prevType == null) {
fieldToType.put(name, new FieldType(type));
Modified: lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java (original)
+++ lucene/dev/branches/lucene6005/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java Sat Nov 1 09:32:06 2014
@@ -62,17 +62,17 @@ import org.apache.lucene.document.IntFie
import org.apache.lucene.document.LongField;
import org.apache.lucene.document.NumericDocValuesField;
import org.apache.lucene.document.SortedDocValuesField;
-import org.apache.lucene.index.FilterLeafReader;
-import org.apache.lucene.index.LeafReader;
-import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.CheckIndex;
import org.apache.lucene.index.ConcurrentMergeScheduler;
+import org.apache.lucene.index.DocValuesType;
import org.apache.lucene.index.DocsAndPositionsEnum;
import org.apache.lucene.index.DocsEnum;
-import org.apache.lucene.index.FieldInfo.DocValuesType;
+import org.apache.lucene.index.FilterLeafReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexableField;
+import org.apache.lucene.index.LeafReader;
+import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.LogMergePolicy;
import org.apache.lucene.index.MergePolicy;
import org.apache.lucene.index.MergeScheduler;
@@ -897,14 +897,14 @@ public final class TestUtil {
final Field field2;
final DocValuesType dvType = field1.fieldType().docValueType();
final NumericType numType = field1.fieldType().numericType();
- if (dvType != null) {
+ if (dvType != DocValuesType.NONE) {
switch(dvType) {
case NUMERIC:
field2 = new NumericDocValuesField(field1.name(), field1.numericValue().longValue());
break;
case BINARY:
field2 = new BinaryDocValuesField(field1.name(), field1.binaryValue());
- break;
+ break;
case SORTED:
field2 = new SortedDocValuesField(field1.name(), field1.binaryValue());
break;
Modified: lucene/dev/branches/lucene6005/lucene/tools/javadoc/ecj.javadocs.prefs
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/tools/javadoc/ecj.javadocs.prefs?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/tools/javadoc/ecj.javadocs.prefs (original)
+++ lucene/dev/branches/lucene6005/lucene/tools/javadoc/ecj.javadocs.prefs Sat Nov 1 09:32:06 2014
@@ -1,5 +1,10 @@
#Sun Sep 23 20:55:03 EDT 2012
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullisdefault=disabled
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
Modified: lucene/dev/branches/lucene6005/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/CHANGES.txt?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/CHANGES.txt (original)
+++ lucene/dev/branches/lucene6005/solr/CHANGES.txt Sat Nov 1 09:32:06 2014
@@ -194,6 +194,10 @@ New Features
properties to allow easier overriding of just the right piece of the Solr URL.
(ehatcher)
+* SOLR-6248: MoreLikeThis QParser that accepts a document id and returns documents that
+ have similar content. It works in standalone/cloud mode and shares logic with the
+ Lucene MoreLikeThis class (Anshum Gupta).
+
Bug Fixes
----------------------
@@ -219,7 +223,7 @@ Bug Fixes
* SOLR-6187: SOLR-6154: facet.mincount ignored in range faceting using distributed search
NOTE: This does NOT fixed for the (deprecated) facet.date idiom, use facet.range
- instead. (Erick Erickson, Zacchio Bagnati, Ronald Matamoros, Vamsee Yalargadda)
+ instead. (Erick Erickson, Zaccheo Bagnati, Ronald Matamoros, Vamsee Yalargadda)
* SOLR-6457: LBHttpSolrServer: ArrayIndexOutOfBoundsException risk if counter overflows
(longkey via Noble Paul)
@@ -274,6 +278,10 @@ Bug Fixes
* SOLR-6591: Overseer can use stale cluster state and lose updates for collections
with stateFormat > 1. (shalin)
+* SOLR-6631: DistributedQueue spinning on calling zookeeper getChildren()
+ (Jessica Cheng Mallet, Mark Miller, Timothy Potter)
+
+
Optimizations
----------------------