mirror of https://github.com/apache/lucene.git
LUCENE-3863: rename DocValues.type() to DocValues.getType()
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1299495 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
402496c8dd
commit
b075b7466c
|
@ -43,8 +43,8 @@ class MemoryIndexNormDocValues extends DocValues {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type type() {
|
public Type getType() {
|
||||||
return source.type();
|
return source.getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -235,7 +235,7 @@ class Lucene3xNormsProducer extends PerDocProducer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type type() {
|
public Type getType() {
|
||||||
return Type.FIXED_INTS_8;
|
return Type.FIXED_INTS_8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -363,7 +363,7 @@ public final class Bytes {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type type() {
|
public Type getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ class FixedDerefBytesImpl {
|
||||||
@Override
|
@Override
|
||||||
public Source getDirectSource()
|
public Source getDirectSource()
|
||||||
throws IOException {
|
throws IOException {
|
||||||
return new DirectFixedDerefSource(cloneData(), cloneIndex(), size, type());
|
return new DirectFixedDerefSource(cloneData(), cloneIndex(), size, getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -287,7 +287,7 @@ class FixedStraightBytesImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Source getDirectSource() throws IOException {
|
public Source getDirectSource() throws IOException {
|
||||||
return new DirectFixedStraightSource(cloneData(), size, type());
|
return new DirectFixedStraightSource(cloneData(), size, getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class Floats {
|
||||||
@Override
|
@Override
|
||||||
protected boolean tryBulkMerge(DocValues docValues) {
|
protected boolean tryBulkMerge(DocValues docValues) {
|
||||||
// only bulk merge if value type is the same otherwise size differs
|
// only bulk merge if value type is the same otherwise size differs
|
||||||
return super.tryBulkMerge(docValues) && docValues.type() == template.type();
|
return super.tryBulkMerge(docValues) && docValues.getType() == template.getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -121,7 +121,7 @@ public final class Ints {
|
||||||
@Override
|
@Override
|
||||||
protected boolean tryBulkMerge(DocValues docValues) {
|
protected boolean tryBulkMerge(DocValues docValues) {
|
||||||
// only bulk merge if value type is the same otherwise size differs
|
// only bulk merge if value type is the same otherwise size differs
|
||||||
return super.tryBulkMerge(docValues) && docValues.type() == template.type();
|
return super.tryBulkMerge(docValues) && docValues.getType() == template.getType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,7 +210,7 @@ class PackedIntValues {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type type() {
|
public Type getType() {
|
||||||
return Type.VAR_INTS;
|
return Type.VAR_INTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ class VarDerefBytesImpl {
|
||||||
@Override
|
@Override
|
||||||
public Source getDirectSource()
|
public Source getDirectSource()
|
||||||
throws IOException {
|
throws IOException {
|
||||||
return new DirectVarDerefSource(cloneData(), cloneIndex(), type());
|
return new DirectVarDerefSource(cloneData(), cloneIndex(), getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ final class VarSortedBytesImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Source getDirectSource() throws IOException {
|
public Source getDirectSource() throws IOException {
|
||||||
return new DirectSortedSource(cloneData(), cloneIndex(), comparator, type());
|
return new DirectSortedSource(cloneData(), cloneIndex(), comparator, getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,7 +248,7 @@ class VarStraightBytesImpl {
|
||||||
@Override
|
@Override
|
||||||
public Source getDirectSource()
|
public Source getDirectSource()
|
||||||
throws IOException {
|
throws IOException {
|
||||||
return new DirectVarStraightSource(cloneData(), cloneIndex(), type());
|
return new DirectVarStraightSource(cloneData(), cloneIndex(), getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -200,7 +200,7 @@ public class SimpleTextPerDocProducer extends PerDocProducerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type type() {
|
public Type getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1167,7 +1167,7 @@ public class CheckIndex {
|
||||||
if (docValues == null) {
|
if (docValues == null) {
|
||||||
throw new RuntimeException("field: " + fieldName + " omits docvalues but should have them!");
|
throw new RuntimeException("field: " + fieldName + " omits docvalues but should have them!");
|
||||||
}
|
}
|
||||||
DocValues.Type type = docValues.type();
|
DocValues.Type type = docValues.getType();
|
||||||
if (type != expectedType) {
|
if (type != expectedType) {
|
||||||
throw new RuntimeException("field: " + fieldName + " has type: " + type + " but fieldInfos says:" + expectedType);
|
throw new RuntimeException("field: " + fieldName + " has type: " + type + " but fieldInfos says:" + expectedType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ public abstract class DocValues implements Closeable {
|
||||||
/**
|
/**
|
||||||
* Returns the {@link Type} of this {@link DocValues} instance
|
* Returns the {@link Type} of this {@link DocValues} instance
|
||||||
*/
|
*/
|
||||||
public abstract Type type();
|
public abstract Type getType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes this {@link DocValues} instance. This method should only be called
|
* Closes this {@link DocValues} instance. This method should only be called
|
||||||
|
@ -191,7 +191,7 @@ public abstract class DocValues implements Closeable {
|
||||||
*
|
*
|
||||||
* @return the {@link Type} of this source.
|
* @return the {@link Type} of this source.
|
||||||
*/
|
*/
|
||||||
public Type type() {
|
public Type getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ public class MultiDocValues extends DocValues {
|
||||||
}
|
}
|
||||||
final DocValues d = puller.pull(r, field);
|
final DocValues d = puller.pull(r, field);
|
||||||
if (d != null) {
|
if (d != null) {
|
||||||
TypePromoter incoming = TypePromoter.create(d.type(), d.getValueSize());
|
TypePromoter incoming = TypePromoter.create(d.getType(), d.getValueSize());
|
||||||
promotedType[0] = promotedType[0].promote(incoming);
|
promotedType[0] = promotedType[0].promote(incoming);
|
||||||
} else if (puller.stopLoadingOnNull(r, field)){
|
} else if (puller.stopLoadingOnNull(r, field)){
|
||||||
promotedType[0] = TypePromoter.getIdentityPromoter(); // set to identity to return null
|
promotedType[0] = TypePromoter.getIdentityPromoter(); // set to identity to return null
|
||||||
|
@ -203,8 +203,8 @@ public class MultiDocValues extends DocValues {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type type() {
|
public Type getType() {
|
||||||
return emptySource.type();
|
return emptySource.getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -230,8 +230,8 @@ public class MultiDocValues extends DocValues {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type type() {
|
public Type getType() {
|
||||||
return emptyFixedSource.type();
|
return emptyFixedSource.getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -519,7 +519,7 @@ public class MultiDocValues extends DocValues {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SortedSource asSortedSource() {
|
public SortedSource asSortedSource() {
|
||||||
if (type() == Type.BYTES_FIXED_SORTED || type() == Type.BYTES_VAR_SORTED) {
|
if (getType() == Type.BYTES_FIXED_SORTED || getType() == Type.BYTES_VAR_SORTED) {
|
||||||
|
|
||||||
}
|
}
|
||||||
return super.asSortedSource();
|
return super.asSortedSource();
|
||||||
|
@ -586,7 +586,7 @@ public class MultiDocValues extends DocValues {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type type() {
|
public Type getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ final class SegmentMerger {
|
||||||
// returns an updated typepromoter (tracking type and size) given a previous one,
|
// returns an updated typepromoter (tracking type and size) given a previous one,
|
||||||
// and a newly encountered docvalues
|
// and a newly encountered docvalues
|
||||||
private TypePromoter mergeDocValuesType(TypePromoter previous, DocValues docValues) {
|
private TypePromoter mergeDocValuesType(TypePromoter previous, DocValues docValues) {
|
||||||
TypePromoter incoming = TypePromoter.create(docValues.type(), docValues.getValueSize());
|
TypePromoter incoming = TypePromoter.create(docValues.getType(), docValues.getValueSize());
|
||||||
if (previous == null) {
|
if (previous == null) {
|
||||||
previous = TypePromoter.getIdentityPromoter();
|
previous = TypePromoter.getIdentityPromoter();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1640,7 +1640,7 @@ public abstract class FieldComparator<T> {
|
||||||
// This means segment has doc values, but they are
|
// This means segment has doc values, but they are
|
||||||
// not able to provide a sorted source; consider
|
// not able to provide a sorted source; consider
|
||||||
// this a hard error:
|
// this a hard error:
|
||||||
throw new IllegalStateException("DocValues exist for field \"" + field + "\", but not as a sorted source: type=" + dv.getSource().type() + " reader=" + context.reader());
|
throw new IllegalStateException("DocValues exist for field \"" + field + "\", but not as a sorted source: type=" + dv.getSource().getType() + " reader=" + context.reader());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ public class TestDocValues extends LuceneTestCase {
|
||||||
DocValues r = Ints.getValues(dir, "test", 2, Type.VAR_INTS, newIOContext(random));
|
DocValues r = Ints.getValues(dir, "test", 2, Type.VAR_INTS, newIOContext(random));
|
||||||
Source source = getSource(r);
|
Source source = getSource(r);
|
||||||
assertEquals(i + " with min: " + minMax[i][0] + " max: " + minMax[i][1],
|
assertEquals(i + " with min: " + minMax[i][0] + " max: " + minMax[i][1],
|
||||||
expectedTypes[i], source.type());
|
expectedTypes[i], source.getType());
|
||||||
assertEquals(minMax[i][0], source.getInt(0));
|
assertEquals(minMax[i][0], source.getInt(0));
|
||||||
assertEquals(minMax[i][1], source.getInt(1));
|
assertEquals(minMax[i][1], source.getInt(1));
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ public class TestDocValues extends LuceneTestCase {
|
||||||
DocValues r = Ints.getValues(dir, "test", NUM_VALUES + additionalDocs, type, newIOContext(random));
|
DocValues r = Ints.getValues(dir, "test", NUM_VALUES + additionalDocs, type, newIOContext(random));
|
||||||
for (int iter = 0; iter < 2; iter++) {
|
for (int iter = 0; iter < 2; iter++) {
|
||||||
Source s = getSource(r);
|
Source s = getSource(r);
|
||||||
assertEquals(type, s.type());
|
assertEquals(type, s.getType());
|
||||||
for (int i = 0; i < NUM_VALUES; i++) {
|
for (int i = 0; i < NUM_VALUES; i++) {
|
||||||
final long v = s.getInt(i);
|
final long v = s.getInt(i);
|
||||||
assertEquals("index " + i, values[i], v);
|
assertEquals("index " + i, values[i], v);
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class TestCustomNorms extends LuceneTestCase {
|
||||||
assertNotNull(normValues);
|
assertNotNull(normValues);
|
||||||
Source source = normValues.getSource();
|
Source source = normValues.getSource();
|
||||||
assertTrue(source.hasArray());
|
assertTrue(source.hasArray());
|
||||||
assertEquals(Type.FLOAT_32, normValues.type());
|
assertEquals(Type.FLOAT_32, normValues.getType());
|
||||||
float[] norms = (float[]) source.getArray();
|
float[] norms = (float[]) source.getArray();
|
||||||
for (int i = 0; i < open.maxDoc(); i++) {
|
for (int i = 0; i < open.maxDoc(); i++) {
|
||||||
Document document = open.document(i);
|
Document document = open.document(i);
|
||||||
|
|
|
@ -432,7 +432,7 @@ public class TestDocValuesIndexing extends LuceneTestCase {
|
||||||
if (val == Type.VAR_INTS) {
|
if (val == Type.VAR_INTS) {
|
||||||
}
|
}
|
||||||
Source source = docValues.getSource();
|
Source source = docValues.getSource();
|
||||||
switch (source.type()) {
|
switch (source.getType()) {
|
||||||
case FIXED_INTS_8:
|
case FIXED_INTS_8:
|
||||||
{
|
{
|
||||||
assertTrue(source.hasArray());
|
assertTrue(source.hasArray());
|
||||||
|
@ -492,7 +492,7 @@ public class TestDocValuesIndexing extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fail("unexpected value " + source.type());
|
fail("unexpected value " + source.getType());
|
||||||
}
|
}
|
||||||
r.close();
|
r.close();
|
||||||
}
|
}
|
||||||
|
@ -515,7 +515,7 @@ public class TestDocValuesIndexing extends LuceneTestCase {
|
||||||
// getArray()
|
// getArray()
|
||||||
Source source = docValues.getSource();
|
Source source = docValues.getSource();
|
||||||
|
|
||||||
switch (source.type()) {
|
switch (source.getType()) {
|
||||||
case BYTES_FIXED_STRAIGHT: {
|
case BYTES_FIXED_STRAIGHT: {
|
||||||
BytesRef ref = new BytesRef();
|
BytesRef ref = new BytesRef();
|
||||||
if (source.hasArray()) {
|
if (source.hasArray()) {
|
||||||
|
@ -529,7 +529,7 @@ public class TestDocValuesIndexing extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fail("unexpected value " + source.type());
|
fail("unexpected value " + source.getType());
|
||||||
}
|
}
|
||||||
r.close();
|
r.close();
|
||||||
w.close();
|
w.close();
|
||||||
|
@ -549,7 +549,7 @@ public class TestDocValuesIndexing extends LuceneTestCase {
|
||||||
case 2:
|
case 2:
|
||||||
return values.getDirectSource();
|
return values.getDirectSource();
|
||||||
case 1:
|
case 1:
|
||||||
if(values.type() == Type.BYTES_VAR_SORTED || values.type() == Type.BYTES_FIXED_SORTED) {
|
if(values.getType() == Type.BYTES_VAR_SORTED || values.getType() == Type.BYTES_FIXED_SORTED) {
|
||||||
return values.getSource().asSortedSource();
|
return values.getSource().asSortedSource();
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -562,7 +562,7 @@ public class TestDuelingCodecs extends LuceneTestCase {
|
||||||
public void assertDocValues(DocValues leftDocValues, DocValues rightDocValues) throws Exception {
|
public void assertDocValues(DocValues leftDocValues, DocValues rightDocValues) throws Exception {
|
||||||
assertNotNull(info, leftDocValues);
|
assertNotNull(info, leftDocValues);
|
||||||
assertNotNull(info, rightDocValues);
|
assertNotNull(info, rightDocValues);
|
||||||
assertEquals(info, leftDocValues.type(), rightDocValues.type());
|
assertEquals(info, leftDocValues.getType(), rightDocValues.getType());
|
||||||
assertEquals(info, leftDocValues.getValueSize(), rightDocValues.getValueSize());
|
assertEquals(info, leftDocValues.getValueSize(), rightDocValues.getValueSize());
|
||||||
assertDocValuesSource(leftDocValues.getDirectSource(), rightDocValues.getDirectSource());
|
assertDocValuesSource(leftDocValues.getDirectSource(), rightDocValues.getDirectSource());
|
||||||
assertDocValuesSource(leftDocValues.getSource(), rightDocValues.getSource());
|
assertDocValuesSource(leftDocValues.getSource(), rightDocValues.getSource());
|
||||||
|
@ -572,8 +572,8 @@ public class TestDuelingCodecs extends LuceneTestCase {
|
||||||
* checks source API
|
* checks source API
|
||||||
*/
|
*/
|
||||||
public void assertDocValuesSource(DocValues.Source left, DocValues.Source right) throws Exception {
|
public void assertDocValuesSource(DocValues.Source left, DocValues.Source right) throws Exception {
|
||||||
DocValues.Type leftType = left.type();
|
DocValues.Type leftType = left.getType();
|
||||||
assertEquals(info, leftType, right.type());
|
assertEquals(info, leftType, right.getType());
|
||||||
switch(leftType) {
|
switch(leftType) {
|
||||||
case VAR_INTS:
|
case VAR_INTS:
|
||||||
case FIXED_INTS_8:
|
case FIXED_INTS_8:
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class TestNorms extends LuceneTestCase {
|
||||||
assertNotNull(normValues);
|
assertNotNull(normValues);
|
||||||
Source source = normValues.getSource();
|
Source source = normValues.getSource();
|
||||||
assertTrue(source.hasArray());
|
assertTrue(source.hasArray());
|
||||||
assertEquals(Type.FIXED_INTS_8, normValues.type());
|
assertEquals(Type.FIXED_INTS_8, normValues.getType());
|
||||||
byte[] norms = (byte[]) source.getArray();
|
byte[] norms = (byte[]) source.getArray();
|
||||||
for (int i = 0; i < open.maxDoc(); i++) {
|
for (int i = 0; i < open.maxDoc(); i++) {
|
||||||
Document document = open.document(i);
|
Document document = open.document(i);
|
||||||
|
@ -155,7 +155,7 @@ public class TestNorms extends LuceneTestCase {
|
||||||
assertNotNull(normValues);
|
assertNotNull(normValues);
|
||||||
Source source = normValues.getSource();
|
Source source = normValues.getSource();
|
||||||
assertTrue(source.hasArray());
|
assertTrue(source.hasArray());
|
||||||
assertEquals(Type.FIXED_INTS_8, normValues.type());
|
assertEquals(Type.FIXED_INTS_8, normValues.getType());
|
||||||
byte[] norms = (byte[]) source.getArray();
|
byte[] norms = (byte[]) source.getArray();
|
||||||
for (int i = 0; i < mergedReader.maxDoc(); i++) {
|
for (int i = 0; i < mergedReader.maxDoc(); i++) {
|
||||||
Document document = mergedReader.document(i);
|
Document document = mergedReader.document(i);
|
||||||
|
|
|
@ -349,7 +349,7 @@ public class TestTypePromotion extends LuceneTestCase {
|
||||||
DocValues docValues = children[0].reader().docValues("promote");
|
DocValues docValues = children[0].reader().docValues("promote");
|
||||||
assertNotNull(docValues);
|
assertNotNull(docValues);
|
||||||
assertValues(TestType.Byte, dir, values);
|
assertValues(TestType.Byte, dir, values);
|
||||||
assertEquals(Type.BYTES_VAR_STRAIGHT, docValues.type());
|
assertEquals(Type.BYTES_VAR_STRAIGHT, docValues.getType());
|
||||||
reader.close();
|
reader.close();
|
||||||
dir.close();
|
dir.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class NumericIndexDocValueSource extends ValueSource {
|
||||||
public FunctionValues getValues(Map context, AtomicReaderContext readerContext) throws IOException {
|
public FunctionValues getValues(Map context, AtomicReaderContext readerContext) throws IOException {
|
||||||
final Source source = readerContext.reader().docValues(field)
|
final Source source = readerContext.reader().docValues(field)
|
||||||
.getSource();
|
.getSource();
|
||||||
Type type = source.type();
|
Type type = source.getType();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case FLOAT_32:
|
case FLOAT_32:
|
||||||
case FLOAT_64:
|
case FLOAT_64:
|
||||||
|
|
Loading…
Reference in New Issue