lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Male (JIRA)" <>
Subject [jira] [Commented] (LUCENE-3616) Illegal Field Configurations should throw exceptions
Date Sat, 04 Aug 2012 10:00:02 GMT


Chris Male commented on LUCENE-3616:

bq. In my opinion if i have a ShortDocValuesField, it shouldnt have a setReader method

Agreed.  The setABC() methods are extremely confusing and add another level of validation
(using your example, we have to validate that you're not setting a Reader on a NumericField).

Perhaps we can re-arrange this a little.  If we genuinely feel there there are use cases out
there that we haven't covered with the typed impls and that we don't want to cover, then why
not make a GenericField or something, which is abstract and accepts just name, FieldType and
maybe an Object value.  We can then emphasis in documentation that it is expert only, should
only be subclassed in the extremely rare situations that our typed impls are insufficient,
and won't be validated so buyer-beware kind of thing.  

We can then gut Field down to a very simple abstract class / interface, and promote our typed
impls to being 1st class and the recommended entry points for users.

Of course if we feel we have provided adequate support through the typed impls, then we can
skip straight to the gutting.
> Illegal Field Configurations should throw exceptions
> ----------------------------------------------------
>                 Key: LUCENE-3616
>                 URL:
>             Project: Lucene - Core
>          Issue Type: Bug
>    Affects Versions: 4.0-ALPHA
>            Reporter: Grant Ingersoll
>            Assignee: Michael McCandless
>            Priority: Minor
>         Attachments: LUCENE-3616.patch
> When working on LUCENE-3615, I came across:
> {quote}
> java.lang.IllegalArgumentException: field field is stored but does not have binaryValue,
stringValue nor numericValue
> 	at org.apache.lucene.index.codecs.DefaultStoredFieldsWriter.writeField(
> 	at org.apache.lucene.index.StoredFieldsConsumer.finishDocument(
> 	at org.apache.lucene.index.DocFieldProcessor.finishDocument(
> 	at org.apache.lucene.index.DocumentsWriterPerThread.updateDocument(
> 	at org.apache.lucene.index.DocumentsWriter.updateDocument(
> 	at org.apache.lucene.index.IndexWriter.updateDocument(
> 	at org.apache.lucene.index.IndexWriter.addDocument(
> 	at org.apache.lucene.index.IndexWriter.addDocument(
> 	at org.apache.lucene.index.Test2BTerms.test2BTerms(
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> 	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(
> 	at
> 	at org.junit.runners.model.FrameworkMethod.invokeExplosively(
> 	at org.junit.internal.runners.statements.InvokeMethod.evaluate(
> 	at org.junit.rules.TestWatchman$1.evaluate(
> 	at org.apache.lucene.util.LuceneTestCase$3$1.evaluate(
> 	at org.junit.internal.runners.statements.RunBefores.evaluate(
> 	at org.junit.internal.runners.statements.RunAfters.evaluate(
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(
> 	at org.apache.lucene.util.LuceneTestCaseRunner.runChild(
> 	at org.apache.lucene.util.LuceneTestCaseRunner.runChild(
> 	at org.junit.runners.ParentRunner$
> 	at org.junit.runners.ParentRunner$1.schedule(
> 	at org.junit.runners.ParentRunner.runChildren(
> 	at org.junit.runners.ParentRunner.access$000(
> 	at org.junit.runners.ParentRunner$2.evaluate(
> 	at org.junit.internal.runners.statements.RunBefores.evaluate(
> 	at org.junit.internal.runners.statements.RunAfters.evaluate(
> 	at
> 	at
> 	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(
> 	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(
> 	at com.intellij.rt.execution.junit.JUnitStarter.main(
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(
> 	at com.intellij.rt.execution.application.AppMain.main(
> {quote}
> which is due to the using Textfield.TYPE_STORED when using a TokenStream.  Since this
is an illegal combination, we should throw an exception upon construction of the Field, not
later when actually trying to do the indexing.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message