lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: NumericField exception java.lang.IllegalStateException: call set???Value() before usage in lucene 3.5
Date Tue, 27 Mar 2012 07:24:49 GMT
Hi,

Are you sure that you are not reusing the same NumericField instances across
different threads?

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: jianwen lou [mailto:loujanwen@gmail.com]
> Sent: Tuesday, March 27, 2012 9:21 AM
> To: java-user@lucene.apache.org
> Subject: NumericField exception java.lang.IllegalStateException: call
> set???Value() before usage in lucene 3.5
> 
> I want to store the long type value to my index files like follwing:
> 
>                 NumericField priceField = new NumericField("price");
>                 priceField.setDoubleValue(temp.getCurrentprice());
>                 document.add(priceField);
> 
>                 NumericField salesField = new NumericField("salescount");
>                 priceField.setLongValue(temp.getSalescount());
>                 document.add(salesField);
> 
>                 NumericField ontimefiled = new NumericField("ontime");
>                 ontimefiled.setLongValue(temp.getOntime().getTime());
>                 document.add(ontimefiled);
> 
> when writer add document i get the exception info:there is wrong with my
> using NumbericField? thanks
> 
> 
> java.lang.IllegalStateException: call set???Value() before usage
>     at
> org.apache.lucene.analysis.NumericTokenStream.reset(NumericTokenStream.j
> ava:196)
>     at
>
org.apache.lucene.index.DocInverterPerField.processFields(DocInverterPerFiel
d
> .java:130)
>     at
> org.apache.lucene.index.DocFieldProcessorPerThread.processDocument(DocFie
> ldProcessorPerThread.java:278)
>     at
> org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter
> .java:766)
>     at
> org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:2066)
>     at
> com.beike.common.lucene.dao.IndexDaoImpl.saveGoodsIndex4Mobile(IndexDa
> oImpl.java:308)
>     at
> com.beike.common.lucene.dao.IndexStrategyServiceImpl.indexGoods4Mobile(I
> ndexStrategyServiceImpl.java:118)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 39)
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI
> mpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at
>
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(Aop
> Utils.java:307)
>     at
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpo
> int(ReflectiveMethodInvocation.java:182)
>     at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refl
> ectiveMethodInvocation.java:149)
>     at
>
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(Tr
a
> nsactionInterceptor.java:106)
>     at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refl
> ectiveMethodInvocation.java:171)
>     at
>
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(Tr
a
> nsactionInterceptor.java:106)
>     at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refl
> ectiveMethodInvocation.java:171)
>     at
>
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(Tr
a
> nsactionInterceptor.java:106)
>     at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refl
> ectiveMethodInvocation.java:171)
>     at
> com.beike.ds.DataSourceInterceptor.invoke(DataSourceInterceptor.java:42)
>     at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refl
> ectiveMethodInvocation.java:171)
>     at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamic
> AopProxy.java:204)
>     at $Proxy53.indexGoods4Mobile(Unknown Source)
>     at
> com.beike.lucene.test.TestLuceneIndex.initGoodsIndex4Mobile(TestLuceneInde
> x.java:45)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 39)
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI
> mpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at
>
org.springframework.test.context.junit4.SpringTestMethod.invoke(SpringTestM
> ethod.java:160)
>     at
> org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod(S
> pringMethodRoadie.java:233)
>     at
> org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThen
> TestThenAfters.run(SpringMethodRoadie.java:333)
>     at
>
org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitio
> ns(SpringMethodRoadie.java:217)
>     at
> org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringM
> ethodRoadie.java:197)
>     at
> org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMetho
> dRoadie.java:143)
>     at
>
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMe
> thod(SpringJUnit4ClassRunner.java:160)
>     at
>
org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.ja
v
> a:51)
>     at
>
org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44
)
>     at
> org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
>     at
> org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
>     at
>
org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
>     at
>
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJU
n
> it4ClassRunner.java:97)
>     at
>
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestRef
ere
> nce.java:38)
>     at
>
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:3
8)
>     at
>
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
> nner.java:460)
>     at
>
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
> nner.java:673)
>     at
>
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
> java:386)
>     at
>
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunne
> r.java:196)
> 
> 
> 
> --
> *
> *twitter.com/loujianwen


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message