mirror of https://github.com/apache/lucene.git
fix compile
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4547@1433661 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8ef9811938
commit
63ace26be7
|
@ -23,8 +23,6 @@ import org.apache.lucene.codecs.CodecUtil;
|
|||
import org.apache.lucene.codecs.FieldInfosFormat;
|
||||
import org.apache.lucene.codecs.FieldInfosReader;
|
||||
import org.apache.lucene.codecs.FieldInfosWriter;
|
||||
import org.apache.lucene.index.DocValues; // javadoc
|
||||
import org.apache.lucene.index.DocValues.Type; // javadoc
|
||||
import org.apache.lucene.store.DataOutput; // javadoc
|
||||
|
||||
/**
|
||||
|
@ -72,22 +70,22 @@ import org.apache.lucene.store.DataOutput; // javadoc
|
|||
* <li>DocValuesBits: a byte containing per-document value types. The type
|
||||
* recorded as two four-bit integers, with the high-order bits representing
|
||||
* <code>norms</code> options, and the low-order bits representing
|
||||
* {@link DocValues} options. Each four-bit integer can be decoded as such:
|
||||
* {@code DocValues} options. Each four-bit integer can be decoded as such:
|
||||
* <ul>
|
||||
* <li>0: no DocValues for this field.</li>
|
||||
* <li>1: variable-width signed integers. ({@link Type#VAR_INTS VAR_INTS})</li>
|
||||
* <li>2: 32-bit floating point values. ({@link Type#FLOAT_32 FLOAT_32})</li>
|
||||
* <li>3: 64-bit floating point values. ({@link Type#FLOAT_64 FLOAT_64})</li>
|
||||
* <li>4: fixed-length byte array values. ({@link Type#BYTES_FIXED_STRAIGHT BYTES_FIXED_STRAIGHT})</li>
|
||||
* <li>5: fixed-length dereferenced byte array values. ({@link Type#BYTES_FIXED_DEREF BYTES_FIXED_DEREF})</li>
|
||||
* <li>6: variable-length byte array values. ({@link Type#BYTES_VAR_STRAIGHT BYTES_VAR_STRAIGHT})</li>
|
||||
* <li>7: variable-length dereferenced byte array values. ({@link Type#BYTES_VAR_DEREF BYTES_VAR_DEREF})</li>
|
||||
* <li>8: 16-bit signed integers. ({@link Type#FIXED_INTS_16 FIXED_INTS_16})</li>
|
||||
* <li>9: 32-bit signed integers. ({@link Type#FIXED_INTS_32 FIXED_INTS_32})</li>
|
||||
* <li>10: 64-bit signed integers. ({@link Type#FIXED_INTS_64 FIXED_INTS_64})</li>
|
||||
* <li>11: 8-bit signed integers. ({@link Type#FIXED_INTS_8 FIXED_INTS_8})</li>
|
||||
* <li>12: fixed-length sorted byte array values. ({@link Type#BYTES_FIXED_SORTED BYTES_FIXED_SORTED})</li>
|
||||
* <li>13: variable-length sorted byte array values. ({@link Type#BYTES_VAR_SORTED BYTES_VAR_SORTED})</li>
|
||||
* <li>1: variable-width signed integers. ({@code Type#VAR_INTS VAR_INTS})</li>
|
||||
* <li>2: 32-bit floating point values. ({@code Type#FLOAT_32 FLOAT_32})</li>
|
||||
* <li>3: 64-bit floating point values. ({@code Type#FLOAT_64 FLOAT_64})</li>
|
||||
* <li>4: fixed-length byte array values. ({@code Type#BYTES_FIXED_STRAIGHT BYTES_FIXED_STRAIGHT})</li>
|
||||
* <li>5: fixed-length dereferenced byte array values. ({@code Type#BYTES_FIXED_DEREF BYTES_FIXED_DEREF})</li>
|
||||
* <li>6: variable-length byte array values. ({@code Type#BYTES_VAR_STRAIGHT BYTES_VAR_STRAIGHT})</li>
|
||||
* <li>7: variable-length dereferenced byte array values. ({@code Type#BYTES_VAR_DEREF BYTES_VAR_DEREF})</li>
|
||||
* <li>8: 16-bit signed integers. ({@code Type#FIXED_INTS_16 FIXED_INTS_16})</li>
|
||||
* <li>9: 32-bit signed integers. ({@code Type#FIXED_INTS_32 FIXED_INTS_32})</li>
|
||||
* <li>10: 64-bit signed integers. ({@code Type#FIXED_INTS_64 FIXED_INTS_64})</li>
|
||||
* <li>11: 8-bit signed integers. ({@code Type#FIXED_INTS_8 FIXED_INTS_8})</li>
|
||||
* <li>12: fixed-length sorted byte array values. ({@code Type#BYTES_FIXED_SORTED BYTES_FIXED_SORTED})</li>
|
||||
* <li>13: variable-length sorted byte array values. ({@code Type#BYTES_VAR_SORTED BYTES_VAR_SORTED})</li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* <li>Attributes: a key-value map of codec-private attributes.</li>
|
||||
|
|
|
@ -27,8 +27,8 @@ import org.apache.lucene.index.CorruptIndexException;
|
|||
import org.apache.lucene.index.FieldInfo;
|
||||
import org.apache.lucene.index.FieldInfos;
|
||||
import org.apache.lucene.index.IndexFileNames;
|
||||
import org.apache.lucene.index.FieldInfo.DocValuesType;
|
||||
import org.apache.lucene.index.FieldInfo.IndexOptions;
|
||||
import org.apache.lucene.index.DocValues;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.IOContext;
|
||||
import org.apache.lucene.store.IndexInput;
|
||||
|
@ -89,8 +89,8 @@ public class Lucene40FieldInfosReader extends FieldInfosReader {
|
|||
}
|
||||
// DV Types are packed in one byte
|
||||
byte val = input.readByte();
|
||||
final DocValues.Type docValuesType = getDocValuesType((byte) (val & 0x0F));
|
||||
final DocValues.Type normsType = getDocValuesType((byte) ((val >>> 4) & 0x0F));
|
||||
final DocValuesType docValuesType = getDocValuesTypeFake((byte) (val & 0x0F));
|
||||
final DocValuesType normsType = getDocValuesTypeFake((byte) ((val >>> 4) & 0x0F));
|
||||
final Map<String,String> attributes = input.readStringStringMap();
|
||||
infos[i] = new FieldInfo(name, isIndexed, fieldNumber, storeTermVector,
|
||||
omitNorms, storePayloads, indexOptions, docValuesType, normsType, Collections.unmodifiableMap(attributes));
|
||||
|
@ -110,7 +110,21 @@ public class Lucene40FieldInfosReader extends FieldInfosReader {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static DocValuesType getDocValuesTypeFake(byte b) {
|
||||
if (b == 0) {
|
||||
return null;
|
||||
} else if (b == 1) {
|
||||
return DocValuesType.NUMERIC;
|
||||
} else if (b == 2) {
|
||||
return DocValuesType.BINARY;
|
||||
} else if (b == 3) {
|
||||
return DocValuesType.SORTED;
|
||||
} else {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
/*
|
||||
private static DocValues.Type getDocValuesType(final byte b) {
|
||||
switch(b) {
|
||||
case 0:
|
||||
|
@ -144,5 +158,5 @@ public class Lucene40FieldInfosReader extends FieldInfosReader {
|
|||
default:
|
||||
throw new IllegalStateException("unhandled indexValues type " + b);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.io.IOException;
|
|||
|
||||
import org.apache.lucene.codecs.CodecUtil;
|
||||
import org.apache.lucene.codecs.FieldInfosWriter;
|
||||
import org.apache.lucene.index.DocValues.Type;
|
||||
import org.apache.lucene.index.FieldInfo.DocValuesType;
|
||||
import org.apache.lucene.index.FieldInfo.IndexOptions;
|
||||
import org.apache.lucene.index.FieldInfo;
|
||||
import org.apache.lucene.index.FieldInfos;
|
||||
|
@ -87,8 +87,8 @@ public class Lucene40FieldInfosWriter extends FieldInfosWriter {
|
|||
output.writeByte(bits);
|
||||
|
||||
// pack the DV types in one byte
|
||||
final byte dv = docValuesByte(fi.getDocValuesType());
|
||||
final byte nrm = docValuesByte(fi.getNormType());
|
||||
final byte dv = docValuesByteFake(fi.getDocValuesType());
|
||||
final byte nrm = docValuesByteFake(fi.getNormType());
|
||||
assert (dv & (~0xF)) == 0 && (nrm & (~0x0F)) == 0;
|
||||
byte val = (byte) (0xff & ((nrm << 4) | dv));
|
||||
output.writeByte(val);
|
||||
|
@ -103,9 +103,25 @@ public class Lucene40FieldInfosWriter extends FieldInfosWriter {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** this is not actually how 4.0 wrote this! */
|
||||
// nocommit: make a 4.1 fieldinfos writer
|
||||
public byte docValuesByteFake(DocValuesType type) {
|
||||
if (type == null) {
|
||||
return 0;
|
||||
} else if (type == DocValuesType.NUMERIC) {
|
||||
return 1;
|
||||
} else if (type == DocValuesType.BINARY) {
|
||||
return 2;
|
||||
} else if (type == DocValuesType.SORTED) {
|
||||
return 3;
|
||||
} else {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the byte used to encode the {@link
|
||||
* Type} for each field. */
|
||||
* Type} for each field.
|
||||
public byte docValuesByte(Type type) {
|
||||
if (type == null) {
|
||||
return 0;
|
||||
|
@ -141,6 +157,6 @@ public class Lucene40FieldInfosWriter extends FieldInfosWriter {
|
|||
throw new IllegalStateException("unhandled indexValues type " + type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue