mirror of https://github.com/apache/lucene.git
LUCENE-3684: use UOE not IAE
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1231799 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
87bc4521c2
commit
57adb4371a
|
@ -156,7 +156,7 @@ public final class Lucene40PostingsWriter extends PostingsWriterBase {
|
||||||
this.fieldInfo = fieldInfo;
|
this.fieldInfo = fieldInfo;
|
||||||
indexOptions = fieldInfo.indexOptions;
|
indexOptions = fieldInfo.indexOptions;
|
||||||
if (indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) {
|
if (indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) {
|
||||||
throw new IllegalArgumentException("this codec cannot index offsets");
|
throw new UnsupportedOperationException("this codec cannot index offsets");
|
||||||
}
|
}
|
||||||
|
|
||||||
storePayloads = fieldInfo.storePayloads;
|
storePayloads = fieldInfo.storePayloads;
|
||||||
|
|
|
@ -254,7 +254,7 @@ public class MemoryPostingsFormat extends PostingsFormat {
|
||||||
@Override
|
@Override
|
||||||
public TermsConsumer addField(FieldInfo field) {
|
public TermsConsumer addField(FieldInfo field) {
|
||||||
if (field.indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) {
|
if (field.indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) {
|
||||||
throw new IllegalArgumentException("this codec cannot index offsets");
|
throw new UnsupportedOperationException("this codec cannot index offsets");
|
||||||
}
|
}
|
||||||
if (VERBOSE) System.out.println("\naddField field=" + field.name);
|
if (VERBOSE) System.out.println("\naddField field=" + field.name);
|
||||||
return new TermsWriter(out, field);
|
return new TermsWriter(out, field);
|
||||||
|
|
|
@ -116,7 +116,7 @@ public final class PulsingPostingsWriter extends PostingsWriterBase {
|
||||||
public void setField(FieldInfo fieldInfo) {
|
public void setField(FieldInfo fieldInfo) {
|
||||||
this.indexOptions = fieldInfo.indexOptions;
|
this.indexOptions = fieldInfo.indexOptions;
|
||||||
if (indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) {
|
if (indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) {
|
||||||
throw new IllegalArgumentException("this codec cannot index offsets: " + indexOptions);
|
throw new UnsupportedOperationException("this codec cannot index offsets: " + indexOptions);
|
||||||
}
|
}
|
||||||
if (DEBUG) System.out.println("PW field=" + fieldInfo.name + " indexOptions=" + indexOptions);
|
if (DEBUG) System.out.println("PW field=" + fieldInfo.name + " indexOptions=" + indexOptions);
|
||||||
storePayloads = fieldInfo.storePayloads;
|
storePayloads = fieldInfo.storePayloads;
|
||||||
|
|
|
@ -189,7 +189,7 @@ public final class SepPostingsWriter extends PostingsWriterBase {
|
||||||
this.fieldInfo = fieldInfo;
|
this.fieldInfo = fieldInfo;
|
||||||
this.indexOptions = fieldInfo.indexOptions;
|
this.indexOptions = fieldInfo.indexOptions;
|
||||||
if (indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) {
|
if (indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) {
|
||||||
throw new IllegalArgumentException("this codec cannot index offsets");
|
throw new UnsupportedOperationException("this codec cannot index offsets");
|
||||||
}
|
}
|
||||||
skipListWriter.setIndexOptions(indexOptions);
|
skipListWriter.setIndexOptions(indexOptions);
|
||||||
storePayloads = indexOptions == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS && fieldInfo.storePayloads;
|
storePayloads = indexOptions == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS && fieldInfo.storePayloads;
|
||||||
|
|
|
@ -89,7 +89,7 @@ class PreFlexFieldsWriter extends FieldsConsumer {
|
||||||
public TermsConsumer addField(FieldInfo field) throws IOException {
|
public TermsConsumer addField(FieldInfo field) throws IOException {
|
||||||
assert field.number != -1;
|
assert field.number != -1;
|
||||||
if (field.indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) {
|
if (field.indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) {
|
||||||
throw new IllegalArgumentException("this codec cannot index offsets");
|
throw new UnsupportedOperationException("this codec cannot index offsets");
|
||||||
}
|
}
|
||||||
//System.out.println("w field=" + field.name + " storePayload=" + field.storePayloads + " number=" + field.number);
|
//System.out.println("w field=" + field.name + " storePayload=" + field.storePayloads + " number=" + field.number);
|
||||||
return new PreFlexTermsWriter(field);
|
return new PreFlexTermsWriter(field);
|
||||||
|
|
|
@ -199,7 +199,7 @@ public class RAMOnlyPostingsFormat extends PostingsFormat {
|
||||||
@Override
|
@Override
|
||||||
public TermsConsumer addField(FieldInfo field) {
|
public TermsConsumer addField(FieldInfo field) {
|
||||||
if (field.indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) {
|
if (field.indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) {
|
||||||
throw new IllegalArgumentException("this codec cannot index offsets");
|
throw new UnsupportedOperationException("this codec cannot index offsets");
|
||||||
}
|
}
|
||||||
RAMField ramField = new RAMField(field.name);
|
RAMField ramField = new RAMField(field.name);
|
||||||
postings.fieldToTerms.put(field.name, ramField);
|
postings.fieldToTerms.put(field.name, ramField);
|
||||||
|
|
Loading…
Reference in New Issue