lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Digy" <digyd...@gmail.com>
Subject RE: [Lucene.Net] how to add a new record to existing index
Date Wed, 02 Mar 2011 22:19:30 GMT

First of all, your code doesn't mean anything to me other than you add some
fields to a document object.

Also,  I can't see what you mean with *existing* index. The directory you
pass to the IndexWriter is the index you use 
and every document added(using IndexWriter's AddDocument) is written to that
index.

I think, we have problems in using a common terminology.

DIGY

PS: It would be better if you use "user" mailing list to ask questions. This
mailing lists is intented to be for development purposes.




-----Original Message-----
From: Wen Gao [mailto:samuel.gaowen@gmail.com] 
Sent: Wednesday, March 02, 2011 11:02 PM
To: lucene-net-dev@lucene.apache.org
Subject: [Lucene.Net] how to add a new record to existing index

Hi,
I already have created an index, and I want to insert an index record to
this existing index everytime I insert a new record to database.
For example,  if I want to insert an reord ("l1", "15","tom",
"20","2010/01/02") to my *existing* index, how can i do this? (I dont want
to create a new index, which takes too much time)

my format of index is as follows:
 ///////////////////////////
 doc.Add(new Lucene.Net.Documents.Field(
                "lmname",
                readerreader1["lmname"].ToString(),
                    //new
System.IO.StringReader(readerreader["cname"].ToString()),
                Lucene.Net.Documents.Field.Store.YES,
                 Lucene.Net.Documents.Field.Index.TOKENIZED)

                );

                //lmid
                doc.Add(new Lucene.Net.Documents.Field(
                "lmid",
                readerreader1["lmid"].ToString(),
                 Lucene.Net.Documents.Field.Store.YES,
                 Lucene.Net.Documents.Field.Index.UN_TOKENIZED));

                // nick name of user
                doc.Add(new Lucene.Net.Documents.Field(
                "nickName",
                 readerreader1["nickName"].ToString(),
                 Lucene.Net.Documents.Field.Store.YES,
                 Lucene.Net.Documents.Field.Index.UN_TOKENIZED));
                // uid
                doc.Add(new Lucene.Net.Documents.Field(
                "uid",
                 readerreader1["uid"].ToString(),
                 Lucene.Net.Documents.Field.Store.YES,
                 Lucene.Net.Documents.Field.Index.UN_TOKENIZED));

                // acttime
                doc.Add(new Lucene.Net.Documents.Field(
                "acttime",
                 readerreader1["acttime"].ToString(),
                 Lucene.Net.Documents.Field.Store.YES,
                 Lucene.Net.Documents.Field.Index.UN_TOKENIZED));
                writer.AddDocument(doc);
                ///////////////////////////////////////////////////

Thanks,
Wen


Mime
View raw message