lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <erickerick...@gmail.com>
Subject Re: Unable to add more than 1 document to Index
Date Thu, 24 Apr 2008 13:15:27 GMT
Where are you getting your doc from? I see no

Document doc = new Document()

line in your code. So it's re-using an old one?

Best
Erick

On Wed, Apr 23, 2008 at 10:43 PM, Hasan Diwan <hasan.diwan@gmail.com> wrote:

>                writer = new IndexWriter(indexLocation, new
> StandardAnalyzer(), true);
>                String string = request.getParameter("text");
>                this.log("Text is "+string);
>                Date date = new Date();
>                String dateString = DateTools.dateToString(date,
> DateTools.Resolution.MINUTE);
>                this.log("Date is "+dateString);
>                Field allField = new Field("all", string, Field.Store.YES,
>  Field.Index.TOKENIZED);
>                Field dateField = new Field("date", dateString,
> Field.Store.YES,
>  Field.Index.UN_TOKENIZED);
>                doc.add(allField);
>                doc.add(dateField);
>                writer.addDocument(doc);
>                writer.optimize();
>                writer.close();
>
>  This code is supposed to get information from a JSP (and does) and put
>  it into a lucene index (and does) in a new document (and does not).
>  This is apparent when I query it using luke and the default lucene web
>  application. Any suggestions or pointers to what to do about this
>  would be eternally helpful? Thanks in advance!
> --
> Cheers,
> Hasan Diwan <hasan.diwan@gmail.com>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

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