lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "dunpanic" <dunpa...@mailhost.net>
Subject RE: regarding Increamenta Indexing
Date Tue, 04 Mar 2003 16:41:16 GMT
Hi,

    If you refer to the code fragment below, the key line to pay attention
to is:

	writer = new IndexWriter(indexFile, analyzer, false);

    The last parameter in the constructor for IndexWriter tells lucene
whether to recreate the index from scratch.  In this case, the flag is set
to false, so when writer.addDocument(doc) is called later in the funciton,
the document is added to an existing index.

Choong-Yong, Koh

-----Original Message-----
From: Nellaiyappan Gomathinayagam
[mailto:NGomathinayagam@eforceglobal.com]
Sent: Wednesday, March 05, 2003 12:31 AM
To: Lucene Users List
Subject: regarding Increamenta Indexing


Hi,
 
Actually already i have added some thousan documents for indexing. Now i
need to include one more file for indexing. So if i recreate again, then it
will take more time. So how to include this single file in the already
existing index. is it possible. Will that code do the same thing wat i am
expecting??
 
Thanks in advance
 
Nellai...
 
 
 
 
-----Original Message----- 
From: Marcel Str [mailto:marcel@frightanic.com] 
Sent: Tue 3/4/2003 8:19 AM 
To: 'Lucene Users List' 
Cc: 
Subject: RE: Lucene Turbine Service



	> -----Original Message-----
	> From: Nellaiyappan Gomathinayagam
	> [mailto:NGomathinayagam@eforceglobal.com]
	> Sent: Tuesday, March 04, 2003 5:10 PM
	> To: Lucene Users List
	> Subject: RE: Lucene Turbine Service
	>
	>
	> Hi,
	>
	> Any one tried Incremental Indexing with Lucene. If so then
	> kindly guide me how to do that??
	
	What do you mean by 'incremental'? Adding a single entry/document to
an index?
	
	public void indexSingleEntry (File indexFile, String id, String cat,
String prob, String sol){
	        IndexWriter writer = null;
	        try {
	            Analyzer analyzer = new GermanAnalyzer();
	            writer = new IndexWriter(indexFile, analyzer, false);
	            Document doc = new Document();
	            doc.add(Field.Text("id", id));
	            doc.add(Field.Text("category", cat));
	            doc.add(Field.Text("problem", prob));
	            doc.add(Field.UnStored("solution", sol));
	            writer.addDocument(doc);
	
	        }
	        catch (Exception ex) {
	            ex.printStackTrace();
	        } finally {
	            if (null != writer) {
	                try {
	                    writer.close();
	                } catch (Exception ex) {
	                    ex.printStackTrace();
	                }
	            }
	        }
	    }
	
	
	Marcel
	
	
	
---------------------------------------------------------------------
	To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
	For additional commands, e-mail: lucene-user-help@jakarta.apache.org
	
	



Mime
View raw message