lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rohit Girdhar <rohit.ii...@gmail.com>
Subject Re: IndexWriter.addDocument() gives NullPointerException when used with a doc containing TextField
Date Tue, 12 Nov 2013 13:33:23 GMT
Hi
I realized my analyzer was null after all! I was constructing it after
passing it (as null) to IndexWriterConfig.
Fixed that and its working fine now.
Really sorry for the trouble!


thanks for the help!


On Tue, Nov 12, 2013 at 1:48 AM, Ian Lea <ian.lea@gmail.com> wrote:

> Well, you certainly shouldn't need to take any hacky approaches.
> TextFields do work.  Maybe post a small but complete code sample if
> you can't figure it out.
>
>
> --
> Ian.
>
>
> On Mon, Nov 11, 2013 at 7:45 PM, Rohit Girdhar <rohit.iiith@gmail.com>
> wrote:
> > Hi Ian,
> > Yes, I am using a StandardAnalyzer with the IndexWriter.
> > Actually I kind-of fixed the issue, by this hacky approach:
> > ```
> >   f = new Field("title", title_string, Field.Store.YES,
> > Field.Index.ANALYZED);
> >   f2 = new TextField("title", f.tokenStream())
> > ```
> > and then using f2 as the field for the doc does not give that exception.
> > However, I'm still not sure what went wrong in using the other
> constructor
> > for TextField...
> >
> > Thanks
> >
> > PS: Sorry about that, didn't realize that while posting :( . Updated the
> > message subject now.
> >
> >
> > On Mon, Nov 11, 2013 at 10:00 PM, Ian Lea <ian.lea@gmail.com> wrote:
> >
> >> Have you set an analyzer when you create your IndexWriter?
> >>
> >>
> >> --
> >> Ian.
> >>
> >> P.S.  Please start new questions in new messages with sensible subjects.
> >>
> >>
> >> On Mon, Nov 11, 2013 at 9:00 AM, Rohit Girdhar <rohit.iiith@gmail.com>
> >> wrote:
> >> > Hi
> >> >
> >> > I was trying to use the lucene JAVA API to create an index. I am
> >> repeatedly
> >> > getting NullPointerException when I try to add a document with a
> >> > TextField() field to the IndexWriter. The exception is:
> >> > http://pastebin.com/KFZT4XNV
> >> > I even tried to use the deprecated Field() API, but still the same
> >> > exception.
> >> > Any pointers?
> >> >
> >> > Thanks!
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >> For additional commands, e-mail: java-user-help@lucene.apache.org
> >>
> >>
> >
> >
> > --
> > *rohit*
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>


-- 
*rohit*

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