Home | About | Sematext search-lucene.com search-hadoop.com
 Search Lucene and all its subprojects:

Switch to Threaded View
Lucene, mail # user - NumericField exception java.lang.IllegalStateException: call set???Value() before usage in lucene 3.5


Copy link to this message
-
Re: NumericField exception java.lang.IllegalStateException: call set???Value() before usage in lucene 3.5
Erick Erickson 2012-03-27, 12:40
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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
>>
>>
>> > -----Original Message-----
>> > From: jianwen lou [mailto:[EMAIL PROTECTED]]
>> > Sent: Tuesday, March 27, 2012 9:49 AM
>> > To: [EMAIL PROTECTED]
>> > 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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
>> > >
>> > >
>> > > > -----Original Message-----
>> > > > From: jianwen lou [mailto:[EMAIL PROTECTED]]
>> > > > Sent: Tuesday, March 27, 2012 9:21 AM
>> > > > To: [EMAIL PROTECTED]
>> > > > 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