lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Igal @ getRailo.org" <i...@getrailo.org>
Subject Re: NPE when adding a Document to an IndexWriter
Date Thu, 10 Jan 2013 03:14:28 GMT
I think that all I needed to create the components is:


     @Override
     protected Analyzer.TokenStreamComponents createComponents( String 
fieldName, Reader reader ) {

         Analyzer.TokenStreamComponents tsc = new 
Analyzer.TokenStreamComponents(

               getTokenFilterChain( reader, config )
         );

         return tsc;
     }


I'll need to test it to know for sure though.

thanks,


Igal


On 1/9/2013 6:54 PM, Igal @ getRailo.org wrote:
> hi Hoss -- thank you for your time.  it looks like you're right (and 
> it makes sense if the reader is advanced in two places at the same 
> time that it will cause a problem).
>
> I'll try to figure out how to create an Analyzer out of the 
> Tokenizer.  that's what I was trying to do there and obviously I did 
> it wrong.
>
> thanks again,
>
>
> Igal
>
>
> On 1/9/2013 6:28 PM, Chris Hostetter wrote:
>> : thanks for your reply.  please see attached.  I tried to maintain the
>> : structure of the code that I need to use in the library I'm 
>> building.  I think
>> : it should work for you as long as you remove the package 
>> declaration at the
>> : top.
>>
>> I can't currently try your code, but skimming through it i'd bet 
>> money the
>> problem is in your Analyzer.  Have you tried simplifying your test down
>> and just using "StandardAnalyzer" to rule that out?
>>
>> In particular i see this...
>>
>>>>> Analyzer.TokenStreamComponents tsc = new 
>>>>> Analyzer.TokenStreamComponents(
>>>>>                        getCharTokenizer( reader )
>>>>>                      , getTokenFilterChain( reader, config )
>>>>>              );
>> ...passing the same Reader to to diff methods there is almost certainly
>> not what you want to do.
>>
>>
>>
>> -Hoss
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>


---------------------------------------------------------------------
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