Index: src/java/org/apache/lucene/document/Field.java
===================================================================
--- src/java/org/apache/lucene/document/Field.java (revision 892743)
+++ src/java/org/apache/lucene/document/Field.java (working copy)
@@ -521,9 +521,11 @@
*
* @param name The name of the field
* @param value The binary value
- * @param store How value should be stored (compressed or not)
+ * @param store Must be Store.YES
* @throws IllegalArgumentException if store is Store.NO
+ * @deprecated Use {@link #Field(String, byte[]) instead}
*/
+ @Deprecated
public Field(String name, byte[] value, Store store) {
this(name, value, 0, value.length, store);
}
@@ -533,13 +535,40 @@
*
* @param name The name of the field
* @param value The binary value
+ */
+ public Field(String name, byte[] value) {
+ this(name, value, 0, value.length, Store.YES);
+ }
+
+ /**
+ * Create a stored field with binary value. Optionally the value may be compressed.
+ *
+ * @param name The name of the field
+ * @param value The binary value
* @param offset Starting offset in value where this Field's bytes are
* @param length Number of bytes to use for this Field, starting at offset
* @param store How value should be stored (compressed or not)
* @throws IllegalArgumentException if store is Store.NO
+ * @deprecated Use {@link #Field(String, byte[], int, int) instead}
*/
+ @Deprecated
public Field(String name, byte[] value, int offset, int length, Store store) {
+ this(name, value, offset, length);
+ if (store == Store.NO)
+ throw new IllegalArgumentException("binary values can't be unstored");
+ }
+
+ /**
+ * Create a stored field with binary value. Optionally the value may be compressed.
+ *
+ * @param name The name of the field
+ * @param value The binary value
+ * @param offset Starting offset in value where this Field's bytes are
+ * @param length Number of bytes to use for this Field, starting at offset
+ */
+ public Field(String name, byte[] value, int offset, int length) {
+
if (name == null)
throw new IllegalArgumentException("name cannot be null");
if (value == null)
@@ -548,10 +577,7 @@
this.name = StringHelper.intern(name); // field names are interned
fieldsData = value;
- if (store == Store.NO)
- throw new IllegalArgumentException("binary values can't be unstored");
-
- isStored = store.isStored();
+ isStored = true;
isIndexed = false;
isTokenized = false;
omitTermFreqAndPositions = false;