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.ii...@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....@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.ii...@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-unsubscr...@lucene.apache.org
>> For additional commands, e-mail: java-user-h...@lucene.apache.org
>>
>>
>
>
> --
> *rohit*

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to