Yes they have the same field name. Can we use the default posIncr? If I want to create an IndexWriter w/o an Analyzer, why should I be forced to do new IndexWriter(new SimpleAnalyzer() /* for example */ ...), when the analyzer will never be used?
It is an edge case though which I can easily reproduce, but not sure how important it is to fix it (the fix should be simple though). Shai On Mon, Jul 6, 2009 at 2:05 PM, Michael McCandless < luc...@mikemccandless.com> wrote: > Were the two fields that you added to the doc the same field name? > > In which case, the pos incr gap is in fact needed, even if the fields > are pre-analyzed (have TokenStream values)? > > Mike > > On Thu, Jul 2, 2009 at 10:25 AM, Shai Erera<ser...@gmail.com> wrote: > > I hit NPE in DocInvertedPerField in the following scenario: > > 1) Create IndexWriter w/ a null Analyzer. > > 2) Add two fields to a Document, w/ a TokenStream (or one as not analyzed > > and one as TokenStream, or two not analyzed). > > 3) Add the document to the IndexWriter. > > The NPE comes from processFields (line 79), when it tries to read the > > position increment gap. > > > > I think I'm using it right, but want to verify. If I always add fields as > > TokenStream, or untokenized, I don't really need the Analyzer on > > IndexWriter. Also, in case of a TokenStream field, DocInverterPerField > just > > uses the TokenStream and not the Analyzer. So maybe it should read the > > posIncrGap only if analyzer is not null? > > > > Is this a bug or a misuse of IndexWriter by me? > > > > Shai > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-dev-h...@lucene.apache.org > >