Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-User

NumericField exception java.lang.IllegalStateException: call set???Value() before usage in lucene 3.5

 

 

Lucene java-user RSS feed   Index | Next | Previous | View Threaded


loujanwen at gmail

Mar 27, 2012, 12:21 AM

Post #1 of 10 (315 views)
Permalink
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.java:196)
at
org.apache.lucene.index.DocInverterPerField.processFields(DocInverterPerField.java:130)
at
org.apache.lucene.index.DocFieldProcessorPerThread.processDocument(DocFieldProcessorPerThread.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(IndexDaoImpl.java:308)
at
com.beike.common.lucene.dao.IndexStrategyServiceImpl.indexGoods4Mobile(IndexStrategyServiceImpl.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at
com.beike.ds.DataSourceInterceptor.invoke(DataSourceInterceptor.java:42)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy53.indexGoods4Mobile(Unknown Source)
at
com.beike.lucene.test.TestLuceneIndex.initGoodsIndex4Mobile(TestLuceneIndex.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.springframework.test.context.junit4.SpringTestMethod.invoke(SpringTestMethod.java:160)
at
org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod(SpringMethodRoadie.java:233)
at
org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThenTestThenAfters.run(SpringMethodRoadie.java:333)
at
org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie.java:217)
at
org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:197)
at
org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:143)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:160)
at
org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java: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(SpringJUnit4ClassRunner.java:97)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)



--
*
*twitter.com/loujianwen


uwe at thetaphi

Mar 27, 2012, 12:24 AM

Post #2 of 10 (313 views)
Permalink
RE: NumericField exception java.lang.IllegalStateException: call set???Value() before usage in lucene 3.5 [In reply to]

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 [at] thetaphi


> -----Original Message-----
> From: jianwen lou [mailto:loujanwen [at] gmail]
> Sent: Tuesday, March 27, 2012 9:21 AM
> To: java-user [at] lucene
> 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 [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


loujanwen at gmail

Mar 27, 2012, 12:48 AM

Post #3 of 10 (310 views)
Permalink
Re: NumericField exception java.lang.IllegalStateException: call set???Value() before usage in lucene 3.5 [In reply to]

No,There is no multi-thread building index at same time,
I google and get the result, i use 64 bit jvm. It matters?

http://lucene.472066.n3.nabble.com/Lucene-3-4-shift-bug-in-possibly-invalid-use-of-NumericTokenStream-td3592962.html

F:\Java\open-source\lucene>java -version
java version "1.6.0_25"
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.0-b11, mixed mode)


On Tue, Mar 27, 2012 at 3:24 PM, Uwe Schindler <uwe [at] thetaphi> wrote:

> 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 [at] thetaphi
>
>
> > -----Original Message-----
> > From: jianwen lou [mailto:loujanwen [at] gmail]
> > Sent: Tuesday, March 27, 2012 9:21 AM
> > To: java-user [at] lucene
> > 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 [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>
>


--
*
*twitter.com/loujianwen


loujanwen at gmail

Mar 27, 2012, 12:56 AM

Post #4 of 10 (308 views)
Permalink
Re: NumericField exception java.lang.IllegalStateException: call set???Value() before usage in lucene 3.5 [In reply to]

I am not exactly understand the precisionStep arg,I need to add the arg?

On Tue, Mar 27, 2012 at 3:48 PM, jianwen lou <loujanwen [at] gmail> wrote:

> No,There is no multi-thread building index at same time,
> I google and get the result, i use 64 bit jvm. It matters?
>
>
> http://lucene.472066.n3.nabble.com/Lucene-3-4-shift-bug-in-possibly-invalid-use-of-NumericTokenStream-td3592962.html
>
> F:\Java\open-source\lucene>java -version
> java version "1.6.0_25"
> Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
> Java HotSpot(TM) 64-Bit Server VM (build 20.0-b11, mixed mode)
>
>
>
> On Tue, Mar 27, 2012 at 3:24 PM, Uwe Schindler <uwe [at] thetaphi> wrote:
>
>> 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 [at] thetaphi
>>
>>
>> > -----Original Message-----
>> > From: jianwen lou [mailto:loujanwen [at] gmail]
>> > Sent: Tuesday, March 27, 2012 9:21 AM
>> > To: java-user [at] lucene
>> > 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 [at] lucene
>> For additional commands, e-mail: java-user-help [at] lucene
>>
>>
>
>
> --
> *
> *twitter.com/loujianwen
>
>


--
*
*twitter.com/loujianwen


uwe at thetaphi

Mar 27, 2012, 2:31 AM

Post #5 of 10 (308 views)
Permalink
RE: NumericField exception java.lang.IllegalStateException: call set???Value() before usage in lucene 3.5 [In reply to]

The bug mentioned in this link was a multithread bug (what I asked you). If
you reuse Documents and Fields this can happen, otherwise not. This code is
heavily tested and the code you sent cannot fail. Maybe its different to the
one you actually use?

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


> -----Original Message-----
> From: jianwen lou [mailto:loujanwen [at] gmail]
> Sent: Tuesday, March 27, 2012 9:49 AM
> To: java-user [at] lucene
> Subject: Re: NumericField exception java.lang.IllegalStateException: call
> set???Value() before usage in lucene 3.5
>
> No,There is no multi-thread building index at same time, I google and get
the
> result, i use 64 bit jvm. It matters?
>
>
http://lucene.472066.n3.nabble.com/Lucene-3-4-shift-bug-in-possibly-invalid-
> use-of-NumericTokenStream-td3592962.html
>
> F:\Java\open-source\lucene>java -version java version "1.6.0_25"
> Java(TM) SE Runtime Environment (build 1.6.0_25-b06) Java HotSpot(TM) 64-
> Bit Server VM (build 20.0-b11, mixed mode)
>
>
> On Tue, Mar 27, 2012 at 3:24 PM, Uwe Schindler <uwe [at] thetaphi> wrote:
>
> > 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 [at] thetaphi
> >
> >
> > > -----Original Message-----
> > > From: jianwen lou [mailto:loujanwen [at] gmail]
> > > Sent: Tuesday, March 27, 2012 9:21 AM
> > > To: java-user [at] lucene
> > > 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(NumericTokenStre
> > > am.j
> > > ava:196)
> > > at
> > >
> >
> > org.apache.lucene.index.DocInverterPerField.processFields(DocInverterP
> > erFiel
> > d
> > > .java:130)
> > > at
> > > org.apache.lucene.index.DocFieldProcessorPerThread.processDocument(D
> > > ocFie
> > > ldProcessorPerThread.java:278)
> > > at
> > >
> org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWrit
> > > er
> > > .java:766)
> > > at
> > > org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:2066)
> > > at
> > >
> com.beike.common.lucene.dao.IndexDaoImpl.saveGoodsIndex4Mobile(Index
> > > Da
> > > oImpl.java:308)
> > > at
> > > com.beike.common.lucene.dao.IndexStrategyServiceImpl.indexGoods4Mobi
> > > le(I
> > > ndexStrategyServiceImpl.java:118)
> > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > at
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > > 39)
> > > at
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
> > > ssorI
> > > mpl.java:25)
> > > at java.lang.reflect.Method.invoke(Method.java:597)
> > > at
> > >
> > org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflectio
> > n(Aop
> > > Utils.java:307)
> > > at
> > > org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJ
> > > oinpo
> > > int(ReflectiveMethodInvocation.java:182)
> > > at
> > > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
> > > (Refl
> > > ectiveMethodInvocation.java:149)
> > > at
> > >
> >
> > org.springframework.transaction.interceptor.TransactionInterceptor.inv
> > oke(Tr
> > a
> > > nsactionInterceptor.java:106)
> > > at
> > > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
> > > (Refl
> > > ectiveMethodInvocation.java:171)
> > > at
> > >
> >
> > org.springframework.transaction.interceptor.TransactionInterceptor.inv
> > oke(Tr
> > a
> > > nsactionInterceptor.java:106)
> > > at
> > > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
> > > (Refl
> > > ectiveMethodInvocation.java:171)
> > > at
> > >
> >
> > org.springframework.transaction.interceptor.TransactionInterceptor.inv
> > oke(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(JdkDynam
> > > ic
> > > AopProxy.java:204)
> > > at $Proxy53.indexGoods4Mobile(Unknown Source)
> > > at
> > >
> > com.beike.lucene.test.TestLuceneIndex.initGoodsIndex4Mobile(TestLucene
> > Inde
> > > x.java:45)
> > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > at
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > > 39)
> > > at
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
> > > ssorI
> > > mpl.java:25)
> > > at java.lang.reflect.Method.invoke(Method.java:597)
> > > at
> > >
> > org.springframework.test.context.junit4.SpringTestMethod.invoke(Spring
> > TestM
> > > ethod.java:160)
> > > at
> > >
> > org.springframework.test.context.junit4.SpringMethodRoadie.runTestMeth
> > od(S
> > > pringMethodRoadie.java:233)
> > > at
> > > org.springframework.test.context.junit4.SpringMethodRoadie$RunBefore
> > > sThen
> > > TestThenAfters.run(SpringMethodRoadie.java:333)
> > > at
> > >
> > org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepe
> > titio
> > > ns(SpringMethodRoadie.java:217)
> > > at
> > >
> > org.springframework.test.context.junit4.SpringMethodRoadie.runTest(Spr
> > ingM
> > > ethodRoadie.java:197)
> > > at
> > >
> > org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringM
> > etho
> > > dRoadie.java:143)
> > > at
> > >
> >
> > org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invoke
> > TestMe
> > > thod(SpringJUnit4ClassRunner.java:160)
> > > at
> > >
> >
> > org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRun
> > ner.ja
> > v
> > > a:51)
> > > at
> > >
> >
> > org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.j
> > ava: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.jav
> > a:42)
> > > at
> > >
> >
> > org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(Sp
> > ringJU
> > n
> > > it4ClassRunner.java:97)
> > > at
> > >
> >
> > org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4T
> > estRef
> > 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(Remote
> > TestRu
> > > nner.java:460)
> > > at
> > >
> >
> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(Remote
> > TestRu
> > > nner.java:673)
> > > at
> > >
> >
> >
>
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
> > > java:386)
> > > at
> > >
> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTest
> > Runne
> > > r.java:196)
> > >
> > >
> > >
> > > --
> > > *
> > > *twitter.com/loujianwen
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
> > For additional commands, e-mail: java-user-help [at] lucene
> >
> >
>
>
> --
> *
> *twitter.com/loujianwen


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


uwe at thetaphi

Mar 27, 2012, 2:33 AM

Post #6 of 10 (302 views)
Permalink
RE: NumericField exception java.lang.IllegalStateException: call set???Value() before usage in lucene 3.5 [In reply to]

Hi,

> I am not exactly understand the precisionStep arg,I need to add the arg?

RTFM: http://goo.gl/PlhhO

> On Tue, Mar 27, 2012 at 3:48 PM, jianwen lou <loujanwen [at] gmail> wrote:
>
> > No,There is no multi-thread building index at same time, I google and
> > get the result, i use 64 bit jvm. It matters?
> >
> >
> > http://lucene.472066.n3.nabble.com/Lucene-3-4-shift-bug-in-possibly-in
> > valid-use-of-NumericTokenStream-td3592962.html
> >
> > F:\Java\open-source\lucene>java -version java version "1.6.0_25"
> > Java(TM) SE Runtime Environment (build 1.6.0_25-b06) Java HotSpot(TM)
> > 64-Bit Server VM (build 20.0-b11, mixed mode)
> >
> >
> >
> > On Tue, Mar 27, 2012 at 3:24 PM, Uwe Schindler <uwe [at] thetaphi> wrote:
> >
> >> 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 [at] thetaphi
> >>
> >>
> >> > -----Original Message-----
> >> > From: jianwen lou [mailto:loujanwen [at] gmail]
> >> > Sent: Tuesday, March 27, 2012 9:21 AM
> >> > To: java-user [at] lucene
> >> > 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(NumericTokenStr
> >> > eam.j
> >> > ava:196)
> >> > at
> >> >
> >>
> >> org.apache.lucene.index.DocInverterPerField.processFields(DocInverter
> >> PerFiel
> >> d
> >> > .java:130)
> >> > at
> >> >
> >> org.apache.lucene.index.DocFieldProcessorPerThread.processDocument(Do
> >> cFie
> >> > ldProcessorPerThread.java:278)
> >> > at
> >> >
> org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWri
> >> > ter
> >> > .java:766)
> >> > at
> >> >
> org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:2066)
> >> > at
> >> >
> com.beike.common.lucene.dao.IndexDaoImpl.saveGoodsIndex4Mobile(Inde
> >> > xDa
> >> > oImpl.java:308)
> >> > at
> >> >
> com.beike.common.lucene.dao.IndexStrategyServiceImpl.indexGoods4Mob
> >> > ile(I
> >> > ndexStrategyServiceImpl.java:118)
> >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> > at
> >> >
> >>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> >> > 39)
> >> > at
> >> >
> >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> >> sorI
> >> > mpl.java:25)
> >> > at java.lang.reflect.Method.invoke(Method.java:597)
> >> > at
> >> >
> >>
> >> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
> >> on(Aop
> >> > Utils.java:307)
> >> > at
> >> >
> >> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
> >> inpo
> >> > int(ReflectiveMethodInvocation.java:182)
> >> > at
> >> >
> >> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
> >> Refl
> >> > ectiveMethodInvocation.java:149)
> >> > at
> >> >
> >>
> >> org.springframework.transaction.interceptor.TransactionInterceptor.in
> >> voke(Tr
> >> a
> >> > nsactionInterceptor.java:106)
> >> > at
> >> >
> >> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
> >> Refl
> >> > ectiveMethodInvocation.java:171)
> >> > at
> >> >
> >>
> >> org.springframework.transaction.interceptor.TransactionInterceptor.in
> >> voke(Tr
> >> a
> >> > nsactionInterceptor.java:106)
> >> > at
> >> >
> >> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
> >> Refl
> >> > ectiveMethodInvocation.java:171)
> >> > at
> >> >
> >>
> >> org.springframework.transaction.interceptor.TransactionInterceptor.in
> >> voke(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(JdkDyna
> >> > mic
> >> > AopProxy.java:204)
> >> > at $Proxy53.indexGoods4Mobile(Unknown Source)
> >> > at
> >> >
> >> com.beike.lucene.test.TestLuceneIndex.initGoodsIndex4Mobile(TestLucen
> >> eInde
> >> > x.java:45)
> >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> > at
> >> >
> >>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> >> > 39)
> >> > at
> >> >
> >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> >> sorI
> >> > mpl.java:25)
> >> > at java.lang.reflect.Method.invoke(Method.java:597)
> >> > at
> >> >
> >>
> >> org.springframework.test.context.junit4.SpringTestMethod.invoke(Sprin
> >> gTestM
> >> > ethod.java:160)
> >> > at
> >> >
> >> org.springframework.test.context.junit4.SpringMethodRoadie.runTestMet
> >> hod(S
> >> > pringMethodRoadie.java:233)
> >> > at
> >> >
> >> org.springframework.test.context.junit4.SpringMethodRoadie$RunBefores
> >> Then
> >> > TestThenAfters.run(SpringMethodRoadie.java:333)
> >> > at
> >> >
> >>
> >> org.springframework.test.context.junit4.SpringMethodRoadie.runWithRep
> >> etitio
> >> > ns(SpringMethodRoadie.java:217)
> >> > at
> >> >
> >> org.springframework.test.context.junit4.SpringMethodRoadie.runTest(Sp
> >> ringM
> >> > ethodRoadie.java:197)
> >> > at
> >> >
> >> org.springframework.test.context.junit4.SpringMethodRoadie.run(Spring
> >> Metho
> >> > dRoadie.java:143)
> >> > at
> >> >
> >>
> >> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invok
> >> eTestMe
> >> > thod(SpringJUnit4ClassRunner.java:160)
> >> > at
> >> >
> >>
> >> org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRu
> >> nner.ja
> >> v
> >> > a:51)
> >> > at
> >> >
> >>
> >> org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.
> >> java:44
> >> )
> >> > at
> >> >
> >> org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.jav
> >> a:27)
> >> > at
> >> >
org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
> >> > at
> >> >
> >>
> >> org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.ja
> >> va:42)
> >> > at
> >> >
> >>
> >> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(S
> >> pringJU
> >> n
> >> > it4ClassRunner.java:97)
> >> > at
> >> >
> >>
> >> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4
> >> TestRef
> >> 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(Remot
> >> eTestRu
> >> > nner.java:460)
> >> > at
> >> >
> >>
> >> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(Remot
> >> eTestRu
> >> > nner.java:673)
> >> > at
> >> >
> >>
> >>
>
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
> >> > java:386)
> >> > at
> >> >
> >>
> >> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTes
> >> tRunne
> >> > r.java:196)
> >> >
> >> >
> >> >
> >> > --
> >> > *
> >> > *twitter.com/loujianwen
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
> >> For additional commands, e-mail: java-user-help [at] lucene
> >>
> >>
> >
> >
> > --
> > *
> > *twitter.com/loujianwen
> >
> >
>
>
> --
> *
> *twitter.com/loujianwen


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


loujanwen at gmail

Mar 27, 2012, 3:09 AM

Post #7 of 10 (300 views)
Permalink
Re: NumericField exception java.lang.IllegalStateException: call set???Value() before usage in lucene 3.5 [In reply to]

It seems that the Analyzer i used in my project is the problem.I use
CJKAnalyzer,I am not exactly understand the lucene analysis and tokenizer
process .Is there other way to do this:
I want to store numbers and date time in the lucene filed and to use the
filed to filter and range the search,thanks

On Tue, Mar 27, 2012 at 5:31 PM, Uwe Schindler <uwe [at] thetaphi> wrote:

> The bug mentioned in this link was a multithread bug (what I asked you). If
> you reuse Documents and Fields this can happen, otherwise not. This code is
> heavily tested and the code you sent cannot fail. Maybe its different to
> the
> one you actually use?
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe [at] thetaphi
>
>
> > -----Original Message-----
> > From: jianwen lou [mailto:loujanwen [at] gmail]
> > Sent: Tuesday, March 27, 2012 9:49 AM
> > To: java-user [at] lucene
> > Subject: Re: NumericField exception java.lang.IllegalStateException: call
> > set???Value() before usage in lucene 3.5
> >
> > No,There is no multi-thread building index at same time, I google and get
> the
> > result, i use 64 bit jvm. It matters?
> >
> >
>
> http://lucene.472066.n3.nabble.com/Lucene-3-4-shift-bug-in-possibly-invalid-
> > use-of-NumericTokenStream-td3592962.html
> >
> > F:\Java\open-source\lucene>java -version java version "1.6.0_25"
> > Java(TM) SE Runtime Environment (build 1.6.0_25-b06) Java HotSpot(TM) 64-
> > Bit Server VM (build 20.0-b11, mixed mode)
> >
> >
> > On Tue, Mar 27, 2012 at 3:24 PM, Uwe Schindler <uwe [at] thetaphi> wrote:
> >
> > > 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 [at] thetaphi
> > >
> > >
> > > > -----Original Message-----
> > > > From: jianwen lou [mailto:loujanwen [at] gmail]
> > > > Sent: Tuesday, March 27, 2012 9:21 AM
> > > > To: java-user [at] lucene
> > > > 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(NumericTokenStre
> > > > am.j
> > > > ava:196)
> > > > at
> > > >
> > >
> > > org.apache.lucene.index.DocInverterPerField.processFields(DocInverterP
> > > erFiel
> > > d
> > > > .java:130)
> > > > at
> > > > org.apache.lucene.index.DocFieldProcessorPerThread.processDocument(D
> > > > ocFie
> > > > ldProcessorPerThread.java:278)
> > > > at
> > > >
> > org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWrit
> > > > er
> > > > .java:766)
> > > > at
> > > >
> org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:2066)
> > > > at
> > > >
> > com.beike.common.lucene.dao.IndexDaoImpl.saveGoodsIndex4Mobile(Index
> > > > Da
> > > > oImpl.java:308)
> > > > at
> > > > com.beike.common.lucene.dao.IndexStrategyServiceImpl.indexGoods4Mobi
> > > > le(I
> > > > ndexStrategyServiceImpl.java:118)
> > > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > > at
> > > >
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > > > 39)
> > > > at
> > > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
> > > > ssorI
> > > > mpl.java:25)
> > > > at java.lang.reflect.Method.invoke(Method.java:597)
> > > > at
> > > >
> > > org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflectio
> > > n(Aop
> > > > Utils.java:307)
> > > > at
> > > > org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJ
> > > > oinpo
> > > > int(ReflectiveMethodInvocation.java:182)
> > > > at
> > > > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
> > > > (Refl
> > > > ectiveMethodInvocation.java:149)
> > > > at
> > > >
> > >
> > > org.springframework.transaction.interceptor.TransactionInterceptor.inv
> > > oke(Tr
> > > a
> > > > nsactionInterceptor.java:106)
> > > > at
> > > > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
> > > > (Refl
> > > > ectiveMethodInvocation.java:171)
> > > > at
> > > >
> > >
> > > org.springframework.transaction.interceptor.TransactionInterceptor.inv
> > > oke(Tr
> > > a
> > > > nsactionInterceptor.java:106)
> > > > at
> > > > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
> > > > (Refl
> > > > ectiveMethodInvocation.java:171)
> > > > at
> > > >
> > >
> > > org.springframework.transaction.interceptor.TransactionInterceptor.inv
> > > oke(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(JdkDynam
> > > > ic
> > > > AopProxy.java:204)
> > > > at $Proxy53.indexGoods4Mobile(Unknown Source)
> > > > at
> > > >
> > > com.beike.lucene.test.TestLuceneIndex.initGoodsIndex4Mobile(TestLucene
> > > Inde
> > > > x.java:45)
> > > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > > at
> > > >
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > > > 39)
> > > > at
> > > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
> > > > ssorI
> > > > mpl.java:25)
> > > > at java.lang.reflect.Method.invoke(Method.java:597)
> > > > at
> > > >
> > > org.springframework.test.context.junit4.SpringTestMethod.invoke(Spring
> > > TestM
> > > > ethod.java:160)
> > > > at
> > > >
> > > org.springframework.test.context.junit4.SpringMethodRoadie.runTestMeth
> > > od(S
> > > > pringMethodRoadie.java:233)
> > > > at
> > > > org.springframework.test.context.junit4.SpringMethodRoadie$RunBefore
> > > > sThen
> > > > TestThenAfters.run(SpringMethodRoadie.java:333)
> > > > at
> > > >
> > > org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepe
> > > titio
> > > > ns(SpringMethodRoadie.java:217)
> > > > at
> > > >
> > > org.springframework.test.context.junit4.SpringMethodRoadie.runTest(Spr
> > > ingM
> > > > ethodRoadie.java:197)
> > > > at
> > > >
> > > org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringM
> > > etho
> > > > dRoadie.java:143)
> > > > at
> > > >
> > >
> > > org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invoke
> > > TestMe
> > > > thod(SpringJUnit4ClassRunner.java:160)
> > > > at
> > > >
> > >
> > > org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRun
> > > ner.ja
> > > v
> > > > a:51)
> > > > at
> > > >
> > >
> > > org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.j
> > > ava: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.jav
> > > a:42)
> > > > at
> > > >
> > >
> > > org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(Sp
> > > ringJU
> > > n
> > > > it4ClassRunner.java:97)
> > > > at
> > > >
> > >
> > > org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4T
> > > estRef
> > > 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(Remote
> > > TestRu
> > > > nner.java:460)
> > > > at
> > > >
> > >
> > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(Remote
> > > TestRu
> > > > nner.java:673)
> > > > at
> > > >
> > >
> > >
> >
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
> > > > java:386)
> > > > at
> > > >
> > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTest
> > > Runne
> > > > r.java:196)
> > > >
> > > >
> > > >
> > > > --
> > > > *
> > > > *twitter.com/loujianwen
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
> > > For additional commands, e-mail: java-user-help [at] lucene
> > >
> > >
> >
> >
> > --
> > *
> > *twitter.com/loujianwen
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>
>


--
*
*twitter.com/loujianwen


erickerickson at gmail

Mar 27, 2012, 5:40 AM

Post #8 of 10 (300 views)
Permalink
Re: NumericField exception java.lang.IllegalStateException: call set???Value() before usage in lucene 3.5 [In reply to]

I'll, of course, defer to Uwe for technical Lucene issues, but you've
got a copy/paste error it looks like. I doubt it's the root of your
problem, but this code reuses priceField, it seems like
you intend the second to use salesField....

NumericField priceField = new NumericField("price");
priceField.setDoubleValue(temp.getCurrentprice())
document.add(priceField);

NumericField salesField = new NumericField("salescount");
priceField.setLongValue(temp.getSalescount());
document.add(salesField);


On Tue, Mar 27, 2012 at 6:09 AM, jianwen lou <loujanwen [at] gmail> wrote:
> It seems that the Analyzer i used in my project is the problem.I use
> CJKAnalyzer,I am not exactly understand the lucene analysis and tokenizer
> process .Is there other way to do this:
> I want to store numbers and date time in the lucene filed and to use the
> filed to filter and range the search,thanks
>
> On Tue, Mar 27, 2012 at 5:31 PM, Uwe Schindler <uwe [at] thetaphi> wrote:
>
>> The bug mentioned in this link was a multithread bug (what I asked you). If
>> you reuse Documents and Fields this can happen, otherwise not. This code is
>> heavily tested and the code you sent cannot fail. Maybe its different to
>> the
>> one you actually use?
>>
>> -----
>> Uwe Schindler
>> H.-H.-Meier-Allee 63, D-28213 Bremen
>> http://www.thetaphi.de
>> eMail: uwe [at] thetaphi
>>
>>
>> > -----Original Message-----
>> > From: jianwen lou [mailto:loujanwen [at] gmail]
>> > Sent: Tuesday, March 27, 2012 9:49 AM
>> > To: java-user [at] lucene
>> > Subject: Re: NumericField exception java.lang.IllegalStateException: call
>> > set???Value() before usage in lucene 3.5
>> >
>> > No,There is no multi-thread building index at same time, I google and get
>> the
>> > result, i use 64 bit jvm. It matters?
>> >
>> >
>>
>> http://lucene.472066.n3.nabble.com/Lucene-3-4-shift-bug-in-possibly-invalid-
>> > use-of-NumericTokenStream-td3592962.html
>> >
>> > F:\Java\open-source\lucene>java -version java version "1.6.0_25"
>> > Java(TM) SE Runtime Environment (build 1.6.0_25-b06) Java HotSpot(TM) 64-
>> > Bit Server VM (build 20.0-b11, mixed mode)
>> >
>> >
>> > On Tue, Mar 27, 2012 at 3:24 PM, Uwe Schindler <uwe [at] thetaphi> wrote:
>> >
>> > > 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 [at] thetaphi
>> > >
>> > >
>> > > > -----Original Message-----
>> > > > From: jianwen lou [mailto:loujanwen [at] gmail]
>> > > > Sent: Tuesday, March 27, 2012 9:21 AM
>> > > > To: java-user [at] lucene
>> > > > 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(NumericTokenStre
>> > > > am.j
>> > > > ava:196)
>> > > >     at
>> > > >
>> > >
>> > > org.apache.lucene.index.DocInverterPerField.processFields(DocInverterP
>> > > erFiel
>> > > d
>> > > > .java:130)
>> > > >     at
>> > > > org.apache.lucene.index.DocFieldProcessorPerThread.processDocument(D
>> > > > ocFie
>> > > > ldProcessorPerThread.java:278)
>> > > >     at
>> > > >
>> > org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWrit
>> > > > er
>> > > > .java:766)
>> > > >     at
>> > > >
>> org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:2066)
>> > > >     at
>> > > >
>> > com.beike.common.lucene.dao.IndexDaoImpl.saveGoodsIndex4Mobile(Index
>> > > > Da
>> > > > oImpl.java:308)
>> > > >     at
>> > > > com.beike.common.lucene.dao.IndexStrategyServiceImpl.indexGoods4Mobi
>> > > > le(I
>> > > > ndexStrategyServiceImpl.java:118)
>> > > >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> > > >     at
>> > > >
>> > >
>> >
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
>> > > > 39)
>> > > >     at
>> > > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
>> > > > ssorI
>> > > > mpl.java:25)
>> > > >     at java.lang.reflect.Method.invoke(Method.java:597)
>> > > >     at
>> > > >
>> > > org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflectio
>> > > n(Aop
>> > > > Utils.java:307)
>> > > >     at
>> > > > org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJ
>> > > > oinpo
>> > > > int(ReflectiveMethodInvocation.java:182)
>> > > >     at
>> > > > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
>> > > > (Refl
>> > > > ectiveMethodInvocation.java:149)
>> > > >     at
>> > > >
>> > >
>> > > org.springframework.transaction.interceptor.TransactionInterceptor.inv
>> > > oke(Tr
>> > > a
>> > > > nsactionInterceptor.java:106)
>> > > >     at
>> > > > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
>> > > > (Refl
>> > > > ectiveMethodInvocation.java:171)
>> > > >     at
>> > > >
>> > >
>> > > org.springframework.transaction.interceptor.TransactionInterceptor.inv
>> > > oke(Tr
>> > > a
>> > > > nsactionInterceptor.java:106)
>> > > >     at
>> > > > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
>> > > > (Refl
>> > > > ectiveMethodInvocation.java:171)
>> > > >     at
>> > > >
>> > >
>> > > org.springframework.transaction.interceptor.TransactionInterceptor.inv
>> > > oke(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(JdkDynam
>> > > > ic
>> > > > AopProxy.java:204)
>> > > >     at $Proxy53.indexGoods4Mobile(Unknown Source)
>> > > >     at
>> > > >
>> > > com.beike.lucene.test.TestLuceneIndex.initGoodsIndex4Mobile(TestLucene
>> > > Inde
>> > > > x.java:45)
>> > > >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> > > >     at
>> > > >
>> > >
>> >
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
>> > > > 39)
>> > > >     at
>> > > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
>> > > > ssorI
>> > > > mpl.java:25)
>> > > >     at java.lang.reflect.Method.invoke(Method.java:597)
>> > > >     at
>> > > >
>> > > org.springframework.test.context.junit4.SpringTestMethod.invoke(Spring
>> > > TestM
>> > > > ethod.java:160)
>> > > >     at
>> > > >
>> > > org.springframework.test.context.junit4.SpringMethodRoadie.runTestMeth
>> > > od(S
>> > > > pringMethodRoadie.java:233)
>> > > >     at
>> > > > org.springframework.test.context.junit4.SpringMethodRoadie$RunBefore
>> > > > sThen
>> > > > TestThenAfters.run(SpringMethodRoadie.java:333)
>> > > >     at
>> > > >
>> > > org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepe
>> > > titio
>> > > > ns(SpringMethodRoadie.java:217)
>> > > >     at
>> > > >
>> > > org.springframework.test.context.junit4.SpringMethodRoadie.runTest(Spr
>> > > ingM
>> > > > ethodRoadie.java:197)
>> > > >     at
>> > > >
>> > > org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringM
>> > > etho
>> > > > dRoadie.java:143)
>> > > >     at
>> > > >
>> > >
>> > > org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invoke
>> > > TestMe
>> > > > thod(SpringJUnit4ClassRunner.java:160)
>> > > >     at
>> > > >
>> > >
>> > > org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRun
>> > > ner.ja
>> > > v
>> > > > a:51)
>> > > >     at
>> > > >
>> > >
>> > > org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.j
>> > > ava: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.jav
>> > > a:42)
>> > > >     at
>> > > >
>> > >
>> > > org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(Sp
>> > > ringJU
>> > > n
>> > > > it4ClassRunner.java:97)
>> > > >     at
>> > > >
>> > >
>> > > org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4T
>> > > estRef
>> > > 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(Remote
>> > > TestRu
>> > > > nner.java:460)
>> > > >     at
>> > > >
>> > >
>> > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(Remote
>> > > TestRu
>> > > > nner.java:673)
>> > > >     at
>> > > >
>> > >
>> > >
>> >
>>
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
>> > > > java:386)
>> > > >     at
>> > > >
>> > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTest
>> > > Runne
>> > > > r.java:196)
>> > > >
>> > > >
>> > > >
>> > > > --
>> > > > *
>> > > > *twitter.com/loujianwen
>> > >
>> > >
>> > > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
>> > > For additional commands, e-mail: java-user-help [at] lucene
>> > >
>> > >
>> >
>> >
>> > --
>> > *
>> > *twitter.com/loujianwen
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
>> For additional commands, e-mail: java-user-help [at] lucene
>>
>>
>
>
> --
> *
> *twitter.com/loujianwen

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


mintern at easyesi

Mar 27, 2012, 12:12 PM

Post #9 of 10 (298 views)
Permalink
Re: NumericField exception java.lang.IllegalStateException: call set???Value() before usage in lucene 3.5 [In reply to]

On Tue, Mar 27, 2012 at 12:21 AM, jianwen lou <loujanwen [at] gmail> wrote:
> 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);

It looks like you're setting priceField's value again instead of
salesField's. Looks like a copy-paste that wasn't fully edited.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


loujanwen at gmail

Mar 27, 2012, 7:28 PM

Post #10 of 10 (295 views)
Permalink
Re: NumericField exception java.lang.IllegalStateException: call set???Value() before usage in lucene 3.5 [In reply to]

thanks so much,Brandon Mintern.My mistak,sorry for everyone.

On Wed, Mar 28, 2012 at 3:12 AM, Brandon Mintern <mintern [at] easyesi>wrote:

> On Tue, Mar 27, 2012 at 12:21 AM, jianwen lou <loujanwen [at] gmail> wrote:
> > 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);
>
> It looks like you're setting priceField's value again instead of
> salesField's. Looks like a copy-paste that wasn't fully edited.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>
>


--
*
*twitter.com/loujianwen

Lucene java-user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.