lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jianwen lou <loujan...@gmail.com>
Subject NumericField exception java.lang.IllegalStateException: call set???Value() before usage in lucene 3.5
Date Tue, 27 Mar 2012 07:21:19 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message